我在 netbeans 中创建了一个 java 应用程序,它读取 csv 文件并使用休眠 ORM 将数据插入 SQL DB。当我从 IDE 运行应用程序时,Java 应用程序运行良好并将记录插入数据库。但是如果我将项目编译成 JAR 文件并在命令提示符下运行它,那么我会收到以下错误。非常感谢任何帮助,因为我是 Java 新手,所以我无法弄清楚是什么导致了这个问题。
这是会话的代码
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
这是我从命令提示符运行时遇到的异常
Exception in thread "main" net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:127)
at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:295)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at com.genreproj.uploadpermission.RepPermissionUpload.ReadPermissionFile(RepPermissionUpload.java:108)
at com.genreproj.uploadpermission.RepPermissionUpload.ProcessPermissionFile(RepPermissionUpload.java:72)
at com.genreproj.processalluploads.ProcessAllUploads.main(ProcessAllUploads.java:52)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
... 17 more
Caused by: java.lang.SecurityException: class "com.genreproj.entity.SalesHistory$$EnhancerByCGLIB$$11666a3b"'s signer information does not match signer information
of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:943)
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:657)
at java.lang.ClassLoader.defineClass(ClassLoader.java:785)
... 23 more