SpringBoot SerializationUtils cloning (deserialization) class loader inconsistency problem (ClassCastException)

Problem analysis When using the org.apache.commons.lang.SerializationUtils.clone method in SpringBoot, it was found that a type inconsistency error occurred when the cloned class was forced to the corresponding class. After inspection, it was found that two seemingly identical Class loaders for classes are inconsistent Scene Error message java.lang.ClassCastException: com.tianqiauto.tis.pc.dingdanyupai.po.PrePoint cannot be cast to com.tianqiauto.tis.pc.dingdanyupai.po.PrePoint Detection information […]

java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Timestamp

Error Running the SpringMVC + Mybatis project, the console reports an error Detailed error There is a field purchase_date in the user_order1 table of the database, and its specific information is as follows In business, it is necessary to obtain the current time as the purchase time, that is, the following code exists UserOrder userOrder […]

[Solved] jenkins posted an error to rancher: ERROR: Build step failed with exception java.lang.ClassCastException: class com.

Error message ERROR: Build step failed with exception java.lang.ClassCastException: class com.fasterxml.jackson.databind.node.NullNode cannot be cast to class com.fasterxml.jackson.databind.node.ObjectNode (com.fasterxml.jackson.databind.node.NullNode and com.fasterxml .jackson.databind.node.ObjectNode are in unnamed module of loader jenkins.util.AntClassLoader @3e61f18f) at io.jenkins.plugins.rancher2.Rancher2RedeployBuilder.perform(Rancher2RedeployBuilder.java:136) at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123) at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:806) at hudson.model.Build$BuildExecution.build(Build.java:198) at hudson.model.Build$BuildExecution.doRun(Build.java:163) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:514) at hudson.model.Run.execute(Run.java:1888) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:99) at hudson.model.Executor.run(Executor.java:432) Build step […]

[Solved] java.lang.ClassCastException: [I cannot be cast to [Ljava.lang.ObjectSolutions

Here is the problem using the MyBatis-Plus framework The reason for the problem: the code I use in the service layer and the persistence layer is //Service layer void addRelation(int teachId, int[] stuIdArray); //persistence layer void addRelation(@Param(“teachId”) int teachId, @Param(“array”) int[] stuIdArray); Finally, during the test, the problem on the picture will be reported, that […]

[Solved] Solve the error java.lang.ClassCastException java.util.LinkedHashMap cannot be cast to xxx (entity class)

1. The front-end encapsulates JSON values, and the back-end requires Listreceive Map map = jsonObject.getInnerMap(); List<entity class> list1 = (List<entity class>) map.get(“xxx”); 2. An error is reported when the forsearch loop is performed xxx.forEach((item)->{}) Error message: java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to com.xxx.xxxx.entity.xxxx 3. Break point debugging and view and find that two Maps are […]

[Solved] SpringBoot integrated Dubbo error: java.lang.ClassCastException

When the project uses SpringBoot and Dubbo for construction, the following error is reported when the dubbo service is called remotely: com.alibaba.dubbo.remoting.RemotingException: com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote proxy method chat to registry://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService ?application=health-user &dubbo=2.5.3 &export=dubbo://192.168.1.116:20803/org.health.facede.chat.api.ChatService?anyhost=true&application=health-user&default.retries =0&default.timeout=100000&dubbo=2.5.3&interface=org.health.facede.chat.api.ChatService&methods=chat&pid=7340&revision=1.0.0-SNAPSHOT&side=provider&timestamp=1475042396821 &pid=7340 &registry=zookeeper & ;timestamp=1475042396801, cause: java.lang.ClassCastException: org.health.service.chat.impl.ChatServiceImpl cannot be cast to org.health.service.chat.impl.ChatServiceImpl com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote proxy method […]

[Solved] [Redis][Error] ClassCastException: class java.lang.String cannot be cast to class java.lang.XXX

Problem description 2022-08-09 08:56:12.115 ERROR 11332 – [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [ ] threw exception [Request processing failed; nested exception is java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Long (java.lang.String and java.lang.Long are in module java. base of loader ‘bootstrap’)] with root cause java.lang.ClassCastException: class java.lang.String cannot […]

[Solved] Cannot be cast to error in java.lang.ClassCastException encountered in spring (beginner)

Regarding this error, we may encounter cannot be cast to (what type cannot be converted to what). The scene where I encountered the problem is that the package is not imported when copying the package. applicationContext.xml is as follows <?xml version=”1.0″ encoding=”UTF-8″?> <beans xmlns=”http://www.springframework.org/schema/beans” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd”> <!– Use the name attribute to implement construct […]

[Solved] Error when mybatis adds data: java.lang.IllegalArgumentException java.lang.ClassCastException

Write directory title here question explain the problem analyse problem Solve the problem Questions The framework of the server orm uses mybatis. When inserting the administrator, the following error occurs: org.apache.ibatis.reflection.ReflectionException: Could not set property ‘id’ of ‘class com.xxx.Manager’ with value ‘1407257724219068417’ Cause: java.lang.IllegalArgumentException: java.lang.ClassCastException@78c9c0fb Explain the problem The above problem is explained in Chinese: […]

[Solved] The solution of java.lang.ClassCastException format conversion error

original code LoginUser loginUser = redisCache.getCacheObject(redisKey); In fact, it is an operation to get a value from redis, and then an error is reported java.lang.ClassCastException:xxx.xxx.xxx.LoginUser cannot be cast to xxx.xxx.xxx.LoginUser Replacing it with the following will solve it LoginUser loginUser; Object cacheObject = redisCache.getCacheObject(redisKey); if (cacheObject instanceof LoginUser) {<!– –> loginUser = (LoginUser) cacheObject; } […]