springboot+mysql emoji存储异常

测试服运行正常,正式服无法存储

尝试了网上的方法
1、mysql链接后加 characterEncoding参数,无效
2、数据库字段原来也是utf8mb4改成了utf8mb4_unicode ,无效

最终有效果的是:
升级mysql依赖版本 从mysql-connector-java改成 mysql-connector-j的最新版,有效了。

有相似情况的可以试试

Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.

spirngboot项目,graalvm native 编译完成后运行服务运行报错,

Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.

看帖子说是jdk版本问题,可我是用的graalvm编译的没错呀。后测试发现跟springboot版本有关,springboot3.1.0会报这个错,3.0.4和3.0.7测试过没问题

反序列化错误com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `***` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information

在junit中用jackson做反序列化的时候报错

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of *** (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information

原因是用了2个class继承一个interface,反序列化interface时无法找到用哪个class结果出了异常,网上能搜到的解决方法是写个配置类,如:@Bean注解创建ObjectMapper、重写configureMessageConverters方法。

发现了一个更简单的方式,是在属性中加@JsonDeserialize注解如:

//这里I是interface I2是I的实现类
@JsonDeserialize(contentAs=I2.class)
public interface I{
  Integer a;
}

这样Junit中的反序列化就能跑通了

maven提交中央仓库需要注意的地方

标准流程网上有很多跟着做就行,注意的点有几个

1.groupId要留意别写错,有时提示403可能不是账号问题是groupId没对上

2.gpg公钥上传服务器,我的win10命令行上传提示失败,结果发现公钥的网页可以支持文件上传

3.deploy成功发布后release是删除不了,所以release版本慎重点发布,开发的时候用SNAPSHOT版本就很好。release版本是可以在mvnrepository.com搜索到的。


hql组合条件查sum的方法

@Query("select sum(r.amount) from RechargeOrder r where 1=1  " +
            "AND (case when (:status is null) then true when(:status=r.status) then true else false end)=true " +
            "AND (case when (:walletType is null) then true when(:walletType=r.walletType) then true else false end)=true " +
            "AND (case when (:payType is null) then true when(:payType=r.payType) then true else false end)=true " +
            "AND (case when (:userId is null) then true when(:payType=r.userId) then true else false end)=true " +
            "AND (case when (:rechargeType is null) then true when(:rechargeType=r.rechargeType) then true else false end)=true " +
            "AND (case when (:successTimeBegin is null) then true when(:successTimeBegin<=r.successTime) then true else false end)=true " + "AND (case when (:successTimeEnd is null) then true when(:successTimeEnd>=r.successTime) then true else false end)=true " +

            "")
    Integer sumAmount(
            @Param("status")  Integer status
            ,@Param("walletType")  Integer walletType
            ,@Param("payType")  Integer payType
            ,@Param("userId")  Integer userId
            ,@Param("rechargeType")  Integer rechargeType
            ,@Param("successTimeBegin")  Date successTimeBegin
            ,@Param("successTimeEnd")  Date successTimeEnd
    );

swagger-ui在spring-cloud里无法设置basepath的坑

在springcloud里网关做的路由,隐藏了微服务的名称。
单发现无论怎么设置host和basepath都没效果,结果发现是版本的坑
用2.6.1是可以的2.7设置无效。

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</dependency>

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
</dependency>


	

hadoop2.6 配置注意点

终于能用了,都快崩溃了
ERROR org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: Exception in doCheckpoint
和之前种种异常,
列下需要注意的地方:

1:9000和9001, 这俩设置成统一的
2:虚拟机iptables 要关掉,有可能把端口封掉
3:hostname 跟hosts里设置成一样的会比较方便,生成id_rsa.pub的时候里面的路径就自动跟计算机名一致了
4: 我是用虚拟机的,1个master 1个slave 在slaves里把 master,slave1都加上了。

额外的诡异问题,配置好后运行无异常。但用测试demo,wordcount无法生成输出内容。
什么都没动,没关机器,第二天又自己好了。。

Entity Bean 需要实现 Serializable 否则 。。

服务端异常
23:53:29,131 ERROR [org.jboss.as.ejb3] (Remoting “wslhkpc” task-7) JBAS014248: 消息 Channel ID 3367520a (inbound) of Remoting connection 34916e44 to /127.0.0.1:62015 里的频道 org.jboss.remoting3.remote.InboundMessage$3@345c347c 上的异常: java.io.IOException: Stream is closed
at org.xnio.streams.BufferPipeOutputStream.closed(BufferPipeOutputStream.java:62) [xnio-api-3.0.10.GA-redhat-1.jar:3.0.10.GA-redhat-1]
at org.xnio.streams.BufferPipeOutputStream.checkClosed(BufferPipeOutputStream.java:68) [xnio-api-3.0.10.GA-redhat-1.jar:3.0.10.GA-redhat-1]
at org.xnio.streams.BufferPipeOutputStream.write(BufferPipeOutputStream.java:94) [xnio-api-3.0.10.GA-redhat-1.jar:3.0.10.GA-redhat-1]
at org.jboss.remoting3.remote.OutboundMessage.write(OutboundMessage.java:270) [jboss-remoting-3.3.1.Final-redhat-1.jar:3.3.1.Final-redhat-1]
at java.io.DataOutputStream.write(DataOutputStream.java:107) [rt.jar:1.8.0_11]
at org.jboss.as.ejb3.remote.protocol.AbstractMessageHandler$1.write(AbstractMessageHandler.java:217)
at org.jboss.marshalling.OutputStreamByteOutput.write(OutputStreamByteOutput.java:52) [jboss-marshalling-1.4.6.Final-redhat-1.jar:1.4.6.Final-redhat-1]
at org.jboss.marshalling.SimpleDataOutput.shallowFlush(SimpleDataOutput.java:353) [jboss-marshalling-1.4.6.Final-redhat-1.jar:1.4.6.Final-redhat-1]
at org.jboss.marshalling.river.RiverMarshaller.writeString(RiverMarshaller.java:1509)
at org.jboss.marshalling.river.RiverMarshaller.writeNewSerializableClass(RiverMarshaller.java:1415)
at org.jboss.marshalling.river.RiverMarshaller.writeNewClass(RiverMarshaller.java:1345)
at org.jboss.marshalling.river.RiverMarshaller.writeClass(RiverMarshaller.java:1199)
at org.jboss.marshalling.river.RiverMarshaller.writeNewSerializableClass(RiverMarshaller.java:1438)
at org.jboss.marshalling.river.RiverMarshaller.writeSerializableClass(RiverMarshaller.java:1398)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:884)
at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58) [jboss-marshalling-1.4.6.Final-redhat-1.jar:1.4.6.Final-redhat-1]
at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111) [jboss-marshalling-1.4.6.Final-redhat-1.jar:1.4.6.Final-redhat-1]
at org.jboss.as.ejb3.remote.protocol.AbstractMessageHandler.writeException(AbstractMessageHandler.java:112)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.processMessage(MethodInvocationMessageHandler.java:166)
at org.jboss.as.ejb3.remote.protocol.versionone.VersionOneProtocolChannelReceiver.handleMessage(VersionOneProtocolChannelReceiver.java:160)
at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:452) [jboss-remoting-3.3.1.Final-redhat-1.jar:3.3.1.Final-redhat-1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_11]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_11]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_11]
Caused by: an exception which occurred:
in object java.io.EOFException@5a234c92

客户端异常
Exception in thread “main” java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:TestEJB, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@69a3d1d
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:735)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:116)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)
at org.jboss.ejb.client.EJBClientInvocationContext.retryRequest(EJBClientInvocationContext.java:208)
at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:256)
at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:265)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:198)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:181)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:144)
at com.sun.proxy.$Proxy3.createCabin(Unknown Source)
at client.ClientTest.date(ClientTest.java:155)
at client.ClientTest.main(ClientTest.java:28)

————-
出现原因:Entity Bean 必须实现 Serializable

jboss eap 6.3 mysql数据源错误提示 JBAS010441

配置mysql数据源出现错误提示:
failure description: “JBAS010441: Failed to load module for driver
中文日志是无法加载模块

环境是jboss eap 6.3

网上找了n种答案,虽然不是我的问题,还是列举一下
答案1,说是版本问题,要mysql-5.1.30一下的
答案2,配置问题 eap的配置跟老版本的不太一样,得用modules
反正大家配置都差不多怎么都出不来,

我这里最后是因为这个:

看jboss自带的module.xml木有这行,去掉就好使了!!