You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/05/17 08:59:42 UTC

[GitHub] [shardingsphere] ScavengerDD opened a new issue #5657: preciseAlgorithmClassName: java -jar project.jar error:Caused by: java.lang.ClassNotFoundException

ScavengerDD opened a new issue #5657:
URL: https://github.com/apache/shardingsphere/issues/5657


   ## Question
   dependency:
   <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>sharding-jdbc-spring-boot-starter</artifactId>
               <version>4.0.0-RC1</version>
           </dependency>
           <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>sharding-core-common</artifactId>
               <version>4.0.0-RC1</version>
           </dependency>
   
   part of yml config:
   precise-algorithm-class-name: package-name.my-class-name
   range-algorithm-class-name: package-name.my-class-name
   
   but when i run java -jar project.jar..... error info:
   
   Caused by: java.lang.ClassNotFoundException: package-name.my-class-name
   	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582) ~[na:na]
   	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190) ~[na:na]
   	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499) ~[na:na]
   	at java.base/java.lang.Class.forName0(Native Method) ~[na:na]
   	at java.base/java.lang.Class.forName(Class.java:291) ~[na:na]
   	at org.apache.shardingsphere.core.strategy.route.ShardingAlgorithmFactory.newInstance(ShardingAlgorithmFactory.java:45) ~[sharding-core-common-4.0.0-RC1.jar:4.0.0-RC1]
   	at org.apache.shardingsphere.core.yaml.swapper.impl.ShardingStrategyConfigurationYamlSwapper.swap(ShardingStrategyConfigurationYamlSwapper.java:75) ~[sharding-core-common-4.0.0-RC1.jar:4.0.0-RC1]
   	at org.apache.shardingsphere.core.yaml.swapper.impl.TableRuleConfigurationYamlSwapper.swap(TableRuleConfigurationYamlSwapper.java:63) ~[sharding-core-common-4.0.0-RC1.jar:4.0.0-RC1]
   	at org.apache.shardingsphere.core.yaml.swapper.impl.ShardingRuleConfigurationYamlSwapper.swap(ShardingRuleConfigurationYamlSwapper.java:82) ~[sharding-core-common-4.0.0-RC1.jar:4.0.0-RC1]
   	at org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration.dataSource(SpringBootConfiguration.java:95) ~[sharding-jdbc-spring-boot-starter-4.0.0-RC1.jar:4.0.0-RC1]
   	at org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration$$EnhancerBySpringCGLIB$$645084fc.CGLIB$dataSource$0(<generated>) ~[sharding-jdbc-spring-boot-starter-4.0.0-RC1.jar:4.0.0-RC1]
   	at org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration$$EnhancerBySpringCGLIB$$645084fc$$FastClassBySpringCGLIB$$a4b3c757.invoke(<generated>) ~[sharding-jdbc-spring-boot-starter-4.0.0-RC1.jar:4.0.0-RC1]
   	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.1.8.RELEASE.jar:5.1.8.RELEASE]
   	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
   	at org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration$$EnhancerBySpringCGLIB$$645084fc.dataSource(<generated>) ~[sharding-jdbc-spring-boot-starter-4.0.0-RC1.jar:4.0.0-RC1]
   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[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:564) ~[na:na]
   	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
   	... 155 common frames omitted


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ScavengerDD commented on issue #5657: preciseAlgorithmClassName: java -jar project.jar error:Caused by: java.lang.ClassNotFoundException

Posted by GitBox <gi...@apache.org>.
ScavengerDD commented on issue #5657:
URL: https://github.com/apache/shardingsphere/issues/5657#issuecomment-629765254


   i run project in IDEA successfully


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu closed issue #5657: preciseAlgorithmClassName: java -jar project.jar error:Caused by: java.lang.ClassNotFoundException

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #5657:
URL: https://github.com/apache/shardingsphere/issues/5657


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ScavengerDD commented on issue #5657: preciseAlgorithmClassName: java -jar project.jar error:Caused by: java.lang.ClassNotFoundException

Posted by GitBox <gi...@apache.org>.
ScavengerDD commented on issue #5657:
URL: https://github.com/apache/shardingsphere/issues/5657#issuecomment-629942051


   its a spring boot project and i separate the dependent jar package from the application jar package...
   
   the precise-algorithm-class is in correct classpath...


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ScavengerDD edited a comment on issue #5657: preciseAlgorithmClassName: java -jar project.jar error:Caused by: java.lang.ClassNotFoundException

Posted by GitBox <gi...@apache.org>.
ScavengerDD edited a comment on issue #5657:
URL: https://github.com/apache/shardingsphere/issues/5657#issuecomment-629945093


   The reason for this problem is that 
   the dependent jar package is separated from the application jar package.
   
   its a bug? 
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu edited a comment on issue #5657: preciseAlgorithmClassName: java -jar project.jar error:Caused by: java.lang.ClassNotFoundException

Posted by GitBox <gi...@apache.org>.
terrymanu edited a comment on issue #5657:
URL: https://github.com/apache/shardingsphere/issues/5657#issuecomment-629817819


   Please make sure the class is in correct classpath of your runtime environment.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ScavengerDD commented on issue #5657: preciseAlgorithmClassName: java -jar project.jar error:Caused by: java.lang.ClassNotFoundException

Posted by GitBox <gi...@apache.org>.
ScavengerDD commented on issue #5657:
URL: https://github.com/apache/shardingsphere/issues/5657#issuecomment-629945277


   i use maven to package application.......


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ScavengerDD edited a comment on issue #5657: preciseAlgorithmClassName: java -jar project.jar error:Caused by: java.lang.ClassNotFoundException

Posted by GitBox <gi...@apache.org>.
ScavengerDD edited a comment on issue #5657:
URL: https://github.com/apache/shardingsphere/issues/5657#issuecomment-629945277






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ScavengerDD commented on issue #5657: preciseAlgorithmClassName: java -jar project.jar error:Caused by: java.lang.ClassNotFoundException

Posted by GitBox <gi...@apache.org>.
ScavengerDD commented on issue #5657:
URL: https://github.com/apache/shardingsphere/issues/5657#issuecomment-629945093


   
   The reason for this problem is that 
   the dependent jar package is separated from the application jar package.
   
   its a bug? !
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on issue #5657: preciseAlgorithmClassName: java -jar project.jar error:Caused by: java.lang.ClassNotFoundException

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #5657:
URL: https://github.com/apache/shardingsphere/issues/5657#issuecomment-641939354


   The travis can pass every time, so I think this is caused by your local environment.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on issue #5657: preciseAlgorithmClassName: java -jar project.jar error:Caused by: java.lang.ClassNotFoundException

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #5657:
URL: https://github.com/apache/shardingsphere/issues/5657#issuecomment-629817819


   Please make sure your class is in your classpath of your runtime environment.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org