Topic
4 replies Latest Post - ‏2010-12-17T17:28:13Z by bkail
BasheerShaik
BasheerShaik
2 Posts
ACCEPTED ANSWER

Pinned topic PersistenceException in Websphere-7

‏2010-12-08T17:51:10Z |
I am trying to deploy a JPA based application on Websphere-7, with the following persistence.xml content:

<?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" version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="abc">
<jta-data-source>jdbc/ABC1</jta-data-source>
<non-jta-data-source>jdbc/ABC</non-jta-data-source>

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

</persistence-unit>
</persistence>

With this I get the following error:
12/8/10 12:19:26:853 EST 0000000b JPAPUnitInfo E CWWJP0015E: An error occurred in the com.ibm.websphere.persistence.PersistenceProviderImpl persistence provider when it attempted to create the container entity manager factory for the abc persistence unit. The following error occurred: There was an error when invoking the static newInstance method on the named factory class "com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCBrokerFactory". See the nested exception for details.

And the ffdc stack trace is as shown below:

FFDC Exception:org.apache.openjpa.persistence.PersistenceException SourceId:com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory ProbeId:759 Reporter:com.ibm.ws.jpa.management.JPAPUnitInfo@331e331e
<openjpa-1.2.3-SNAPSHOT-r422266:965640 fatal general error> org.apache.openjpa.persistence.PersistenceException: There was an error when invoking the static newInstance method on the named factory class "com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCBrokerFactory". See the nested exception for details.
at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:67)
at org.apache.openjpa.persistence.PersistenceProviderImpl.getBrokerFactory(PersistenceProviderImpl.java:110)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:150)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:59)
at com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory(JPAPUnitInfo.java:1484)
......
Caused by: org.apache.openjpa.lib.util.ParseException: Instantiation of plugin "Log" with value "com.ibm.ws.jpa.management.JPALogFactory" caused an error "java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: com.ibm.ws.jpa.management.JPALogFactory". The alias or class name may have been misspelled, or the class may not have be available in the class path. Valid aliases for this plugin are: commons, false, log4j, none, openjpa, true
at org.apache.openjpa.lib.conf.Configurations.getCreateException(Configurations.java:396)
at org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.java:206)
at org.apache.openjpa.lib.conf.ObjectValue.newInstance(ObjectValue.java:109)

Appreciate any help on this.
Thanks,
Basheer.
Updated on 2010-12-17T17:28:13Z at 2010-12-17T17:28:13Z by bkail
  • sutter
    sutter
    94 Posts
    ACCEPTED ANSWER

    Re: PersistenceException in Websphere-7

    ‏2010-12-15T14:31:12Z  in response to BasheerShaik
    Hi Basheer,
    Sorry that I missed this post... Are you still experiencing this issue?

    I don't have any immediate solutions for you. I can tell you a bit about what's going on though... There is a defined plug point for JPA providers to be used in a container-managed persistence environment. The ejb container is attempting to create an EntityManagerFactory based on the persistence unit (abc) that you have defined. While calling out to the WebSphere JPA code to create this EMF, some problem is not allowing this EMF to be created. The strange thing from the exception is that I do not recognize the LogFactory that is causing the issue:

    > Caused by: org.apache.openjpa.lib.util.ParseException: Instantiation of plugin "Log" with value "com.ibm.ws.jpa.management.JPALogFactory" caused an error "java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: com.ibm.ws.jpa.management.JPALogFactory". The alias or class name may have been misspelled, or the class may not have be available in the class path. Valid aliases for this plugin are: commons, false, log4j, none, openjpa, true

    The plugin "Log" is referring to the openjpa.Log plugin property. But, why the JPALogFactory class from the container environment can't be found is a mystery. I will ask our container team to look at this posting to see if they have any ideas.

    In the mean time, if you can post back your current status on this problem, that would be good.

    Thanks,
    Kevin
  • bkail
    bkail
    2 Posts
    ACCEPTED ANSWER

    Re: PersistenceException in Websphere-7

    ‏2010-12-15T21:45:05Z  in response to BasheerShaik
    Are you running with "Access to internal server classes" set to "Restrict"?

    http://publib.boulder.ibm.com/infocenter/wasinfo/fep/topic/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/urun_rappsvr.html

    If yes, then I can reproduce the problem. As a workaround, you can switch back to "Allow". In any case, this looks like a product problem.
    • BasheerShaik
      BasheerShaik
      2 Posts
      ACCEPTED ANSWER

      Re: PersistenceException in Websphere-7

      ‏2010-12-16T13:25:02Z  in response to bkail
      Hi Guys,
      Appreciate your responses. I figured out that my Websphere installation was missing the feature pack for JPA 2.0 and I subsequently installed it. But, now I am getting a different exception. In one of my local stateless session beans with bean managed transaction, I have UserTransaction declaration as shown below:
      @Resource
      private UserTransaction userTransaction;
      With this I am getting the following exception:
      12/15/10 15:50:25:451 EST FFDC Exception:com.ibm.wsspi.injectionengine.InjectionException SourceId:com.ibm.ws.injectionengine.InjectionEngineImpl.processBindings ProbeId:480 Reporter:com.ibm.ws.injectionengine.InjectionEngineImpl@f340f34
      com.ibm.wsspi.injectionengine.InjectionException: CWNEN0044E: A resource reference binding could not be found for the following resource references http://my.db.dao.DbUpdatorBean/userTransaction, defined for the DbUpdatorBean component.
      at com.ibm.wsspi.injectionengine.InjectionProcessor.collectInjectionNBindingData(InjectionProcessor.java:1042)
      at com.ibm.ws.injectionengine.InjectionEngineImpl.processBindings(InjectionEngineImpl.java:516)
      at com.ibm.ws.injectionengine.InjectionEngineImpl.processInjectionMetaData(InjectionEngineImpl.java:322)
      at com.ibm.ws.util.ComponentNameSpaceHelper.populateJavaNameSpace(ComponentNameSpaceHelper.java:806)
      at com.ibm.ws.util.ComponentNameSpaceHelper.populateJavaNameSpace(ComponentNameSpaceHelper.java:519)
      at com.ibm.ws.metadata.ejb.EJBMDOrchestrator.finishBMDInit(EJBMDOrchestrator.java:1864)
      ....
      This perfectly works under JBOSS-5.1. For Websphere, do I have to declare this in any other place?
      Appreciate any help on this.
      Thanks,
      Basheer.
      • bkail
        bkail
        2 Posts
        ACCEPTED ANSWER

        Re: PersistenceException in Websphere-7

        ‏2010-12-17T17:28:13Z  in response to BasheerShaik
        That metadata should be sufficient. The injection engine should be able to match the UserTransaction field type. Is it possible that you've included a JTA API jar with a copy of the UserTransaction in your application, and that is confusing the type comparison?