2 Replies Latest reply on Jan 9, 2014 11:21 AM by kpagan

    Openjpa on JBoss EAP 6.1.0 with AS 7.2.0

    dsant10

      Hi,

       

      We are having difficulty with openjpa on Jboss As 7.2.0. I hav ecompleted following steps..

       

      Created openjpa module on server

      Added property in persistence.xml

      Added adapter Property in persistence.xml

       

      But i am still getting following Exception, could some on ehelp me on this...

       

      ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."ccltblog.war".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."ccltblog.war".FIRST_MODULE_USE: JBAS018733: Failed to process phase FIRST_MODULE_USE of deployment "ccltblog.war"

                at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]

                at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011445: Failed to get adapter for persistence provider 'org.apache.openjpa.persistence.PersistenceProviderImpl'

                at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.getPersistenceProviderAdaptor(PersistenceUnitServiceHandler.java:502)

                at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deployPersistenceUnit(PersistenceUnitServiceHandler.java:293)

                at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addPuService(PersistenceUnitServiceHandler.java:273)

                at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.handleWarDeployment(PersistenceUnitServiceHandler.java:188)

                at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:114)

                at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:48)

                at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

       

       

      My files..

       

      <?xml version="1.0" encoding="UTF-8"?>

      <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="2.0">

       

       

      <persistence-unit name="Something" transaction-type="RESOURCE_LOCAL">

       

                <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>

          

                <properties>       

       

                          <property name="openjpa.Log" value="DefaultLevel=TRACE" />

       

                          <property name="jboss.as.jpa.providerModule" value="org.apache.openjpa" />

                          <property name="jboss.as.jpa.adapterModule" value="org.jboss.as.jpa.openjpa" />

                          <property name="jboss.as.jpa.adapterClass" value="org.jboss.as.jpa.openjpa.OpenJPAPersistenceProviderAdaptor" />

       

                          <property name="openjpa.DynamicEnhancementAgent" value="false"/>

                          <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />

       

                          <property name="openjpa.TransactionMode" value="managed"/>

                          <property name="openjpa.ManagedRuntime" value="jndi(TransactionManagerName=java:/TransactionManager)"/>

       

                          <property name="openjpa.jdbc.DBDictionary" value="oracle" />

                          <property name="showSql" value="true" />

                          <property name="database" value="oracle" />

       

                </properties>

       

      </persistence-unit>

      </persistence>

       

       

      and

       

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-deployment-structure>

                <deployment>

                    <dependencies>      

                                <module name="oracle.jdbc" />  

                                <module name="org.apache.openjpa" />

                    </dependencies>

                    <exclusions>   

                       <module name="org.slf4j" />

                  <module name="org.slf4j.impl" />

                  <module name="org.apache.velocity" />

                  <module name="org.apache.commons" />

                  <module name="javax.servlet.api" />  

                  <module name="org.jboss.as.webservices" />   

                  <module name="org.jboss.as.webservices.server" />           

                  <module name="org.jboss.as.server" />     

                  <module name="org.apache.cxf" />            

              </exclusions>

        </deployment>

      </jboss-deployment-structure>

       

       

      Thanks,

        • 1. Re: Openjpa on JBoss EAP 6.1.0 with AS 7.2.0
          dblocks

          Hi

          There are indeed some issues with getting OpenJPA2 working on JBoss EAP 6.1.

          In persistence.xml you do not need to specify the jboss.as.jpa.providerModule, jboss.as.jpa.adapterModule and jboss.as.jpa.adapterClass anymore.

          According to JPA Reference Guide - JBoss AS 7.2 - Project Documentation Editor the module is automatically detected based on the provider class from the persistence.xml.

           

          Your error message "Failed to get adapter for persistence provider 'org.apache.openjpa.persistence.PersistenceProviderImpl'" indicates that JBoss doesn't find the adapter. The OpenJPA adapter module is named org.jboss.as.jpa.openjpa.

          This module is included in JBoss AS 7.1, but vanished in JBoss EAP 6.1. However according to the documentation https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6.1/html-single/Development_Gui… this module should be included.

           

          I therefore created this module using the module.xml from JBoss AS 7.1, but updated the  resource-root to refer to the 7.2 jar instead of the 7.1 jar. You can find the 7.2 jar file here: http://mvnrepository.com/artifact/org.jboss.as/jboss-as-jpa-openjpa/7.2.0.Final

          <?xml version="1.0" encoding="UTF-8"?>
          
          
          <!--
            ~ JBoss, Home of Professional Open Source.
            ~ Copyright 2010, Red Hat, Inc., and individual contributors
            ~ as indicated by the @author tags. See the copyright.txt file in the
            ~ distribution for a full listing of individual contributors.
            ~
            ~ This is free software; you can redistribute it and/or modify it
            ~ under the terms of the GNU Lesser General Public License as
            ~ published by the Free Software Foundation; either version 2.1 of
            ~ the License, or (at your option) any later version.
            ~
            ~ This software is distributed in the hope that it will be useful,
            ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
            ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
            ~ Lesser General Public License for more details.
            ~
            ~ You should have received a copy of the GNU Lesser General Public
            ~ License along with this software; if not, write to the Free
            ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
            ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
            -->
          
          
          <!-- contains the JPA integration classes for OpenJPA 2.x --> 
          <module xmlns="urn:jboss:module:1.1" name="org.jboss.as.jpa.openjpa">
              <properties>
                  <property name="jboss.api" value="private"/>
              </properties>
          
          
              <resources>
                  <resource-root path="jboss-as-jpa-openjpa-7.2.0.Final.jar"/>
                  <!-- Insert resources here -->
              </resources>
          
          
              <dependencies>
                  <module name="javax.annotation.api"/>
                  <module name="javax.persistence.api"/>
                  <module name="javax.transaction.api"/>
          
          
                  <module name="org.jboss.as.jpa.spi"/>
                  <module name="org.jboss.logging"/>
                  <module name="org.jboss.jandex"/>
          
          
                  <module name="org.apache.openjpa" optional="true"/>  <!-- org.apache.openjpa:main must be created manually with OpenJPA jars -->
              </dependencies>
          </module>
          

           

           

          With all this config, my app boots fine but then OpenJPA starts complaining about "entity X is not a managed type" even though the log file indicates that it found entity X in the peristence.xml so I hope this works for you

          • 2. Re: Openjpa on JBoss EAP 6.1.0 with AS 7.2.0
            kpagan

            See my answer here https://community.jboss.org/message/852180#852180

             

            This may help.