我在SpringBoot中使用AJSC框架和JaxB实现。我在项目外构建了存根,并将它们复制到项目内的适当目录中。
然而,在API执行期间,我得到了一个classNotDef错误。但是我已经看到了我的Jar文件,并且在目录中有package-info类文件。
Caused by: java.lang.NoClassDefFoundError: BOOT-INF/classes/com/att/fpp/fpprome/opportunity/package-info (wrong name: com/att/fpp/fpprome/opportunity/package-info)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.annotations.common.util.StandardClassLoaderDelegateImpl.classForName(StandardClassLoaderDelegateImpl.java:57)
at org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl$4.classForName(MetadataBuilderImpl.java:758)
at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.packageForName(JavaReflectionManager.java:148)
at org.hibernate.cfg.AnnotationBinder.bindPackage(AnnotationBinder.java:281)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.prepare(AnnotationMetadataSourceProcessorImpl.java:186)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.prepare(MetadataBuildingProcess.java:156)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:253)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:847)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:874)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at acsi.grid.gridcore.core.sql.EntityManagerHelper.getDefaultEntityManager(EntityManagerHelper.java:250)
at acsi.grid.gridcore.core.sql.EntityManagerHelper.getEntityManager(EntityManagerHelper.java:174)
at acsi.grid.gridcore.core.JdbcGridBagImpl.getEntityManager(JdbcGridBagImpl.java:188)
at acsi.grid.gridcore.core.JdbcGridBagImpl.put(JdbcGridBagImpl.java:163)
at com.att.fpp.fpprome.dao.impl.OpportunityDaoImpl.updateOpportunityDatabaseROME(OpportunityDaoImpl.java:497)
at com.att.fpp.fpprome.bo.impl.OpportunityBusinessObjectImpl.getOpptyInfo(OpportunityBusinessObjectImpl.java:78)
at com.att.fpp.fpprome.service.impl.OpportunityServiceImpl.getOpportunitiesById(OpportunityServiceImpl.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
另外,我注意到我没有在pom中的任何地方使用apache.cxf,但在这里却被调用了。
3条答案
按热度按时间hsvhsicv1#
NoClassDefFoundError
的一个可能的解决方案源于package-info
类:Sping Boot ,runnable jar无法加载package-info.classqpgpyjmq2#
发现问题。AJSC框架实现ADF(基于Hibernate的ORM)不支持package-info,因此每次都搜索该类。
唯一的方法是在生成存根的过程中执行命令不生成package-info。
在XJC实用程序中使用
-npa
来抑制package-info,一切都会正常。rwqw0loc3#
如果你在这里寻找一个类似的“包信息(错误的名称:”问题的解决方案,我通过升级hibernate解决了我的问题(因为应用程序中的那个很旧)。