Author: techfox9

JBoss vs WebLogic tidbits..

Thursday, June 10th, 2010 @ 4:45 pm

Porting JBoss EJB3s to WebLogic is not trivial.. Here are some of the compliance exceptions:

  • weblogic.ejb.container.compliance.ComplianceException: Home methods are not allowed on session beans: BookTestBean.test()

  • weblogic.ejb.container.compliance.ComplianceException: In EJB BookTestBean, method test() on the home interface does not throw java.rmi.RemoteException. This is a required exception.

  • weblogic.ejb.container.compliance.ComplianceException: In EJB BookTestBean, the home interface de.laliluna.library.BookTestBeanLocal must extend the javax.ejb.EJBHome interface.

  • weblogic.ejb.container.compliance.ComplianceException: In EJB BookTestBean, the home interface of a stateless session bean must have one create method that takes no arguments.

  • weblogic.ejb.container.compliance.ComplianceException: In EJB BookTestBean, the return type for the home create method create() must be the remote interface type of the bean.

Persistence-related exception:

org.apache.openjpa.util.MetaDataException: “de.laliluna.library.Book.id” declares generator name “book_sequence”, but uses the AUTO generation type. The only valid generator names under AUTO are “uuid-hex” and “uuid-string”.

To fix it, change this:

// For JBoss
@GeneratedValue(strategy = GenerationType.AUTO, generator = "book_sequence")

to this:

// For WebLogic
@GeneratedValue(strategy = GenerationType.AUTO)

More on persistence.. the default provider for WebLogic is a package named ‘Kodo’.
To set the OpenJPA (Java Persistence API) provider, add the element
to persistence.xml , like this:

<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_1_0.xsd"
             version="1.0">

        <persistence-unit name="FirstEjb3Tutorial" transaction-type="JTA">
                <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
                <properties>
                        <property name="openjpa.ConnectionURL" value="jdbc:pointbase:server://localhost:18888/fe3t"/>
                        <property name="openjpa.ConnectionDriverName" value="com.pointbase.jdbc.jdbcUniversalDriver"/>
                        <property name="openjpa.ConnectionUserName" value="fe3t"/>                   
                        <property name="openjpa.ConnectionPassword" value="fe3t"/>
                        <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
                </properties>
        </persistence-unit>
</persistence>

Note the “openjpa.” qualifier .. Persistence will not work without it ..

JBoss, Weblogic


 


Comments are closed.