Tomee error: javax.persistence.JoinColumn.foreignKey()
Tomee error: javax.persistence.JoinColumn.foreignKey()
我正在构建我的第一个网络应用程序。我使用 hibernate、postgresql 和 tomee 作为容器。我正在使用豆子和面孔。当我尝试 运行 在我的 tomee localhost 上我的 webapp 时,一切都按预期工作。当我将它加载到我的 AWS 上时(安装了相同版本的 tomee)我收到了这个错误。我坚持了几个小时没有得到解决方案。
这是我的 catalina.out
May 26, 2016 4:18:24 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
name: clinica-unit
...]
May 26, 2016 4:18:24 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.1.0.Final}
May 26, 2016 4:18:24 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
May 26, 2016 4:18:24 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
May 26, 2016 4:18:24 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
May 26, 2016 4:18:25 AM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL94Dialect
May 26, 2016 4:18:25 AM org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl useContextualLobCreation
INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
May 26, 2016 4:18:25 AM org.hibernate.type.BasicTypeRegistry register
INFO: HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType@66b53b0d
May 26, 2016 4:18:26 AM org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory createDelegate
INFO: PersistenceUnit(name=clinica-unit, provider=org.hibernate.ejb.HibernatePersistence) - provider time 1747ms
May 26, 2016 4:18:26 AM org.apache.openejb.assembler.classic.Assembler destroyApplication
INFO: Undeploying app: /usr/share/apache-tomee-webprofile-1.7.4/webapps/PortaleClinica
May 26, 2016 4:18:26 AM org.apache.catalina.core.ContainerBase removeChild
SEVERE: ContainerBase.removeChild: destroy:
org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_destroy]) for component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/PortaleClinica]] in state [STARTING_PREP]
at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:401)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:291)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1038)
at org.apache.tomee.catalina.TomcatWebAppBuilder.undeploy(TomcatWebAppBuilder.java:1537)
at org.apache.tomee.catalina.TomcatWebAppBuilder.undeploy(TomcatWebAppBuilder.java:1518)
at org.apache.tomee.catalina.TomcatWebAppBuilder.undeployWebApps(TomcatWebAppBuilder.java:762)
at org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:1982)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:839)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:677)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5472)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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)
May 26, 2016 4:18:26 AM org.apache.openejb.assembler.classic.Assembler destroyResource
INFO: Closing DataSource: PortaleClinica/clinica-unit-db
May 26, 2016 4:18:26 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
SEVERE: The web application [/PortaleClinica] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
May 26, 2016 4:18:26 AM org.apache.tomee.catalina.TomcatWebAppBuilder startInternal
SEVERE: Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[/PortaleClinica]
org.apache.openejb.OpenEJBException: Creating application failed: /usr/share/apache-tomee-webprofile-1.7.4/webapps/PortaleClinica: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:843)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:677)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5472)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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)
Caused by: java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.hibernate.cfg.AnnotationBinder.bindManyToOne(AnnotationBinder.java:2898)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1742)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:906)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:733)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:245)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.processEntityHierarchies(MetadataBuildingProcess.java:222)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:848)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:876)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:135)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:50)
at org.apache.openejb.assembler.classic.EntityManagerFactoryCallable.call(EntityManagerFactoryCallable.java:64)
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate(ReloadableEntityManagerFactory.java:116)
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.<init>(ReloadableEntityManagerFactory.java:102)
at org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:154)
at org.apache.openejb.assembler.classic.Assembler.loadPersistenceUnits(Assembler.java:982)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:741)
... 18 more
May 26, 2016 4:18:26 AM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/PortaleClinica]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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)
Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Creating application failed: /usr/share/apache-tomee-webprofile-1.7.4/webapps/PortaleClinica: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1270)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5472)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 10 more
Caused by: org.apache.openejb.OpenEJBException: Creating application failed: /usr/share/apache-tomee-webprofile-1.7.4/webapps/PortaleClinica: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:843)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:677)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261)
... 16 more
Caused by: java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.hibernate.cfg.AnnotationBinder.bindManyToOne(AnnotationBinder.java:2898)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1742)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:906)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:733)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:245)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.processEntityHierarchies(MetadataBuildingProcess.java:222)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:848)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:876)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:135)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:50)
at org.apache.openejb.assembler.classic.EntityManagerFactoryCallable.call(EntityManagerFactoryCallable.java:64)
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate(ReloadableEntityManagerFactory.java:116)
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.<init>(ReloadableEntityManagerFactory.java:102)
at org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:154)
at org.apache.openejb.assembler.classic.Assembler.loadPersistenceUnits(Assembler.java:982)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:741)
... 18 more
May 26, 2016 4:18:26 AM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying web application archive /usr/share/apache-tomee-webprofile-1.7.4/webapps/PortaleClinica.war
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/PortaleClinica]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:903)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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)
May 26, 2016 4:18:26 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /usr/share/apache-tomee-webprofile-1.7.4/webapps/PortaleClinica.war has finished in 3,950 ms
May 26, 2016 4:18:26 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/manager
May 26, 2016 4:18:26 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /manager
May 26, 2016 4:18:26 AM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: /usr/share/apache-tomee-webprofile-1.7.4/webapps/manager
May 26, 2016 4:18:26 AM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "/usr/share/apache-tomee-webprofile-1.7.4/webapps/manager" loaded.
May 26, 2016 4:18:26 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: /usr/share/apache-tomee-webprofile-1.7.4/webapps/manager
May 26, 2016 4:18:26 AM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@53743c4f
May 26, 2016 4:18:26 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
May 26, 2016 4:18:26 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
May 26, 2016 4:18:26 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
May 26, 2016 4:18:26 AM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
May 26, 2016 4:18:26 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 127 ms.
May 26, 2016 4:18:26 AM org.apache.tomee.catalina.TomcatWebAppBuilder deployWebApps
INFO: using context file /usr/share/apache-tomee-webprofile-1.7.4/webapps/manager/META-INF/context.xml
May 26, 2016 4:18:26 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=/usr/share/apache-tomee-webprofile-1.7.4/webapps/manager)
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/manager has finished in 706 ms
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/ROOT
May 26, 2016 4:18:27 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /
May 26, 2016 4:18:27 AM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: /usr/share/apache-tomee-webprofile-1.7.4/webapps/ROOT
May 26, 2016 4:18:27 AM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "/usr/share/apache-tomee-webprofile-1.7.4/webapps/ROOT" loaded.
May 26, 2016 4:18:27 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: /usr/share/apache-tomee-webprofile-1.7.4/webapps/ROOT
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@53743c4f
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
May 26, 2016 4:18:27 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
May 26, 2016 4:18:27 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
May 26, 2016 4:18:27 AM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 12 ms.
May 26, 2016 4:18:27 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=/usr/share/apache-tomee-webprofile-1.7.4/webapps/ROOT)
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/ROOT has finished in 127 ms
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/docs
May 26, 2016 4:18:27 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /docs
May 26, 2016 4:18:27 AM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: /usr/share/apache-tomee-webprofile-1.7.4/webapps/docs
May 26, 2016 4:18:27 AM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "/usr/share/apache-tomee-webprofile-1.7.4/webapps/docs" loaded.
May 26, 2016 4:18:27 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: /usr/share/apache-tomee-webprofile-1.7.4/webapps/docs
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@53743c4f
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
May 26, 2016 4:18:27 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
May 26, 2016 4:18:27 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
May 26, 2016 4:18:27 AM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 7 ms.
May 26, 2016 4:18:27 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=/usr/share/apache-tomee-webprofile-1.7.4/webapps/docs)
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/docs has finished in 125 ms
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager
May 26, 2016 4:18:27 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /host-manager
May 26, 2016 4:18:27 AM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: /usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager
May 26, 2016 4:18:27 AM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "/usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager" loaded.
May 26, 2016 4:18:27 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: /usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@53743c4f
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
May 26, 2016 4:18:27 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
May 26, 2016 4:18:27 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
May 26, 2016 4:18:27 AM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 8 ms.
May 26, 2016 4:18:27 AM org.apache.tomee.catalina.TomcatWebAppBuilder deployWebApps
INFO: using context file /usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager/META-INF/context.xml
May 26, 2016 4:18:27 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=/usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager)
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager has finished in 120 ms
May 26, 2016 4:18:27 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
May 26, 2016 4:18:27 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
May 26, 2016 4:18:27 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5129 ms
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>PortaleClinica</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<!-- Facelets pages will use the .xhtml extension -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<filter>
<filter-name>AuthFilter</filter-name> <!-- mandatory -->
<filter-class>it.uniroma3.servlet.AuthFilterServlet</filter-class> <!-- mandatory -->
</filter>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<filter-mapping>
<filter-name>AuthFilter</filter-name>
<url-pattern>/amministrazione/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>AuthFilter</filter-name>
<url-pattern>/utente/*</url-pattern>
</filter-mapping>
</web-app>
resources.xml
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<Resource id="clinica-unit-db" type="DataSource">
# PostgreSQL example
#
# This connector will not work until you download the driver at:
# http://jdbc.postgresql.org/download.html
JdbcDriver org.postgresql.Driver
JdbcUrl jdbc:postgresql://localhost/clinica
UserName postgres
Password postgres
</Resource>
</resources>
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="clinica-unit" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>clinica-unit-db</jta-data-source>
<class>it.uniroma3.db.Medico</class>
<class>it.uniroma3.db.Utente</class>
<class>it.uniroma3.db.TipologiaEsame</class>
<class>it.uniroma3.db.Esame</class>
</persistence-unit>
</persistence>
面孔-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
version="2.1">
</faces-config>
这个Java EE真烦我
关于营销语言:TomEE 6
执行 JavaEE 6
规范。 JavaEE 6
表示 JPA 2.0
。 JPA 2.0
表示没有 foreignKey
属性 的 @JoinColumn
注释。此 属性 已添加到 JPA 2.1.
说到人类语言:你在 class 路径中有一个 jar
和一个旧的 javax.persistence.JoinColumn
class。您的 Hibernate 版本需要一个新的 JPA 2.1
jar
:类似于 hibernate-jpa-2.1-api-1.0.0.Final.jar。
你已经可以拥有这个 jar
,但是 TomEE
可以使用它自己的 JPA 2.0
jar
覆盖其中的一些 classes示例:javaee-api-7.0.jar
与旧的 javax.persistence.JoinColumn
class。因此,您需要查找并删除(或更新)jar
,或者,您可以调整 TomEE
以使用单独的 classloader(或从 JPA
中排除 jar class路径)。
要查找不正确的 jar
,您可以在 servlet 中的某处使用此代码,或使用 ContextListener
.
URL url = Thread.currentThread().getContextClassLoader()
.getResource("javax/persistence/JoinColumn.class");
System.out.println(url);
最简单的解决方法是不使用 TomeEE
。您可以使用 Tomcat
或 Wildfly
.
更新
@Kevgretor 关于修复问题的评论
I followed your suggestion..but i found that tomcat dosen't support EJB so i had to go back to TomEE. I solved this problem by rearranging libraries inside tomee/lib and WEB-INF/lib (only hibernate-jpa-2.1-api-1.0.0.Final has to be inside tomee's library). Another weird fact was that if i clone my working local tomee folder on my server didn't worked (nullpointerexception for jsf initialization). I finally got it working by adding javax.faces-2.2.8.jar in WEB-INF/lib (tomee didn't like it in his lib folder).
您可以使用 tomee 7 或只升级 tomee/lib 中的 JPA API jar(需要在 conf/catalina 中的 tomee/lib/javaee-api 之前.properties#common.loader) 作为解决方法。
我正在构建我的第一个网络应用程序。我使用 hibernate、postgresql 和 tomee 作为容器。我正在使用豆子和面孔。当我尝试 运行 在我的 tomee localhost 上我的 webapp 时,一切都按预期工作。当我将它加载到我的 AWS 上时(安装了相同版本的 tomee)我收到了这个错误。我坚持了几个小时没有得到解决方案。 这是我的 catalina.out
May 26, 2016 4:18:24 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
name: clinica-unit
...]
May 26, 2016 4:18:24 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.1.0.Final}
May 26, 2016 4:18:24 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
May 26, 2016 4:18:24 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
May 26, 2016 4:18:24 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
May 26, 2016 4:18:25 AM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL94Dialect
May 26, 2016 4:18:25 AM org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl useContextualLobCreation
INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
May 26, 2016 4:18:25 AM org.hibernate.type.BasicTypeRegistry register
INFO: HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType@66b53b0d
May 26, 2016 4:18:26 AM org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory createDelegate
INFO: PersistenceUnit(name=clinica-unit, provider=org.hibernate.ejb.HibernatePersistence) - provider time 1747ms
May 26, 2016 4:18:26 AM org.apache.openejb.assembler.classic.Assembler destroyApplication
INFO: Undeploying app: /usr/share/apache-tomee-webprofile-1.7.4/webapps/PortaleClinica
May 26, 2016 4:18:26 AM org.apache.catalina.core.ContainerBase removeChild
SEVERE: ContainerBase.removeChild: destroy:
org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_destroy]) for component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/PortaleClinica]] in state [STARTING_PREP]
at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:401)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:291)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1038)
at org.apache.tomee.catalina.TomcatWebAppBuilder.undeploy(TomcatWebAppBuilder.java:1537)
at org.apache.tomee.catalina.TomcatWebAppBuilder.undeploy(TomcatWebAppBuilder.java:1518)
at org.apache.tomee.catalina.TomcatWebAppBuilder.undeployWebApps(TomcatWebAppBuilder.java:762)
at org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:1982)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:839)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:677)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5472)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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)
May 26, 2016 4:18:26 AM org.apache.openejb.assembler.classic.Assembler destroyResource
INFO: Closing DataSource: PortaleClinica/clinica-unit-db
May 26, 2016 4:18:26 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
SEVERE: The web application [/PortaleClinica] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
May 26, 2016 4:18:26 AM org.apache.tomee.catalina.TomcatWebAppBuilder startInternal
SEVERE: Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[/PortaleClinica]
org.apache.openejb.OpenEJBException: Creating application failed: /usr/share/apache-tomee-webprofile-1.7.4/webapps/PortaleClinica: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:843)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:677)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5472)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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)
Caused by: java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.hibernate.cfg.AnnotationBinder.bindManyToOne(AnnotationBinder.java:2898)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1742)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:906)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:733)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:245)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.processEntityHierarchies(MetadataBuildingProcess.java:222)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:848)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:876)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:135)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:50)
at org.apache.openejb.assembler.classic.EntityManagerFactoryCallable.call(EntityManagerFactoryCallable.java:64)
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate(ReloadableEntityManagerFactory.java:116)
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.<init>(ReloadableEntityManagerFactory.java:102)
at org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:154)
at org.apache.openejb.assembler.classic.Assembler.loadPersistenceUnits(Assembler.java:982)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:741)
... 18 more
May 26, 2016 4:18:26 AM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/PortaleClinica]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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)
Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Creating application failed: /usr/share/apache-tomee-webprofile-1.7.4/webapps/PortaleClinica: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1270)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5472)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 10 more
Caused by: org.apache.openejb.OpenEJBException: Creating application failed: /usr/share/apache-tomee-webprofile-1.7.4/webapps/PortaleClinica: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:843)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:677)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261)
... 16 more
Caused by: java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.hibernate.cfg.AnnotationBinder.bindManyToOne(AnnotationBinder.java:2898)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1742)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:906)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:733)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:245)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.processEntityHierarchies(MetadataBuildingProcess.java:222)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:848)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:876)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:135)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:50)
at org.apache.openejb.assembler.classic.EntityManagerFactoryCallable.call(EntityManagerFactoryCallable.java:64)
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate(ReloadableEntityManagerFactory.java:116)
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.<init>(ReloadableEntityManagerFactory.java:102)
at org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:154)
at org.apache.openejb.assembler.classic.Assembler.loadPersistenceUnits(Assembler.java:982)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:741)
... 18 more
May 26, 2016 4:18:26 AM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying web application archive /usr/share/apache-tomee-webprofile-1.7.4/webapps/PortaleClinica.war
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/PortaleClinica]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:903)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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)
May 26, 2016 4:18:26 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /usr/share/apache-tomee-webprofile-1.7.4/webapps/PortaleClinica.war has finished in 3,950 ms
May 26, 2016 4:18:26 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/manager
May 26, 2016 4:18:26 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /manager
May 26, 2016 4:18:26 AM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: /usr/share/apache-tomee-webprofile-1.7.4/webapps/manager
May 26, 2016 4:18:26 AM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "/usr/share/apache-tomee-webprofile-1.7.4/webapps/manager" loaded.
May 26, 2016 4:18:26 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: /usr/share/apache-tomee-webprofile-1.7.4/webapps/manager
May 26, 2016 4:18:26 AM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@53743c4f
May 26, 2016 4:18:26 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
May 26, 2016 4:18:26 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
May 26, 2016 4:18:26 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
May 26, 2016 4:18:26 AM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
May 26, 2016 4:18:26 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 127 ms.
May 26, 2016 4:18:26 AM org.apache.tomee.catalina.TomcatWebAppBuilder deployWebApps
INFO: using context file /usr/share/apache-tomee-webprofile-1.7.4/webapps/manager/META-INF/context.xml
May 26, 2016 4:18:26 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=/usr/share/apache-tomee-webprofile-1.7.4/webapps/manager)
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/manager has finished in 706 ms
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/ROOT
May 26, 2016 4:18:27 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /
May 26, 2016 4:18:27 AM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: /usr/share/apache-tomee-webprofile-1.7.4/webapps/ROOT
May 26, 2016 4:18:27 AM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "/usr/share/apache-tomee-webprofile-1.7.4/webapps/ROOT" loaded.
May 26, 2016 4:18:27 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: /usr/share/apache-tomee-webprofile-1.7.4/webapps/ROOT
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@53743c4f
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
May 26, 2016 4:18:27 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
May 26, 2016 4:18:27 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
May 26, 2016 4:18:27 AM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 12 ms.
May 26, 2016 4:18:27 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=/usr/share/apache-tomee-webprofile-1.7.4/webapps/ROOT)
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/ROOT has finished in 127 ms
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/docs
May 26, 2016 4:18:27 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /docs
May 26, 2016 4:18:27 AM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: /usr/share/apache-tomee-webprofile-1.7.4/webapps/docs
May 26, 2016 4:18:27 AM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "/usr/share/apache-tomee-webprofile-1.7.4/webapps/docs" loaded.
May 26, 2016 4:18:27 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: /usr/share/apache-tomee-webprofile-1.7.4/webapps/docs
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@53743c4f
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
May 26, 2016 4:18:27 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
May 26, 2016 4:18:27 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
May 26, 2016 4:18:27 AM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 7 ms.
May 26, 2016 4:18:27 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=/usr/share/apache-tomee-webprofile-1.7.4/webapps/docs)
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/docs has finished in 125 ms
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager
May 26, 2016 4:18:27 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /host-manager
May 26, 2016 4:18:27 AM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: /usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager
May 26, 2016 4:18:27 AM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "/usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager" loaded.
May 26, 2016 4:18:27 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: /usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@53743c4f
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
May 26, 2016 4:18:27 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
May 26, 2016 4:18:27 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
May 26, 2016 4:18:27 AM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
May 26, 2016 4:18:27 AM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 8 ms.
May 26, 2016 4:18:27 AM org.apache.tomee.catalina.TomcatWebAppBuilder deployWebApps
INFO: using context file /usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager/META-INF/context.xml
May 26, 2016 4:18:27 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=/usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager)
May 26, 2016 4:18:27 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/share/apache-tomee-webprofile-1.7.4/webapps/host-manager has finished in 120 ms
May 26, 2016 4:18:27 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
May 26, 2016 4:18:27 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
May 26, 2016 4:18:27 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5129 ms
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>PortaleClinica</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<!-- Facelets pages will use the .xhtml extension -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<filter>
<filter-name>AuthFilter</filter-name> <!-- mandatory -->
<filter-class>it.uniroma3.servlet.AuthFilterServlet</filter-class> <!-- mandatory -->
</filter>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<filter-mapping>
<filter-name>AuthFilter</filter-name>
<url-pattern>/amministrazione/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>AuthFilter</filter-name>
<url-pattern>/utente/*</url-pattern>
</filter-mapping>
</web-app>
resources.xml
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<Resource id="clinica-unit-db" type="DataSource">
# PostgreSQL example
#
# This connector will not work until you download the driver at:
# http://jdbc.postgresql.org/download.html
JdbcDriver org.postgresql.Driver
JdbcUrl jdbc:postgresql://localhost/clinica
UserName postgres
Password postgres
</Resource>
</resources>
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="clinica-unit" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>clinica-unit-db</jta-data-source>
<class>it.uniroma3.db.Medico</class>
<class>it.uniroma3.db.Utente</class>
<class>it.uniroma3.db.TipologiaEsame</class>
<class>it.uniroma3.db.Esame</class>
</persistence-unit>
</persistence>
面孔-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
version="2.1">
</faces-config>
这个Java EE真烦我
关于营销语言:TomEE 6
执行 JavaEE 6
规范。 JavaEE 6
表示 JPA 2.0
。 JPA 2.0
表示没有 foreignKey
属性 的 @JoinColumn
注释。此 属性 已添加到 JPA 2.1.
说到人类语言:你在 class 路径中有一个 jar
和一个旧的 javax.persistence.JoinColumn
class。您的 Hibernate 版本需要一个新的 JPA 2.1
jar
:类似于 hibernate-jpa-2.1-api-1.0.0.Final.jar。
你已经可以拥有这个 jar
,但是 TomEE
可以使用它自己的 JPA 2.0
jar
覆盖其中的一些 classes示例:javaee-api-7.0.jar
与旧的 javax.persistence.JoinColumn
class。因此,您需要查找并删除(或更新)jar
,或者,您可以调整 TomEE
以使用单独的 classloader(或从 JPA
中排除 jar class路径)。
要查找不正确的 jar
,您可以在 servlet 中的某处使用此代码,或使用 ContextListener
.
URL url = Thread.currentThread().getContextClassLoader()
.getResource("javax/persistence/JoinColumn.class");
System.out.println(url);
最简单的解决方法是不使用 TomeEE
。您可以使用 Tomcat
或 Wildfly
.
更新
@Kevgretor 关于修复问题的评论
I followed your suggestion..but i found that tomcat dosen't support EJB so i had to go back to TomEE. I solved this problem by rearranging libraries inside tomee/lib and WEB-INF/lib (only hibernate-jpa-2.1-api-1.0.0.Final has to be inside tomee's library). Another weird fact was that if i clone my working local tomee folder on my server didn't worked (nullpointerexception for jsf initialization). I finally got it working by adding javax.faces-2.2.8.jar in WEB-INF/lib (tomee didn't like it in his lib folder).
您可以使用 tomee 7 或只升级 tomee/lib 中的 JPA API jar(需要在 conf/catalina 中的 tomee/lib/javaee-api 之前.properties#common.loader) 作为解决方法。