Tag Archives: java

[Solved] Spring Boot Project Error: Failed to load property source from

1. There may be a problem with the encoding format of yaml configuration file

All set to UTF-8.

2. Or check whether the writing configured in the file is wrong. For example, the indentation of the next level is less than that of the previous level

The name and weight in the above figure are more than one indentation than the OO in the above figure. Just change the indentation to normal, as shown below

[Solved] JAVA Python Error: Cannot create PyString with non-byte value

Error code
case 1.
interpreter.execfile (“your file path”)
reason for error reporting: your file was not found

Situation 2. New pystring (“your string”)
error reason: there is Chinese in the string
solution: replace new pystring (“your string”) with
pystring strjason = py.newstring (“your string”)
or pystring strjason = py.newstringorunicode (“your string”);

Invalid bound statement (not found) of custom SQL in mybatisplus

1、 Mybatisplus only configures mapper in YML, and the path scanning is not enough

mapper-locations: classpath:com/jack/shale_porosity/mapper/xml/*.xml

In this way, only the basemapper provided by mybatis can be used. The mapper file is not loaded in the target file.

2、 Configure the mapper file scanning path again in the pom.xml file

 <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>

In this way, you can successfully use custom SQL and SQL in basemapper.

Failed to get the resources path in the jar package, reporting an error null pointer

Background

The springboot project calls the method of a local jar package and needs the file path under the project resources. The file is stored under resources.

Trial and error process

1. Original code:

First use classloader.getsystemresource ("file name") , and the local operation is normal. However, an error null pointer is reported after the jar package is typed.

2. First modification:

Most people on the Internet say that they use this. Getclass(). Getclassloader(). Getresource() , but they still can’t. the two principles are the same.

3. Second modification:

Another method is to use the file stream to obtain the file, this. Getclass(). Getclassloader(). Getresourceasstream() , but this is to obtain the file directly. It needs to be the file path, but it can’t.

4. Finally:

Use string filepath = system. Getproperty ("user. Dir") + "\ \ file name" , get the path of the jar package, add the file name to get the file address, but you need to put the file in the same file directory as the jar package.

dot
system. Getproperty (“user. Dir”) + “\ double slash in file name” is in Windows environment. If it needs to be changed to “/” in Linux environment.

(at present, we haven’t found a way not to put the documents outside. There is a solution. I hope the bosses will give us their advice!)

Flume receives an error when a single message is too large

org.apache.kafka.common.errors.RecordTooLargeException: The request included a message larger than the max message size the server will accept.

Java client tuning: Max_ REQUEST_ SIZE_ CONFIG

Kafka server side adjustment: message. Max. bytes = 2147483640 is close to the max of int, because the maximum range of this value is int

Special note: after the parameter is adjusted, it has no effect on the created topic
adjust the parameter of the created topic: set to the maximum integer value of 2147483647

bin/kafka-configs.sh --zookeeper localhost:2181  --alter --topic topic_name   --add-config  max.message.bytes=2147483647

Problem solving
 

Ambqpioexception of rabbitmq error: java.io.ioexception

org.springframework.amqp.AmqpIOException: java.io.IOException

at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:71)
at org.springframework.amqp.rabbit.connection.RabbitAccessor.convertRabbitAccessException(RabbitAccessor.java:116)
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:2103)
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:2050)
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:2030)
at org.springframework.amqp.rabbit.core.RabbitAdmin.initialize(RabbitAdmin.java:591)

The error reports are as follows:
if this problem occurs because you are writing the expired section, it is probably because you are in the same queue.

1. The expiration time of the previous queue is modified in the later code

2. When declaring the queue, the exclusive attribute is specified as true. This attribute indicates whether there can be exclusive. There can only be one consumer listener queue. When cnnection is closed. Whether to delete the queue. If true is set, an error will be reported when multiple services are connected to the consumer

Springboot startup error [extshutdown hook]

Refer to springboot startup error [extshutdown hook] – ask at the door – blog park

The main reason is package import error

No or wrong web initiator was imported

The processing method is as follows: import the following configuration into the POM file

       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>2.4.4</version>
        </dependency>

Just run it again

Zeppelin starts successfully, but an error is reported

Error message

The Zeppelin service was started successfully, and the UI interface was accessed normally, but the running code reported an error.

org.apache.thrift.transport.TTransportException
    at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)
    at org.apache.thrift.transport.TTransport.readAll(TTransport.java:86)
    at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:429)
    at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:318)
    at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:219)
    at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
    at org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService$Client.recv_interpret(RemoteInterpreterService.java:241)
    at org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService$Client.interpret(RemoteInterpreterService.java:225)
    at org.apache.zeppelin.interpreter.remote.RemoteInterpreter.interpret(RemoteInterpreter.java:229)
    at org.apache.zeppelin.interpreter.LazyOpenInterpreter.interpret(LazyOpenInterpreter.java:93)
    at org.apache.zeppelin.notebook.Paragraph.jobRun(Paragraph.java:229)
    at org.apache.zeppelin.scheduler.Job.run(Job.java:171)
    at org.apache.zeppelin.scheduler.RemoteScheduler$JobRunner.run(RemoteScheduler.java:328)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

Cause of error reporting: this error is caused by the failure to connect to the corresponding spark and other related service parsers. If the spark and Hadoop services run normally, it is the cause of version incompatibility.

Solution

Replace with a compatible Zeppelin version.

JDK upgrade 17 project reports an error java.lang.reflect.inaccessibleobjectexception

When upgrading java11 to java17, the project starts normally, and an error is reported when executing the mybatis query

According to the error message, it is suspected that there is a problem with mybatis XML configuration. It is found that there is no problem. Jdk11 starts normally

reating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3c88e19e] was not registered for synchronization because synchronization is not active
JDBC Connection [org.apache.shardingsphere.shardingjdbc.jdbc.core.connection.ShardingConnection@5b6098ff] will not be managed by Spring
==>  Preparing: select id, user_id as userId, order_id as orderId, remark, create_time as createTime from t_order where order_id=?
==> Parameters: 12(Long)
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3c88e19e]
2021-09-20 22:47:33.431 ERROR 19452 --- [nio-9090-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 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.reflect.InaccessibleObjectException: Unable to make field private static final long java.lang.Number.serialVersionUID accessible: module java.base does not "opens java.lang" to unnamed module @708f5957
### The error may exist in file [D:\java\IdeaProjects\sharding-demo\target\classes\mapper\OrderMapper.xml]
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select             id,             user_id as userId,             order_id as orderId,             remark,             create_time as createTime         from t_order         where order_id=?
### Cause: java.lang.reflect.InaccessibleObjectException: Unable to make field private static final long java.lang.Number.serialVersionUID accessible: module java.base does not "opens java.lang" to unnamed module @708f5957] with root cause

java.lang.reflect.InaccessibleObjectException: Unable to make field private static final long java.lang.Number.serialVersionUID accessible: module java.base does not "opens java.lang" to unnamed module @708f5957
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[na:na]
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[na:na]
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) ~[na:na]
	at java.base/java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:130) ~[na:na]
	at org.codehaus.groovy.reflection.CachedClass$1$1.run(CachedClass.java:55) ~[groovy-2.4.5-indy.jar:2.4.5]
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:318) ~[na:na]
	at org.codehaus.groovy.reflection.CachedClass$1.initValue(CachedClass.java:50) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.reflection.CachedClass$1.initValue(CachedClass.java:48) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:49) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:36) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.reflection.CachedClass.getFields(CachedClass.java:264) ~[groovy-2.4.5-indy.jar:2.4.5]
	at groovy.lang.MetaClassImpl.addFields(MetaClassImpl.java:2377) ~[groovy-2.4.5-indy.jar:2.4.5]
	at groovy.lang.MetaClassImpl.inheritFields(MetaClassImpl.java:2372) ~[groovy-2.4.5-indy.jar:2.4.5]
	at groovy.lang.MetaClassImpl.setupProperties(MetaClassImpl.java:2259) ~[groovy-2.4.5-indy.jar:2.4.5]
	at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:3302) ~[groovy-2.4.5-indy.jar:2.4.5]
	at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3266) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:254) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:285) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:295) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:261) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:873) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.createPojoSite(CallSiteArray.java:125) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:166) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) ~[groovy-2.4.5-indy.jar:2.4.5]
	at Script6$_run_closure1.doCall(Script6.groovy:1) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) ~[groovy-2.4.5-indy.jar:2.4.5]
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) ~[groovy-2.4.5-indy.jar:2.4.5]
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) ~[groovy-2.4.5-indy.jar:2.4.5]
	at groovy.lang.Closure.call(Closure.java:426) ~[groovy-2.4.5-indy.jar:2.4.5]
	at groovy.lang.Closure.call(Closure.java:420) ~[groovy-2.4.5-indy.jar:2.4.5]
	at org.apache.shardingsphere.core.strategy.route.inline.InlineShardingStrategy.execute(InlineShardingStrategy.java:94) ~[sharding-core-common-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.core.strategy.route.inline.InlineShardingStrategy.doSharding(InlineShardingStrategy.java:76) ~[sharding-core-common-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.core.strategy.route.inline.InlineShardingStrategy.doSharding(InlineShardingStrategy.java:63) ~[sharding-core-common-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.routeTables(ShardingStandardRoutingEngine.java:214) ~[sharding-core-route-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.route0(ShardingStandardRoutingEngine.java:195) ~[sharding-core-route-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.routeByShardingConditionsWithCondition(ShardingStandardRoutingEngine.java:121) ~[sharding-core-route-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.routeByShardingConditions(ShardingStandardRoutingEngine.java:115) ~[sharding-core-route-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.getDataNodes(ShardingStandardRoutingEngine.java:96) ~[sharding-core-route-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.route(ShardingStandardRoutingEngine.java:74) ~[sharding-core-route-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.sharding.route.engine.ShardingRouteDecorator.decorate(ShardingRouteDecorator.java:69) ~[sharding-core-route-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.sharding.route.engine.ShardingRouteDecorator.decorate(ShardingRouteDecorator.java:53) ~[sharding-core-route-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.underlying.route.DataNodeRouter.executeRoute(DataNodeRouter.java:91) ~[shardingsphere-route-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.underlying.route.DataNodeRouter.route(DataNodeRouter.java:76) ~[shardingsphere-route-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.underlying.pluggble.prepare.PreparedQueryPrepareEngine.route(PreparedQueryPrepareEngine.java:54) ~[shardingsphere-pluggable-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.executeRoute(BasePrepareEngine.java:96) ~[shardingsphere-pluggable-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.prepare(BasePrepareEngine.java:83) ~[shardingsphere-pluggable-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.prepare(ShardingPreparedStatement.java:183) ~[sharding-jdbc-core-4.1.1.jar:4.1.1]
	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.execute(ShardingPreparedStatement.java:143) ~[sharding-jdbc-core-4.1.1.jar:4.1.1]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59) ~[mybatis-3.5.7.jar:3.5.7]
	at jdk.proxy3/jdk.proxy3.$Proxy95.execute(Unknown Source) ~[na:na]
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64) ~[mybatis-3.5.7.jar:3.5.7]
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) ~[mybatis-3.5.7.jar:3.5.7]
	at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) ~[mybatis-3.5.7.jar:3.5.7]
	at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) ~[mybatis-3.5.7.jar:3.5.7]
	at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) ~[mybatis-3.5.7.jar:3.5.7]
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) ~[mybatis-3.5.7.jar:3.5.7]
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89) ~[mybatis-3.5.7.jar:3.5.7]
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151) ~[mybatis-3.5.7.jar:3.5.7]
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145) ~[mybatis-3.5.7.jar:3.5.7]
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140) ~[mybatis-3.5.7.jar:3.5.7]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427) ~[mybatis-spring-2.0.6.jar:2.0.6]
	at jdk.proxy2/jdk.proxy2.$Proxy65.selectList(Unknown Source) ~[na:na]
	at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224) ~[mybatis-spring-2.0.6.jar:2.0.6]
	at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147) ~[mybatis-3.5.7.jar:3.5.7]
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80) ~[mybatis-3.5.7.jar:3.5.7]
	at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145) ~[mybatis-3.5.7.jar:3.5.7]
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) ~[mybatis-3.5.7.jar:3.5.7]
	at jdk.proxy2/jdk.proxy2.$Proxy66.getOrderByOrderId(Unknown Source) ~[na:na]
	at com.fancv.shardingdemo.service.impl.OrderServiceImpl.getOrderByOrderId(OrderServiceImpl.java:26) ~[classes/:na]
	at com.fancv.shardingdemo.controller.OrderController.getOrderInfo(OrderController.java:42) ~[classes/:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]

Search data discovery

Someone is experiencing the same problem when upgrading to jdk9

By adding startup parameters

--add-opens java.base/java.lang=ALL-UNNAMED

Original information

The following error message appears:

Exception in thread “main”
java.lang.reflect.InaccessibleObjectException: Unable to make field
private static final long java.lang.Long.serialVersionUID accessible:
module java.base does not “opens java.lang” to unnamed module
@224aed64
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible (AccessibleObject.java:207)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
at com.jdojo.intruder.TestManifestAttributes.main(TestManifestAttributes.java:10)
A runtime error indicates that the application cannot access the private static serialVersionUID because the java.lang package in the java.base module is not open. Let’s try the – add opens option first:

C: \ java9revealed & gt; Java — add opens Java. Base/Java. Lang = all unnamed
– jar com.jdojo.intruder \ dist \ com.jdojo.intruder.jar output information is as follows:

Long. SerialVersionUID = 4290774380558885855 this command works normally and verify that the command line option is the solution in this case.
we use the add opens attribute in the manifest.mf file to fix this error, as shown below.

Manifest version: 1.0 main class:
com.jdojo.intruder.testmanifestattributes add opens:
java.base/java.lang recreate the executable jar and run it with the same command:

C: \ java9revealed & gt; Java – jar
com.jdojo.intruder \ dist \ com.jdojo.intruder.jar the output result is:

Long.serialVersionUID=4290774380558885855

Run the project again and query the data successfully

Summary: upgrading from java11 to java17 is a personal computer at home, not a production environment,

It takes about 5 hours to solve the problem, because the project is a shared research project, involving many knowledge points, and it takes a long time to locate the problem.

Difficult: the project itself has no problem starting jdk11, but an error is reported after upgrading jdk15.

reference material: https://www.cnblogs.com/IcanFixIt/p/7144366.html

Technical exchange group:

Error creating bean with name ‘servletEndpointRegistrar‘ defined in class path resource

The errors encountered in writing as service items today are shown below. I only know that the creation of error creating bean with name ‘servletendpointregistrar’ defined in class path resource failed. I also found some solutions on the Internet. The most common solutions are that there is a lack of JDBC dependency, or that the database configuration file is wrong. I also compared the database, There is no lack of JDBC dependency, which shows that my database and dependency are correct. I compared other service services and found that more configuration files were introduced into the configuration file

[${project.name}] 2021-09-10 23:21:44,213 ERROR [localhost-startStop-1][Jdk14Logger.java:87] - Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration.class]: Unsatisfied dependency expressed through method 'servletEndpointRegistrar' parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'management.endpoints.web-org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties': Could not bind properties to 'WebEndpointProperties' : prefix=management.endpoints.web, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'management.endpoints.web.exposure' to org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties$Exposure
[${project.name}] 2021-09-10 23:21:44,240 WARN [main][Jdk14Logger.java:87] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
[${project.name}] 2021-09-10 23:21:44,241 INFO [main][DubboGenericServiceFactory.java:159] - The Dubbo GenericService ReferenceBeans are destroying...
[${project.name}] 2021-09-10 23:21:44,245 INFO [main][Jdk14Logger.java:87] - class org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor was destroying!

My Nacos profile is

#HTTP format configuration spring:
http:
  encoding:
    charset: UTF‐8
    force: true
    enabled: true
  messages:
    encoding: UTF‐8
#tomcat header information (user ip and access protocol) and access path configuration
server:
  tomcat:
    remote_ip_header: x‐forwarded‐for
    protocol_header: x‐forwarded‐proto
  servlet:
    context‐path: /lifly
  use‐forward‐headers: true

#Service monitoring and management configuration, operation and maintenance related
management:
  endpoints:
    web:
      exposure:
      include: refresh,health,info,env

This configuration file defines the user IP and access path, as well as some configuration files related to service monitoring, management and operation and maintenance. However, the remote call is not used in the service, but I introduced this configuration file. The reason for my error is this, so I recorded it
My bootstrap.yml configuration file is as follows:

server:
  port: 56050 
nacos:
  server:
    addr: 127.0.0.1:8848
spring:
  application:
    name: transaction-service
#  main:
#    allow-bean-definition-overriding: true # Spring Boot 2.1 
  cloud:
    nacos:
      discovery:
        server-addr: 127.0.0.1:8848
#        server-addr: ${nacos.server.addr}
        namespace: 339eea59-f7f4-44d0-a3fa-9f1f85bd5b4f
#        cluster-name: COMMON_GROUP
      config:
        server-addr: 127.0.0.1:8848
#        server-addr: ${nacos.server.addr} 
        file-extension: yaml
        namespace: 339eea59-f7f4-44d0-a3fa-9f1f85bd5b4f  
        group: DEFAULT_GROUP 
        ext-config:
          -
            refresh: true
            data-id: spring-boot-http.yaml # spring boot http
            group: COMMON_GROUP 
#          -
#            refresh: true
#            data-id: spring-boot-starter-druid.yaml # spring boot starter druid
#            group: COMMON_GROUP 
#          -
#            refresh: true
#            data-id: spring-boot-mybatis-plus.yaml # spring boot mybatisplus
#            group: COMMON_GROUP 
#          - refresh: true
#            data-id: spring-boot-redis.yaml 
#            group: COMMON_GROUP 
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/huiminpay_transaction?useUnicode=true&useSSL=false
    #  url: jdbc:mysql://localhost:3306/huiminpay_merchant_service?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true&useUnicode=true
    username: root
    password: 1234
mybatis-plus:
  type-aliases-package: com.huiminpay.transaction.entity
  mapper-locations: classpath:/mapper/*.xml

dubbo:
  scan:
    # dubbo 
    base-packages: com.huiminpay
  protocol:
    # dubbo 协议
    name: dubbo
    port: 20893
  registry:
    address: nacos://127.0.0.1:8848
  application:
    qos:
      port: 22250 # dubbo qos
  consumer:
    check: false
    timeout: 3000
    retries: -1

logging:
  config: classpath:log4j2.xml

I commented out the import file and the project started. Record it again, and I hope it will be helpful to you. Comment out the following import file

 ext-config:
          -
            refresh: true
            data-id: spring-boot-http.yaml # spring boot http set
            group: COMMON_GROUP