如何修复 javax.persistence.Table.indexes()[Ljavax

我正在用 JSF 开发一个应用程序。错误是:


Caused by: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;

    at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:1087)

    at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:767)

    at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:245)

    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:222)

    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)

    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)

    at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)

    at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)

    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:692)

    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)

    at w7h5.h8.sf.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:26)

    at w7h5.h8.transaction.TransactionalModule.invoke(TransactionalModule.java:29)

    at abrain.web.common.bean.EditorView.test_post(EditorView.java:112)

    at abrain.web.common.bean.EditorView.setText(EditorView.java:63)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke(Method.java:498)

    at javax.el.BeanELResolver.setValue(BeanELResolver.java:122)

    ... 43 more


    }

我已经尝试创建一个 java 类测试,以防止 Tomcat(8.5 版)失败,并且一切正常,所以当我在服务器上运行应用程序时会出现问题。


芜湖不芜
浏览 129回答 1
1回答

德玛西亚99

第一张图是来自的接口Table的源码javax.persistence.jar。如您所见,没有方法indexes()。第二张图是来自的接口Table的源码jpa-2.1.jar。并且存在方法indexes()。在我看来,可能是你的类路径中有两个罐子,这会造成冲突。当您调用时,javax.persistence.Table我们不知道它是来自 javax.persistence.jar 还是 jpa-2.1.jar 的接口。查看您的类路径并删除 javaxpersistence.jar,然后重试。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java