私はJPAとEJBの初心者です。JPAアプリとEJBアプリを別々に試し、問題なく動作しました。しかし、それらを一緒に使用しているときにエラーが発生しました。
これは、EclipseIDEでEJB3(JBoss 7 ASサーバー)でJPAを使用しているときに発生したエラー(ログ)です。
誰かが私がそれを修正するのを手伝ってくれる?
11:43:43,735 INFO [org.jboss.as.jpa] (MSC service thread 1-14) JBAS011402: Starting Persistence Unit Service 'SampleEAR.ear#Student'
11:43:43,781 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.subunit."SampleEAR.ear"."SampleEJB.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."SampleEAR.ear"."SampleEJB.jar".INSTALL: Failed to process phase INSTALL of subdeployment "SampleEJB.jar" of deployment "SampleEAR.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_09]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_09]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_09]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011047: Component class ejb.MyBean for component MyBean has errors:
JBAS011428: Cannot inject RESOURCE_LOCAL container managed EntityManagers using @PersistenceContext
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:169)
at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:162)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:155)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
11:43:43,816 INFO [org.hibernate.annotations.common.Version] (MSC service thread 1-14) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
11:43:43,820 INFO [org.hibernate.Version] (MSC service thread 1-14) HHH000412: Hibernate Core {4.0.1.Final}
11:43:43,821 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-14) HHH000206: hibernate.properties not found
11:43:43,822 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-14) HHH000021: Bytecode provider name : javassist
11:43:43,835 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-14) HHH000204: Processing PersistenceUnitInfo [
name: Student
...]
11:43:43,837 INFO [org.jboss.web] (MSC service thread 1-13) JBAS018210: Registering web context: /SampleWAR
11:43:43,924 INFO [org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (MSC service thread 1-14) HHH000402: Using Hibernate built-in connection pool (not for production use!)
11:43:43,925 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-14) MSC00001: Failed to start service jboss.persistenceunit."SampleEAR.ear#Student": org.jboss.msc.service.StartException in service jboss.persistenceunit."SampleEAR.ear#Student": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_09]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_09]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_09]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: Student] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
... 3 more
Caused by: org.hibernate.HibernateException: Specified JDBC Driver com.microsoft.sqlserver.jdbc.SQLServerDriver class not found
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:104)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:234)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:91)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2270)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2266)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1735)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
... 9 more
Caused by: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver from [Module "org.hibernate:main" from local module loader @16e3ecd (roots: C:\jboss-as-7.1.1.Final\modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_09]
at java.lang.Class.forName(Unknown Source) [rt.jar:1.7.0_09]
at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:192)
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:101)
... 23 more
11:43:44,141 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "SampleEAR.ear" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.subunit.\"SampleEAR.ear\".\"SampleEJB.jar\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"SampleEAR.ear\".\"SampleEJB.jar\".INSTALL: Failed to process phase INSTALL of subdeployment \"SampleEJB.jar\" of deployment \"SampleEAR.ear\"","jboss.persistenceunit.\"SampleEAR.ear#Student\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"SampleEAR.ear#Student\": Failed to start service"},"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean.ValidatorFactoryjboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBeanMissing[jboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean.ValidatorFactoryjboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean]","jboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean.Validatorjboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBeanMissing[jboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean.Validatorjboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean]"]}
11:43:44,166 INFO [org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (Finalizer) HHH000030: Cleaning up connection pool [null]
11:43:44,168 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015877: Stopped deployment SampleEJB.jar in 27ms
11:43:44,168 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment SampleWAR.war in 27ms
11:43:44,171 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment SampleEAR.ear in 31ms
11:43:44,172 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean (missing) dependents: [service jboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean.ValidatorFactory, service jboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean.Validator]
JBAS014777: Services which failed to start: service jboss.deployment.subunit."SampleEAR.ear"."SampleEJB.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."SampleEAR.ear"."SampleEJB.jar".INSTALL: Failed to process phase INSTALL of subdeployment "SampleEJB.jar" of deployment "SampleEAR.ear"
service jboss.persistenceunit."SampleEAR.ear#Student": org.jboss.msc.service.StartException in service jboss.persistenceunit."SampleEAR.ear#Student": Failed to start service
11:43:44,175 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.subunit.\"SampleEAR.ear\".\"SampleEJB.jar\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"SampleEAR.ear\".\"SampleEJB.jar\".INSTALL: Failed to process phase INSTALL of subdeployment \"SampleEJB.jar\" of deployment \"SampleEAR.ear\"","jboss.persistenceunit.\"SampleEAR.ear#Student\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"SampleEAR.ear#Student\": Failed to start service"},"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean.ValidatorFactoryjboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBeanMissing[jboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean.ValidatorFactoryjboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean]","jboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean.Validatorjboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBeanMissing[jboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean.Validatorjboss.naming.context.java.comp.SampleEAR.SampleEJB.MyBean]"]}}}