Sunday, August 1, 2010

com.bea.xml.XmlException: error: The document is not a WLJMSMessage@http://www.bea.com/WLS/JMS/Message

When importing a message in a Queue in WebLogic, make sure the XML complies to a specific schema:

element WLJMSMessage
namespace http://www.bea.com/WLS/JMS/Message

An empty message looks like:


<?xml version="1.0" encoding="UTF-8"?>
<mes:WLJMSMessage xmlns:mes="http://www.bea.com/WLS/JMS/Message">
<mes:Header/>
</mes:WLJMSMessage>


If you process this message with a MDB,




public void onMessage(Message message) {
TextMessage tm = (TextMessage)message;
try {
System.out.println("!!!message " + tm.getText());
} catch (JMSException e) {
e.printStackTrace();
}

}



you will get this:

MessageDrivenBean threw an Exception in onMessage(). The exception was: java.lang.ClassCastException: weblogic.jms.common.HdrMessageImpl



Since delivery fails, I also get this:

The Message-Driven EJB: MQGeoFeedMDB is throwing exception when processing the messages. Delivery failed after 139 attempts. The EJB container will suspend the message delivery for 60 seconds before retry.




A complete sample WL Message has this format:



<?xml version="1.0" encoding="UTF-8"?>
<JMSMessageExport>
<mes:WLJMSMessage xmlns:mes="http://www.bea.com/WLS/JMS/Message">
<mes:Header>
<mes:JMSMessageID>ID:&lt;654066.1280681376262.0></mes:JMSMessageID>
<mes:JMSDeliveryMode>PERSISTENT</mes:JMSDeliveryMode>
<mes:JMSExpiration>0</mes:JMSExpiration>
<mes:JMSPriority>4</mes:JMSPriority>
<mes:JMSRedelivered>false</mes:JMSRedelivered>
<mes:JMSTimestamp>1280681376262</mes:JMSTimestamp>
<mes:Properties>
<mes:property name="JMSXDeliveryCount">
<mes:Int>0</mes:Int>
</mes:property>
</mes:Properties>
</mes:Header>
<mes:Body>
<mes:Text>your message here</mes:Text>
</mes:Body>
</mes:WLJMSMessage>
</JMSMessageExport>



JPS-01538: The default policy provider was not found

All of a sudden I am getting this message when starting OSB on Fedora...
it is accompanied by:

oracle.security.jps.JpsException: JPS-01514: The default context is missing in jps-config.xml.

and by

oracle.security.jps.config.JpsConfigurationException: /Oracle/Middleware/user_projects/domains/OSBDomainBasic/./config/jps-config.xml (No such file or directory)


googling around I found this:

-Doracle.security.jps.config has being filled with %DOMAIN_HOME%/config/fmwconfig/jps-config.xml ok ?

(at http://forums.oracle.com/forums/thread.jspa?threadID=1072870&tstart=90 )



In fact, in $DOMAIN_HOME/bin/setDomainEnv.sh there is:

-Doracle.security.jps.config=${DOMAIN_HOME}/config/fmwconfig/jps-config.xml


Make sure that your $DOMAIN_HOME/startWebLogic.sh contains at the beginning:

export DOMAIN_HOME="/Oracle/Middleware/user_projects/domains/OSBDomainBasic"


(make sure "export" is there...)

and make sure you have not messed up the
EXTRA_JAVA_PROPERTIES and the JAVA_PROPERTIES and the JAVA_OPTIONS variable assignments in the setDomainEnv.sh

And, of course, verify that the jps-config.xml file is actually where it's supposed to be and with the right read access.

In fact, in my case I had forgotten to correctly put a " in the JAVA_OPTIONS.

Unfortunately shell scripts can be very nasty to debug. This is a good reason to keep their complexity to a bare minumum, and use Groovy or other languages.

WebLogic Toplink

In WebLogic we already have TopLink:
$BEA_HOME/modules/com.oracle.toplink_1.0.0.0_11-1-1-3-0.jar
$BEA_HOME/modules/com.oracle.toplinkgrid_1.0.0.0_11-1-1-3-0.jar

Here: http://forums.oracle.com/forums/thread.jspa?messageID=3154042
it says clearly that

Toplink Essentials Provider oracle.toplink.essentials.PersistenceProvider in toplink-essentials.jar

is NOT supported in WebLogic, and we should use the

EclipseLink org.eclipse.persistence.jpa.PersistenceProvider

A jarscan for PersistenceProvider in Weblogic says:



===============================================
Found: PersistenceProvider
Class: kodo.persistence.PersistenceProviderImpl
Package: kodo.persistence
Library Name: com.bea.core.kodo_1.2.0.0_4-2-1.jar
Library Path: C:\bea11\modules\com.bea.core.kodo_1.2.0.0_4-2-1.jar
===============================================

===============================================
Found: PersistenceProvider
Class: javax.persistence.spi.PersistenceProvider
Package: javax.persistence.spi
Library Name: javax.persistence_1.0.0.0_1-0-2.jar
Library Path: C:\bea11\modules\javax.persistence_1.0.0.0_1-0-2.jar
===============================================

===============================================
Found: PersistenceProvider
Class: org.apache.openjpa.persistence.PersistenceProviderImpl$1
Package: org.apache.openjpa.persistence
Library Name: org.apache.openjpa_1.1.0.0_1-1-1-SNAPSHOT.jar
Library Path: C:\bea11\modules\org.apache.openjpa_1.1.0.0_1-1-1-SNAPSHOT.jar
===============================================

===============================================
Found: PersistenceProvider
Class: org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerIm
pl$1
Package: org.apache.openjpa.persistence
Library Name: org.apache.openjpa_1.1.0.0_1-1-1-SNAPSHOT.jar
Library Path: C:\bea11\modules\org.apache.openjpa_1.1.0.0_1-1-1-SNAPSHOT.jar
===============================================

===============================================
Found: PersistenceProvider
Class: org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerIm
pl
Package: org.apache.openjpa.persistence
Library Name: org.apache.openjpa_1.1.0.0_1-1-1-SNAPSHOT.jar
Library Path: C:\bea11\modules\org.apache.openjpa_1.1.0.0_1-1-1-SNAPSHOT.jar
===============================================

===============================================
Found: PersistenceProvider
Class: org.apache.openjpa.persistence.PersistenceProviderImpl
Package: org.apache.openjpa.persistence
Library Name: org.apache.openjpa_1.1.0.0_1-1-1-SNAPSHOT.jar
Library Path: C:\bea11\modules\org.apache.openjpa_1.1.0.0_1-1-1-SNAPSHOT.jar
===============================================

===============================================
Found: PersistenceProvider
Class: org.eclipse.persistence.jpa.PersistenceProvider
Package: org.eclipse.persistence.jpa
Library Name: org.eclipse.persistence_1.0.0.0_2-0.jar
Library Path: C:\bea11\modules\org.eclipse.persistence_1.0.0.0_2-0.jar
===============================================

===============================================
Found: PersistenceProvider
Class: org.eclipse.persistence.jpa.osgi.PersistenceProvider
Package: org.eclipse.persistence.jpa.osgi
Library Name: org.eclipse.persistence_1.0.0.0_2-0.jar
Library Path: C:\bea11\modules\org.eclipse.persistence_1.0.0.0_2-0.jar
===============================================

===============================================
Found: PersistenceProvider
Class: javax.persistence.spi.PersistenceProvider
Package: javax.persistence.spi
Library Name: wsclient_extended.jar
Library Path: C:\bea11\oracle_common\webservices\wsclient_extended.jar
===============================================

===============================================
Found: PersistenceProvider
Class: org.eclipse.persistence.jpa.PersistenceProvider
Package: org.eclipse.persistence.jpa
Library Name: wsclient_extended.jar
Library Path: C:\bea11\oracle_common\webservices\wsclient_extended.jar
===============================================




so the best candidate seems

C:\bea11\modules\org.eclipse.persistence_1.0.0.0_2-0.jar


IF you want to use Toplink Essentials, follow this path:
http://debupanda.blogspot.com/2008/03/using-toplink-essentials-as-jpa.html