Как использовать EJB с гибернацией на платформе WebLogic Server ADF
Мы используем Jdeveloper 11.1.1.4 и WLS 10.3 я пытался использовать режим гибернации на мой проект по этой ссылке Ну, https://forums.oracle.com/forums/thread.jspa?threadID=1063416 я хочу использовать Hibernate инструмент, потому что toplink и eclipselink не может добиться вопроса о создании обновления DDL на схеме, они могут только заново создать таблицы -не реальное обновление.
Во-первых, я получил соответствующие банки из интернета: http://www.2hotfile.com/di-LSBU.png
cglib-2.2
antlr-2.7.6
commons-collections-3.1
dom4j-1.6.1
hibernate3
hibernate-validator-4.1.0.Final
javassist-3.9.0.GA
jta-1.1
slf4j-api-1.5.11
slf4j-nop-1.5.11
Затем я добавил в проект модели в качестве зависимостей библиотеки: http://www.2hotfile.com/di-GMSZ.png
Настроенная персистентность.xml, как показано ниже:
<?xml version="1.0" encoding="windows-1252" ?>
<persistence 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"
version="1.0">
<persistence-unit name="VakkoEJBModel" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/VakkoDS</jta-data-source>
<properties>
<property name="hibernate.jndi.url" value="t3://127.0.0.1:7001" />
<property name="hibernate.connection.datasource" value="jdbc/VakkoDS" />
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.current_session_context_class" value="jta" />
</properties>
</persistence-unit>
</persistence>
Конфигурированию приложений.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<weblogic-application>
<prefer-application-packages>
<package-name>antlr.*</package-name>
<package-name>org.hibernate.*</package-name>
<!-- package-name>org.apache.commons.logging.*</package-name -->
<!-- package-name>org.w3c.dom.*</package-name -->
</prefer-application-packages>
</weblogic-application>
weblogic-ejb-jar.xml
<?xml version = '1.0' encoding = 'UTF-8'?>
<weblogic-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-ejb-jar http://www.bea.com/ns/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd"
xmlns="http://www.bea.com/ns/weblogic/weblogic-ejb-jar">
Weblogic-ejb-jar.xml
</weblogic-ejb-jar>
ejb-jar.xml
<?xml version="1.0" encoding="windows-1252" ?>
<ejb-jar/>
И я добавил к setDomainEnv.cmd эта строка:
set EXT_PRE_CLASSPATH=C:jarlarhibernate-3.3.2antlr-2.7.6.jar;C:jarlarhibernate-3.3.2commons-collections-3.1.jar;C:jarlarhibernate-3.3.2dom4j-1.6.1.jar;C:jarlarhibernate-3.3.2hibernate3.jar;C:jarlarhibernate-3.3.2javassist-3.9.0.GA.jar;C:jarlarhibernate-3.3.2jta-1.1.jar;C:jarlarhibernate-3.3.2slf4j-api-1.5.11.jar;C:jarlarhibernate-3.3.2slf4j-nop-1.5.11.jar;C:jarlarhibernate-3.3.2bytecodecglibcglib-2.2.jar;C:OracleMiddleware_11.1.1.4modulesejb3-persistence-3.3.1.jar;hibernate-validator-4.1.0.Final.jar;
Профиль развертывания можно просмотреть, перейдя по следующим ссылкам: http://www.2hotfile.com/di-XV68.png http://www.2hotfile.com/di-8YC9.png http://www.2hotfile.com/di-ADR4.png
И я попытался манипулировать содержимым файла ear в соответствии с этими сведениями: http://middlewaremagic.com/weblogic/wp-content/uploads/2010/06/EAR_Application_Diagram.jpg
Под earMETA-INFapplication.xml
<?xml version = '1.0' encoding = 'windows-1252'?>
<application 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/application_5.xsd" version="5" xmlns="http://java.sun.com/xml/ns/javaee">
<display-name>ejb1</display-name>
<module>
<ejb>ejb1.jar</ejb>
</module>
</application>
Under earMETA-INFweblogic-приложение.xml
<?xml version = '1.0' encoding = 'windows-1254'?>
<weblogic-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-application http://www.bea.com/ns/weblogic/weblogic-application/1.0/weblogic-application.xsd" xmlns="http://www.bea.com/ns/weblogic/weblogic-application">
<prefer-application-packages>
<package-name>org.hibernate.*</package-name>
<package-name>antlr.*</package-name>
<!-- package-name>org.apache.commons.logging.*</package-name -->
<!-- package-name>org.w3c.dom.*</package-name -->
</prefer-application-packages>
<listener>
<listener-class>oracle.adf.share.weblogic.listeners.ADFApplicationLifecycleListener</listener-class>
</listener>
<listener>
<listener-class>oracle.mds.lcm.weblogic.WLLifecycleListener</listener-class>
</listener>
<library-ref>
<library-name>adf.oracle.domain</library-name>
</library-ref>
</weblogic-application>
Файлы, которые существовали в ejb1.ухоejb1.jarMETA-INF каталог то же самое с исходная папка проекта модели (они были созданы процессом развертывания jdeveloper в соответствии с профилем развертывания, который ранее был описан)
Содержимое уха показано по ссылке: http://www.2hotfile.com/di-23X6.png
При развертывании проекта в weblogic с помощью метода JDeveloper или weblogic/console/ in browser. Но произошло исключение
<10-Dec-2012 16:31:54 o'clock EET> <Warning> <netuix> <BEA-423420> <Redirect is executed in begin or refresh action. Redirect url is /console/console.portal?_nfpb=true&_pageLabel=AppDeploymentsControlPage.>
<10-Dec-2012 16:32:45 o'clock EET> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1355149965087' for task '2'. Error is: 'weblogic.application.ModuleException: Exception preparing module: EJBModule(ejb1.jar)
'
weblogic.application.ModuleException: Exception preparing module: EJBModule(ejb1.jar)
at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:469)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)
Truncated. see log file for complete stacktrace
Caused By: weblogic.deployment.EnvironmentException: Error processing persistence unit VakkoEJBModel of module ejb1.jar: Error instantiating the Persistence Provider class org.hibernate.ejb.HibernatePersistence of the PersistenceUnit VakkoEJBModel: java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence
at weblogic.deployment.BasePersistenceUnitInfoImpl.getPersistenceProvider(BasePersistenceUnitInfoImpl.java:375)
at weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:393)
at weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:386)
at weblogic.deployment.BasePersistenceUnitInfoImpl.<init>(BasePersistenceUnitInfoImpl.java:158)
at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:39)
Truncated. see log file for complete stacktrace
<10-Dec-2012 16:32:45 o'clock EET> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'ejb1'.>
<10-Dec-2012 16:32:45 o'clock EET> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: Exception preparing module: EJBModule(ejb1.jar)
at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:469)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)
Truncated. see log file for complete stacktrace
Caused By: weblogic.deployment.EnvironmentException: Error processing persistence unit VakkoEJBModel of module ejb1.jar: Error instantiating the Persistence Provider class org.hibernate.ejb.HibernatePersistence of the PersistenceUnit VakkoEJBModel: java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence
at weblogic.deployment.BasePersistenceUnitInfoImpl.getPersistenceProvider(BasePersistenceUnitInfoImpl.java:375)
at weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:393)
at weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:386)
at weblogic.deployment.BasePersistenceUnitInfoImpl.<init>(BasePersistenceUnitInfoImpl.java:158)
at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:39)
Truncated. see log file for complete stacktrace
<10-Dec-2012 16:32:45 o'clock EET> <Error> <Console> <BEA-240003> <Console encountered the following error weblogic.application.ModuleException: Exception preparing module: EJBModule(ejb1.jar)
at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:469)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:45)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:613)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:184)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:58)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
Caused by: weblogic.deployment.EnvironmentException: Error processing persistence unit VakkoEJBModel of module ejb1.jar: Error instantiating the Persistence Provider class org.hibernate.ejb.HibernatePersistence of the PersistenceUnit VakkoEJBModel: java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence
at weblogic.deployment.BasePersistenceUnitInfoImpl.getPersistenceProvider(BasePersistenceUnitInfoImpl.java:375)
at weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:393)
at weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:386)
at weblogic.deployment.BasePersistenceUnitInfoImpl.<init>(BasePersistenceUnitInfoImpl.java:158)
at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:39)
at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:349)
at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDescriptor(AbstractPersistenceUnitRegistry.java:263)
at weblogic.deployment.ModulePersistenceUnitRegistry.<init>(ModulePersistenceUnitRegistry.java:69)
at weblogic.ejb.container.deployer.EJBModule.setupPersistenceUnitRegistry(EJBModule.java:223)
at weblogic.ejb.container.deployer.EJBModule$1.execute(EJBModule.java:324)
at weblogic.deployment.PersistenceUnitRegistryInitializer.setupPersistenceUnitRegistries(PersistenceUnitRegistryInitializer.java:62)
at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:393)
Каковы мои ошибки или неполадки? Пожалуйста, помогите мне и простите мой плохой английский. Заранее спасибо
1 ответ:
Я делал конфигурации в соответствии с этими: - http://middlewaremagic.com/weblogic/?p=5861 - http://middlewaremagic.com/weblogic/?p=6725 - http://middlewaremagic.com/weblogic/?p=7478
Это работает см. также https://forums.oracle.com/forums/message.jspa?messageID=10741984#10741984