Monday, August 30, 2010

Javatar vs .NOT




simply BRILLIANT!!!

Saturday, August 28, 2010

Eclipse JPA project broken when mavenized: Invalid content (no root node)

My Eclipse JPA project was broken once mavenized: 
I get a message:
Invalid content (no root node)




I have had some allucinating time reading this
https://bugs.eclipse.org/bugs/show_bug.cgi?id=290929


How sad.... anyway I found a workaround to get rid of the message:
I copy META-INF/persistence.xml in all the source folders of my project (in my case, the src/test/java folder).


Long live Eclipse! Long live Maven! One day hopefully these products will be remembered as one of the biggest trash of history.... unfortunately these days we have to learn how to coexist with them, just like Iraqis learn to coexist with US Marines.

Eclipse and SVN: how to change username

http://subclipse.tigris.org/wiki/PluginFAQ#head-d507c29676491f4419997a76735feb6ef0aa8cf8

Since I am using SVNKit, I need to clear the .keyring file.
The location of .keyring is
/Oracle/Middleware/oepe_11gR1PS2/configuration/org.eclipse.core.runtime/.keyring

It's a binary file, so don't try to look inside or you could be petrified, as you had watched the Gorgon. Don't look at it in the eyes, just kill it.



WLST and JMS

I found this wonderful script (thank you to my Indian friends for sharing)

http://wlstbyexamples.blogspot.com/2009/11/jms-monitoring-using-wlst.html

This post
http://unni-at-work.blogspot.com/2010/02/use-userconfigfile-for-connecting-to.html

again maintained by an Indian, explains how to create a userconfig file

East or West, India is the best :o)


To make a long story short:

wlst.sh
connect('${wlusername}', '${wlpw}', 't3://${wlhostname}:${port}')
storeUserConfig('PVWebLogicConfig.properties',  'PVWebLogicKey.properties')
exit()


you get a lovely warning:

Creating the key file can reduce the security of your system if it is not kept in a secured location after it is created. Do you want to create the key file? y or n


and a lovely confirmation:

The username and password that were used for this WebLogic Server connection are stored in PVWebLogicConfig.properties and PVWebLogicKey.properties.


Lovely!


After that, you can connect by doing this:



connect(userConfigFile='PVWebLogicConfig.properties',userKeyFile='PVWebLogicKey.properties',url='t3://${wlhostname}:${port}')



Remember that to explore the JMSDestinationRuntime you must connect to the MS, not to the Admin:

connect('bla', 'bla', 't3://hostname:port_of_ms')

jmsdestlist = home.getMBeansByType('JMSDestinationRuntime')


if you want to navigate to them, you should do:
serverRuntime()
cd('JMSRuntime/dev3OsbLABMs1.jms/JMSServers/myJmsServer_1/Destinations/MQGEOSystemModule!myJmsServer_1@MQGEOQueue')

print cmo.getMessagesCurrentCount()

Friday, August 27, 2010

Toad For Oracle Xpert is your friend

Tonight we were facing a Tx timeout while persisting data to a Oracle DB using EclipseLink JPA.
We downloaded Toad For Oracle Xpert (trial edition, 30 days) and connected to the DB and done a Browse Session, identified our session based on the IP address and username of the originator, and found out the SQL which was being executed and the Execution Plan (an horrific FULL TABLE SCAN immediately evidenced by Toad).

This tool is simply fantastic. You can't live without.

http://www.quest.com/toad-for-oracle/software-downloads.aspx



Gant looks better than Ant

Nice tutorial here:
http://www.ibm.com/developerworks/java/tutorials/j-gant/

Ant sucks, but its advantage is a huge library of tools.... Gant seems to be able to make Ant power available in a real programming language.... way to go!

Thursday, August 26, 2010

NewJMSMessagePoller.ReportingMDB causing tx rollback for timeout

NewJMSMessagePoller.ReportingMDB ? In doubt, I untarget JMS Reporting Provider and Message Reporting Purger.



####     <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tun
ing)'> <> <> <7f52c101a04e4ebd:-564cb206:12aaa480612:-7fe8-0000000000000129> <1282780816350>  
nsaction Xid=BEA1-1627D2EB148FC1B950DB(388951180),Status=Rolled back. [Reason=weblogic.transaction.internal.TimedOutException: Transaction has timed out when
 making request to XAResource 'WLStore_dev3OsbLABDomain_WseeFileStore_auto_1'.],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=31,seconds left
=30,XAServerResourceInfo[WLStore_dev3OsbLABDomain_WseeFileStore_auto_1]=(ServerResourceInfo[WLStore_dev3OsbLABDomain_WseeFileStore_auto_1]=(state=rolledback,
assigned=dev3OsbLABMs1),xar=WLStore_dev3OsbLABDomain_WseeFileStore_auto_1457582409,re-Registered = false),XAServerResourceInfo[MQParserDataSource_dev3OsbLABD
omain]=(ServerResourceInfo[MQParserDataSource_dev3OsbLABDomain]=(state=rolledback,assigned=dev3OsbLABMs1),xar=MQParserDataSource,re-Registered = false),SCInf
o[dev3OsbLABDomain+dev3OsbLABMs1]=(state=rolledback),local properties=({weblogic.jdbc.jta.MQParserDataSource=[ No XAConnection is attached to this TxInfo ]})
,OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=dev3OsbLABMs1+osb.dev3.acme.net:8311+dev3OsbLABDomain+t3+, XAResource
s={eis/tibjms/Queue, eis/activemq/Queue, WLStore_dev3OsbLABDomain__WLS_dev3OsbLABMs1, eis/AQ/aqSample, MQParserDataSource_dev3OsbLABDomain, eis/fioranomq/Top
ic, eis/jbossmq/Queue, WLStore_dev3OsbLABDomain_MQGEOFileStore, eis/Apps/Apps, DBConnectionREFData_dev3OsbLABDomain, eis/webspheremq/Queue, WSATGatewayRM_dev
3OsbLABMs1_dev3OsbLABDomain, eis/aqjms/Queue, WLStore_dev3OsbLABDomain_WseeJaxwsFileStore_auto_1, eis/pramati/Queue, DBConnectionACME_dev3OsbLABDomain, eis/
tibjms/Topic, eis/tibjmsDirect/Queue, eis/wls/Queue, WLStore_dev3OsbLABDomain_WseeFileStore_auto_1, WLStore_dev3OsbLABDomain_FileStore_auto_1, eis/tibjmsDire
ct/Topic, eis/wls/Topic, eis/sunmq/Queue, eis/aqjms/Topic},NonXAResources={})],CoordinatorURL=dev3OsbLABMs1+osb.dev3.acme.net:8311+dev3OsbLABDomain
+t3+): weblogic.transaction.RollbackException: Transaction has timed out when making request to XAResource 'WLStore_dev3OsbLABDomain_WseeFileStore_auto_1'.
        at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java:1871)
        at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:330)
        at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:225)
        at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:327)
        at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:327)
        at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4659)
        at weblogic.jms.client.JMSSession.execute(JMSSession.java:4345)
        at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3822)
        at weblogic.jms.client.JMSSession.access$000(JMSSession.java:115)
        at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5170)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: weblogic.transaction.internal.TimedOutException: Transaction has timed out when making request to XAResource 'WLStore_dev3OsbLABDomain_WseeFileStore_auto_1'.
        at weblogic.transaction.internal.XAResourceDescriptor.startResourceUse(XAResourceDescriptor.java:675)
        at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerResourceInfo.java:1323)
        at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerResourceInfo.java:510)
        at weblogic.transaction.internal.ServerSCInfo.startPrepare(ServerSCInfo.java:371)
        at weblogic.transaction.internal.ServerTransactionImpl.localPrepare(ServerTransactionImpl.java:2578)
        at weblogic.transaction.internal.ServerTransactionImpl.globalPrepare(ServerTransactionImpl.java:2225)
        at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:264)
        at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:224)
        at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:500)
        at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:371)
        at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:327)
        at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4659)
        at weblogic.jms.client.JMSSession.execute(JMSSession.java:4345)
        at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3821)
        ... 5 more
.> 




WTF?

Domain Health

Download:
http://sourceforge.net/projects/domainhealth/

Documentation:
http://sourceforge.net/apps/mediawiki/domainhealth/index.php?title=Main_Page


I am starting using now... looks good... will report on this in the future

Wednesday, August 25, 2010

Weblogic Wonders!

I have discovered this blog http://weblogic-wonders.com/weblogic/ and added to my Google reader, these guys do a WONDERFUL job at explaining Weblogic stuff...
EXCELLENT! You guys are born teachers,every topic is explained with plenty of examples and in a simple language. Top stuff.


Oops, now they moved to http://middlewaremagic.com/weblogic/

Monday, August 23, 2010

How to create a MDB

I am writing down all the steps so I don't forget again:

(ms1 means Managed Server 1)

PLEASE ACTIVATE CHANGES AFTER EACH OPERATION

create a Persistent Store MQGEOFileStore, target it on MS1.
create a MQGEOJMSServer, back it up with the MQGEOFileStore, target it on MS1.
create a MQGEOSystemModule, target it to MS1.
inside it create a MQGEOSubDeployment, and target it to MQGEOJMSServer.

create also a MQGEOConnectionFactory with JNDI name MQGEOConnectionFactory, and use for it the MQGEOSubDeployment (click on Advanced targeting)... remember to make it "XA Connection Factory Enabled"
and a MQGEOQueue, JNDI name MQGEOQueue, and use MQGEOSubDeployment

This is the WLST Python (it's not included the "XA Connection Factory Enabled"):

cd('/')
cmo.createFileStore('MQGEOFileStore')

cd('/FileStores/MQGEOFileStore')
set('Targets',jarray.array([ObjectName('com.bea:Name=dev2WlsCBMs1,Type=Server')], ObjectName))

cd('/')
cmo.createJMSServer('MQGEOJMSServer')

cd('/Deployments/MQGEOJMSServer')
cmo.setPersistentStore(getMBean('/FileStores/MQGEOFileStore'))
set('Targets',jarray.array([ObjectName('com.bea:Name=dev2WlsCBMs1,Type=Server')], ObjectName))

cd('/')
cmo.createJMSSystemResource('MQGEOSystemModule')

cd('/SystemResources/MQGEOSystemModule')
set('Targets',jarray.array([ObjectName('com.bea:Name=dev2WlsCBMs1,Type=Server')], ObjectName))
cmo.createSubDeployment('MQGEOSubDeployment')

cd('/SystemResources/MQGEOSystemModule/SubDeployments/MQGEOSubDeployment')
set('Targets',jarray.array([ObjectName('com.bea:Name=MQGEOJMSServer,Type=JMSServer')], ObjectName))

cd('/JMSSystemResources/MQGEOSystemModule/JMSResource/MQGEOSystemModule')
cmo.createConnectionFactory('MQGEOConnectionFactory')

cd('/JMSSystemResources/MQGEOSystemModule/JMSResource/MQGEOSystemModule/ConnectionFactories/MQGEOConnectionFactory')
cmo.setJNDIName('MQGEOConnectionFactory')

cd('/JMSSystemResources/MQGEOSystemModule/JMSResource/MQGEOSystemModule/ConnectionFactories/MQGEOConnectionFactory/SecurityParams/MQGEOConnectionFactory')
cmo.setAttachJMSXUserId(false)

cd('/SystemResources/MQGEOSystemModule/SubDeployments/MQGEOSubDeployment')
set('Targets',jarray.array([ObjectName('com.bea:Name=MQGEOJMSServer,Type=JMSServer')], ObjectName))

cd('/JMSSystemResources/MQGEOSystemModule/JMSResource/MQGEOSystemModule/ConnectionFactories/MQGEOConnectionFactory')
cmo.setSubDeploymentName('MQGEOSubDeployment')

cd('/JMSSystemResources/MQGEOSystemModule/JMSResource/MQGEOSystemModule')
cmo.createQueue('MQGEOQueue')

cd('/JMSSystemResources/MQGEOSystemModule/JMSResource/MQGEOSystemModule/Queues/MQGEOQueue')
cmo.setJNDIName('MQGEOQueue')
cmo.setSubDeploymentName('MQGEOSubDeployment')

cd('/SystemResources/MQGEOSystemModule/SubDeployments/MQGEOSubDeployment')
set('Targets',jarray.array([ObjectName('com.bea:Name=MQGEOJMSServer,Type=JMSServer')], ObjectName))

activate()



For the MDB, it should start like this:

@MessageDriven(
 activationConfig = { @ActivationConfigProperty(propertyName = "ConnectionFactoryJndiName", propertyValue = "MQGEOConnectionFactory"),     
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"
  ) }, 
 mappedName = "MQGEOQueue")

public class MQGeoFeedMDB implements MessageListener {
public void onMessage(Message message) {
     TextMessage tm = (TextMessage)message;
        String text = tm.getText();
.......
}




and, last but not least, the DD:



 
 
  MQGeoFeedMDB
  
   MQGEOQueue
   MQGEOConnectionFactory
  
 





Funnily, these operations succeed on my standalone Admin, but they fail on a proper domain with an Admin and a cluster....the error is:

one or more registered update listeners reported activation problems. The following failures occurred: -- The following failures occurred: -- weblogic.management.DeploymentException:
This probably because I didn't activate changes after each operation....WL doesn't execute oeprations in the right order....


and in the logs I find
Failed to start JMS Server "MQGEOJMSS
erver" due to weblogic.management.DeploymentException: The persistent store "MQGEOFileStore" does not exist.


and
[Store:280044]The file store directory "/acme/domains/dev2OsbCBDomain/servers/dev2OsbCBAdmin/data/store/MQGEOFileStore" does not exist.


I do a /acme/domains/dev2OsbCBDomain/servers/dev2OsbCBAdmin/data/store/MQGEOFileStore
to fix the problem.

Actually at the end I had to remove the target for MQGEOSystemModule and let the subdeployment take care of targetting.... Houston, these targetting with Subdeployment still have big problems.
I still get a message:
MDB application MQParserEARfromlocalJMSQueue is NOT connected to messaging system.


Reading in the logs I find:

The Message-Driven EJB: MQGeoFeedMDB is unable to connect to the JMS destination: MQGEOQueue. The Error was:
[EJB:015027]The Message-Driven EJB is transactional but JMS connection factory referenced by the JNDI name: MQGEOConnectionFactory is not a JMS XA connection factory.


On the whole, my impression is that

1) WebLogic error messages related to the JMS module are very poorly done, the error message appearing on the Console tells nothing about the root cause of the problem

2) Subdeployments have been poorly engineered, they still overlap with traditional targetting and they are not completely alternative to it, nor they can be completely replaced with traditional targeting...

3) When you perform several operations without activating, WebLogic should be smart enough to perform the activation activities in the proper order, without obliging you to perform an operation at a time and activate it.

3A) We really miss in WebLogic the ability to execute WLST code directly from the console, without having to run weblogic.WLST from a shell; and the ability to export objects as WLST script, in order to import them into another domain. Right now the only option is copy/paste sections of config.xml, which stinks.

4) but all of the above is a good news, it means that there is room for improvement

Sunday, August 22, 2010

Java Decompiler

DJ Decompiler is pretty good:

http://www.softpedia.com/get/Programming/Debuggers-Decompilers-Dissasemblers/DJ-Java-Decompiler.shtml
( I have bought it myself)

but I am told by Luciano to preprocess classes with this:

http://sourceforge.net/projects/jadretro/

especially when they are written with Java 5 (generics) syntax
see also:

http://stackoverflow.com/questions/31353/is-jad-the-best-java-decompiler

Very useful the Eclipse Jad Plugin, here the wiki

Actually it seems that JAD is outdated, and now you should use jdeclipse
(just choose the update site http://java.decompiler.free.fr/jd-eclipse/update )


WebLogic 11g and MQ 7.... when the game gets tough...

(see also a previous post...http://www.javamonamour.org/2010/08/weblogic-integration-with-mq-series.html)


I am following the instructions

http://ibswings.blogspot.com/2008/02/integrating-mq-broker-6-with-bea.html


and I get


Aug 22, 2010 2:26:30 PM CEST Debug EjbDeployment BEA-000000 [EJBModule] activate() on module : EJBModule(MQReceiver) : activating module
Aug 22, 2010 2:26:30 PM CEST Debug EjbDeployment BEA-000000 [MessageDrivenBeanInfoImpl] Calling JMS MDB helper with providerURL=null
Aug 22, 2010 2:26:30 PM CEST Debug JMSCDS BEA-000000 getSubject: before looking up jms/WLReceiverQueue providerIRL = null isLocal = true
Aug 22, 2010 2:26:30 PM CEST Debug JMSCDS BEA-000000 Successfully created the initial context for the JNDIName jms/WLReceiverQueue
Aug 22, 2010 2:26:33 PM CEST Warning EJB BEA-010061 The Message-Driven EJB: TestMDB is unable to connect to the JMS destination: jms/WLReceiverQueue. The Error was:



 javax.jms.JMSException: JMSCS0006: An internal problem occurred. Diagnostic information for service was written to '/Oracle/Middleware/user_projects/domains/OSBDomainBasic/FFDC/JMSCC0004.FDC'. Please terminate the application as the product is in an inconsistent internal state.
        at com.ibm.msg.client.commonservices.trace.Trace.ffst(Trace.java:1386)
        at com.ibm.msg.client.jms.admin.JmsDestinationImpl.readObject(JmsDestinationImpl.java:638)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
        at weblogic.rmi.extensions.server.CBVInputStream.readObject(CBVInputStream.java:64)
        at weblogic.jndi.internal.JNDIHelper.copyObject(JNDIHelper.java:28)
        at weblogic.jndi.WLSJNDIEnvironmentImpl.copyObject(WLSJNDIEnvironmentImpl.java:77)
        at weblogic.jndi.internal.WLEventContextImpl.copyObject(WLEventContextImpl.java:383)
        at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:255)
        at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:393)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at weblogic.jms.common.CDS$2.run(CDS.java:503)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
        at weblogic.jms.common.CrossDomainSecurityManager.runAs(CrossDomainSecurityManager.java:130)
        at weblogic.jms.common.CDS.lookupDestination(CDS.java:497)
        at weblogic.jms.common.CDS.getDDMembershipInformation(CDS.java:276)
        at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.createMDManagers(MessageDrivenBeanInfoImpl.java:1455)
        at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.activate(MessageDrivenBeanInfoImpl.java:1252)
        at weblogic.ejb.container.deployer.EJBDeployer.activate(EJBDeployer.java:1320)
        at weblogic.ejb.container.deployer.EJBModule.activate(EJBModule.java:493)
        at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:227)
        at weblogic.application.internal.flow.DeploymentCallbackFlow$2.next(DeploymentCallbackFlow.java:531)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
        at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:165)
        at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:157)
        at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
        at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
        at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)



I also get
Exception in thread "Thread-39" java.lang.NoClassDefFoundError: com/ibm/mq/internal/MQCommonServices
 at com.ibm.mq.MQSESSION.getJmqiEnv(MQSESSION.java:134)
 at com.ibm.mq.MQQueueManagerFactory.(MQQueueManagerFactory.java:85)
 at com.ibm.mq.MQQueueManagerFactory.getInstance(MQQueueManagerFactory.java:112)
 at com.ibm.mq.MQQueueManager.(MQQueueManager.java:147)
 at com.bea.wli.sb.transports.mq.MQResiduePurgeThread.run(MQResiduePurgeThread.java:83)


which seems to be addressed here:
http://www.ibm.com/developerworks/forums/thread.jspa?threadID=236529
In this post it mentions some extra JARs for JNDI support, like mqcontext.jar....let's keep an eye on this.... this http://www-01.ibm.com/support/docview.wss?uid=swg24004684 is the support pack...


I target WLEventContextImpl and I find this:

===============================================
Found: WLEventContextImpl
Class: weblogic.jndi.internal.WLEventContextImpl
Package: weblogic.jndi.internal
Library Name: wlfullclient.jar
Library Path: /Oracle/Middleware/wlserver_10.3/server/lib/wlfullclient.jar
===============================================

===============================================
Found: WLEventContextImpl
Class: weblogic.jndi.internal.WLEventContextImpl
Package: weblogic.jndi.internal
Library Name: weblogic.jar
Library Path: /Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar
===============================================

===============================================
Found: WLEventContextImpl
Class: weblogic.jndi.internal.WLEventContextImpl
Package: weblogic.jndi.internal
Library Name: wlthint3client.jar
Library Path: /Oracle/Middleware/wlserver_10.3/server/lib/wlthint3client.jar




I get the one in weblogic.jar, decompile the weblogic.jndi.internal.WLEventContextImpl class, and find that there is no debug statement in it.... I add some sysout in the lookup and copyObject methods to find out which class is causing the error, and copy the modified weblogic.jar back...

my patched class file is in /home/osb/workspacePVPreMaven/WLPatchForMQ/bin/weblogic/jndi/internal/WLEventContextImpl.class

I run these commands to copy the 3 jars in a temp directory and patch them:

cp /home/osb/workspacePVPreMaven/WLPatchForMQ/bin/weblogic/jndi/internal/WLEventContextImpl.class ./weblogic/jndi/internal/WLEventContextImpl.class

cp /Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar .
cp /Oracle/Middleware/wlserver_10.3/server/lib/wlfullclient.jar .
cp /Oracle/Middleware/wlserver_10.3/server/lib/wlthint3client.jar .
cp wlfullclient.jar wlfullclient.jar.ORI
cp weblogic.jar weblogic.jar.ORI
cp wlthint3client.jar wlthint3client.jar.ORI


jar uvf weblogic.jar weblogic/jndi/internal/WLEventContextImpl.class
cp weblogic.jar /Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar

jar uvf wlfullclient.jar weblogic/jndi/internal/WLEventContextImpl.class
cp wlfullclient.jar /Oracle/Middleware/wlserver_10.3/server/lib/wlfullclient.jar

jar uvf wlthint3client.jar weblogic/jndi/internal/WLEventContextImpl.class
cp wlthint3client.jar /Oracle/Middleware/wlserver_10.3/server/lib/wlthint3client.jar



and to restore the files:

cp weblogic.jar.ORI /Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar
cp wlfullclient.jar.ORI /Oracle/Middleware/wlserver_10.3/server/lib/wlfullclient.jar
cp wlthint3client.jar.ORI /Oracle/Middleware/wlserver_10.3/server/lib/wlthint3client.jar


Unfortunately the patch WORKS and traces the calls to JNDI lookups, but the decompilation must have messed it up because itcannot find a queue and the WLS crashes.

With some terror I discover that connector.jar delivered with MQ 7 dates back to 2001 (JDK 1.3) and providerutil.jar dates back to 2000 (JDK 1.2).

Enabling EJB, JMS, JNDI, ClassLoader flags doesn't help. Most likely the remote JMS destination deserialization fails.



Jan-2011: interesting post here http://weblogic-wonders.com/weblogic/2010/11/24/weblogic-foreign-jms-server-configuration-with-mq-series/

Jarspace, the Ultimate Swiss Knife

There are a number of tools to help you cope with the Jar Hell:

the excellent jarscan http://www.inetfeedback.com/jarscan/ to help you find the occurrences of a class in any number of jars recursively from a base directory

jdepend http://www.clarkware.com/software/JDepend.html which helps you detect the package dependency

duplicate class finder http://sourceforge.net/projects/dupfinder/

my own small Java app to list all files in all jars : http://www.javamonamour.org/2010/05/java-class-to-search-for-text-in-jars.html

I will blog more as I find them...

I really wish there was a tool to consolidate all these functions in an easy-to-use UI based AND scriptable interface....If I have time (no, I will not have) I will write it and call it Jarspace. Actually, I should call it JarHell. Or JarSucks?

The amount of time wasted troubleshooting JAR issues is worrysome. PS such a tool more or less exists : http://code.google.com/p/jar-explorer/

Saturday, August 21, 2010

Development vs Operations

Too much knowledge is kept in the head of individuals,
and little is explained on the internal wiki
In a really Agile project, people should directly document stuff as they do it.
We are all lazy - including me - and we don't do it.

Ideally, it would be nice to have a person who doesn't deliver anything, she (ideally a blonde with big boobs) would simply go around from developer to developer and ask him "so, explain me everything", and as he explains she writes down everything on the Wiki.

When we turn over the system to Operations, they need to be taught. If everything is already written somewhere (or documented with podcasts, videos, anything) this will avoid hell in production.


Even at operations level, we developers have our bag of tricks to test, troubleshoot etc.
This bag of tricks is often very valuable and should be made public and available to Operations.

The huge gap between Development and Operation is historical and omnipresent in IT projects, and causes immense frustration and damage to the company.

Pragmatic SOA, CS-SOA : common sense SOA

http://www.infoq.com/presentations/Pragmatic-SOA

you might disagree on some statements, but the presentation is brilliant, loaded with information and though-provoking.

Here http://www.innoq.com/de the company of this smart fellow.

Topics:

  • Application Architecture vs Integration Architecture
  • It's more important to standardize formats and protocols, than force everything through a set of interfaces
  • Don't put a ESB in the middle of everything
  • Avoid Doodleware tools
  • Don't generate code from XML Schemas
  • Use Groovy to generate XML
  • Don't let your application objects leak


Rumors, Hysteria and Panic-driven decision making


(you can buy the cartoon here http://www.kaltoons.com/zencart/index.php?main_page=product_info&cPath=66&products_id=184 )

Yesterday an application went offline for a minor networking problem. Everything was under control and the application was shortly after put online again. Yet the rumor spread that the application was unusable and we needed to put in place a workaround. It took some effort to quell the rumors - which I am sure are still alive somewhere in the organization, it takes a moment to destroy the reputation and a lifetime to build it.

Mass hysteria is not confined to human beings. I once saw a photograph of a large herd of wild elephants in Central Africa Seeing an airplane for the first time, and all in a state of wild collective terror. As, however, there were no journalists among them, the terror died down when the airplane was out of sight. [Bertrand Russell, Abr. T.F.D. p 7]

Continuous Delivery

Continuous Delivery

http://continuousdelivery.com/
http://www.amazon.com/gp/product/0321601912



I am reading the book, it's extremely interesting and a must for any IT specialist. It focuses on concepts rather than specific products, although it does mention best-of-the-breed products for each thing. The technical level is very high, these people talk out of a huge field experience.

Yet I feel that some repetition could have been avoided, they repeat at least 30 times that "manual steps are bad bad bad", ok, I got the concept, no need to repeat it so often.

This post is really great, and summarizes the entire book.

Maieutics

http://en.wikipedia.org/wiki/Maieutics

I can't emphasize enough the role of asking people to explain their ideas,
their feelings, their current way of doing things and asking questions on how things can be improved.

My favorite question is "so, what are your feelings about this". The question being generic, it aims to let the important points emerge, since normally feelings concentrate about the important points. And the questions can be a catalysts of debate with colleagues and decision making.

Don't expect things to be good from day one, they become good with an iterative process of revisions and revisiting.

Socratically speaking, truth is latent inside us and as a baby she needs some little help to emerge. We can be the midwives of our own ideas and processes, but better ask a little help from our friends, as Joe Cocker said. We are social animals and isolation can bring to aberration.

Tuesday, August 17, 2010

WebLogic integration with MQ series using JMS Foreign Server

I am taking some notes just to track:

http://www.ibm.com/developerworks/websphere/library/techarticles/0604_kesavan/0604_kesavan.html

one must configure the MDB to use a foreign JMS connection factory in addition to the foreign JMS
destination.


Error getting JMSServer member info NestedException Message is :javax.naming.Reference

http://ibswings.blogspot.com/2008/02/integrating-mq-broker-6-with-bea.html

If MQ and WLS are NOT on the same box, make sure you choose the transport=MQClient on MQ, this will generate a .bindings file totally different from the previous one; remember to copy this file to WebLogic.



To verify that your MDB is actually registered as a consumer of the MQ queue, "check value of IPProcs attribute in queue. This value gives the current number of threads listening for messages. If this value is 0 then there is no thread listening. " ( I am quoting a OTN thread)


This http://blog.xebia.com/2009/12/02/restricting-the-number-of-jms-mq-connections-made-by-the-osb/ is a very interesting reading on how to configure the number of listeners on the MQ queue.


This script is useful to create the resources:

cd('/')
cmo.createJMSSystemResource('MQIntegrationTest')

cd('/SystemResources/MQIntegrationTest')
set('Targets',jarray.array([ObjectName('com.bea:Name=dev2WlsCBMs1,Type=Server')], ObjectName))

cd('/JMSSystemResources/MQIntegrationTest/JMSResource/MQIntegrationTest')
cmo.createForeignServer('MQTestForeignServer')

cd('/JMSSystemResources/MQIntegrationTest/JMSResource/MQIntegrationTest/ForeignServers/MQTestForeignServer')
cmo.setDefaultTargetingEnabled(true)
cmo.setConnectionURL('file:////acme/domains/dev2WlsCBDomain/mqjndistuff')
cmo.setInitialContextFactory('com.sun.jndi.fscontext.RefFSContextFactory')
cmo.unSet('JNDIPropertiesCredentialEncrypted')
cmo.createForeignDestination('ReceiverDetails')

cd('/JMSSystemResources/MQIntegrationTest/JMSResource/MQIntegrationTest/ForeignServers/MQTestForeignServer/ForeignDestinations/ReceiverDetails')
cmo.setLocalJNDIName('jms/WLReceiverQueue')
cmo.setRemoteJNDIName('MQSenderQueue')

cd('/JMSSystemResources/MQIntegrationTest/JMSResource/MQIntegrationTest/ForeignServers/MQTestForeignServer')
cmo.createForeignConnectionFactory('ReceiverCF')

cd('/JMSSystemResources/MQIntegrationTest/JMSResource/MQIntegrationTest/ForeignServers/MQTestForeignServer/ForeignConnectionFactories/ReceiverCF')
cmo.setLocalJNDIName('jms/WLReceiverQCF')
cmo.setRemoteJNDIName('MQSenderQCF')

activate()

Sunday, August 15, 2010

Welcome Eclipse 3.6 and WLST support!

Eclipse 3.5 = GALILEO
Eclipse 3.6 = HELIOS

here
http://www.oracle.com/technetwork/middleware/ias/downloads/wls-main-097127.html
download WLS 11gR1 BUT it's still with Eclipse 3.5.2 :o(

here www.oracle.com/goto/oepe you get OEPE with 3.6, but not integrated with WebLogic.
Basically this is http://www.oracle.com/technetwork/developer-tools/eclipse/overview/index.html

here some comments:
http://www.infoq.com/news/2010/08/oracle_enterprise_pack_helios_ec

here
http://oracle.mobi/quickPage.html?page=15970&content=41332731&pageNum=-1
it says:

WebLogic Scripting Tool (WLST) features – bring new Oracle WebLogic Server administration support to Eclipse with:
Jython/Python IDE for WLST, based on PyDev – provides full syntax highlighting, validation, and code completion for WLST scripts;
Define and reuse WLST templates – accelerate WLST script editing;
Oracle WebLogic MBean explorer – visualizes the server MBean tree for easy drag and drop to the WLST script;
Integrated WLST console – provides script execution and debugging tools from within Eclipse in both online and offline modes;
WLST integrated help – makes it easy to access documentation for WLST commands.


HOW TO USE IT?

Create a Utility project, set a runtime target WL 11g patchset 2, choose the WL home.
Project, Project Facets, enable WLST.
New WLST script. Give a .py extension.


It opens a template:


#Conditionally import wlstModule only when script is executed with jython
if __name__ == '__main__': 
    from wlstModule import *#@UnusedWildImport

print 'starting the script ....'
username = 'weblogic'
password = 'welcome1'
url='t3://localhost:7001'

connect(username,password,url)


edit()
startEdit()


try:
    save()
    activate(block="true")
    print "script returns SUCCESS"   
except Exception, e:
    print e 
    print "Error while trying to save and/or activate!!!"
    dumpStack()
    raise 
    


Do Show/View/ WLST Help.

Search Eclipse help for WLST, there is interesting information.

Start WebLogic,
Add the WL server to the list of servers in the Servers view,
then Window, Show View, WebLogic MBean Explorer

Show/Console/WLST and you go into wls:/offline

To run the .py script, right-click, run as WLST Run, or WLST Debug.

Saturday, August 14, 2010

Maven sucks like hell

IMHO Maven is CRAP, the underlying concept is good but the implementation is repulsive, with all the xml to be handcrafted. It should not be hard to create a DSL and a nice IDE, yet people get carried away by this XML junk and we spit blood juggling with confusing documentation and endless xml snippets.

As here http://www.jumpingbean.co.za/blogs/mark/maven_problems says:
"All of this can make using maven very time consuming and frustrating. I do think that maven is a good project but that it could be great if managed correctly."
Simply said, my head and Maven  Designer head are made in incompatible ways.

Incidentally at office they had endless discussions on Maven vs Ant. I am not interested in choosing between a hard place and a rock: I want a modern tool to address my needs and get my stuff done in a breeze.

Whoever asserts that you should build a complex project modeling or a complex procedural deployment script based on XML is simply UNHEALTHY.

I have seen Maven "experts" struggle for hours even to get the basic done, and still their stuff breaks again and again. It's like if in Eclipse or NetBeans it would take me one day to create an empty EJB project.

Creating the structure for a EAR with a ejb-client, a war, a ejb module and dependencies from other Java projects (jar) should be a matter of a few clicks or a command.... in Maven the maven-ear-plugin is very poorly designed, I have surfed for hours and searched several book for a clear example, in vain. And everything is a matter of copying and pasting XML.

There is a decent plugin for Eclipse, with an extensive reference book:

http://m2eclipse.sonatype.org/installing-m2eclipse.html
http://www.sonatype.com/books/m2eclipse-book/reference/

This plugin seems to make Maven use POSSIBLE for a regular human being, without incurring in several nervous breakdowns. In fact, even this plugin has been designed without a proper specialized wizard for each project topology, so you are left alone to juggle in a myriad of options without a clear path to follow.

Maven, even with the Eclipse plugin, is for the maven, not for the accidental user. There is nothing like 1-2-3-easy, unless you do the really basic stuff.

I am simply trying to create a structure for an EAR with an EJB and a WAR and some dependencies from some Java projects.
With a NORMAL tool I would assume I can get it done with:

create EAR myEAR including WAR myWar, EJB myEJB depends on JAR myJAR1, myJAR2

They give you only this http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/ example, and it's your problem to recreate the entire directory structure.

Instead of using and abusing XML, they should have designed a Domain Specific Language and integrate in Groovy.

Here more on why Maven sucks.


Excellent tutorial:
http://maven.apache.org/guides/getting-started/index.html

+X turns on debugger
-e enables exception tracing

In c:/apps/maven/conf/settings.xml you find several interesting properties, such as the local-repository and the proxy.

mvn --version

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

cd my-app/
less pom.xml
mvn package
java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
ls target/classes/
mvn test
mvn test-compile

ls ~/.m2/repository

to build offline:
mvn -o package

mvn eclipse:eclipse

${basedir}/src/main/resources

mvn process-resources

EAR PLUGIN

http://maven.apache.org/plugins/maven-ear-plugin/

This is how to create an ear:
http://agoncal.wordpress.com/2009/10/23/because-i-always-forget-how-to-use-maven-ear-plugin/

FilteringClassLoader

This article on ClassLoaders in WebLogic is extremely interesting:

http://download.oracle.com/docs/cd/E12840_01/wls/docs103/programming/classloading.html

I have taken some notes:

bootstrap classloader
extensions classloader
system classpath classloader

application classloaders
(EAR: root classloader for EJBs, child classloader for each WAR)

in weblogic-application.xml with classloader-structure you can customize the classloaders

APP-INF/lib

manifest Class-Path entry

when 2 modules share the same classloader, call by reference is possible. Otherwise call-by-value is used.

classes in $CLASSPATH are always loaded before than whose in application classpath, unless you specify a FilteringClassLoader.
a FilteringClassLoader allows you to load classes locally to your classloader
add prefer-application-packages descriptor element to the weblogic-application.xml

Friday, August 13, 2010

Learn Java in 21 years

I have watched this interview:

http://www.infoq.com/interviews/thomas-armstrong-software-craftsmanship

it's very touching to see old men value craftsmanship, the skill of people who - year after year - have spilled their blood to learn best practices and achieve best quality in code.

At minute 37:00 :

"Large corporations and the current business rhetoric doesn't seem to get it across:
at the end, "people who THINK" are important, "people who SOLVE problems" are important, and "TEAMS who can work together" are important, and SMALL teams get things done"

Deploying JPA solution to WebLogic

After having successfully tested a JPA module using TopLink Essentials,
I want to deploy it in WebLogic as part of an EAR.

I read that WebLogic recommends using the

org.eclipse.persistence.jpa.PersistenceProvider

persistence provider, rather than the

oracle.toplink.essentials.PersistenceProvider

At this point I remove the toplink-essentials.jar, but the javax.persistence imports are not satisfied any more. So from the Weblogic System Library I add the javax.persistence module.




I also switch from

transaction-type="RESOURCE_LOCAL"

to

transaction-type="JTA"



and make sure you remane all your

property name="toplink.blablabla"

into

property name="javax.persistence.blablabla"


(remember that "property eclipselink.jdbc.user is deprecated")



I get also a

"bla has transactionType RESOURCE_LOCAL and therefore jtaDataSource will be ignored"



This http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#JNDI_Datasource_Setup

will help understand how to configure the JNDI




This is my fantastic persistence.xml - which has made suffer generations of developers:



 
  
  
  org.eclipse.persistence.jpa.PersistenceProvider
  

  
  MQParserDataSource
  
  com.acme.cache.domain.GeographicArea
  com.acme.cache.domain.GeoTimeZone
  com.acme.cache.domain.GeoSiteParent
  com.acme.cache.domain.GeoSiteNameAliaPK
  com.acme.cache.domain.GeoSiteNameAlia
  com.acme.cache.domain.GeoSiteExtension
  com.acme.cache.domain.GeoSiteCodeAliaPK
  com.acme.cache.domain.GeoSiteCodeAlia
  com.acme.cache.domain.GeoSiteAddress
  com.acme.cache.domain.GeoSite
  com.acme.cache.domain.GeoPostalArea
  com.acme.cache.domain.GeoLatestTag
  com.acme.cache.domain.GeoDaylightSavingZone
  com.acme.cache.domain.GeoDaylightSavingDisplaceme
  com.acme.cache.domain.GeoBda
  com.acme.cache.domain.GeoAreaParentagePK
  com.acme.cache.domain.GeoAreaParentage
  com.acme.cache.domain.GeoAreaNameAlia
  com.acme.cache.domain.GeoAreaCodeAlia
  com.acme.cache.domain.BdaConnectorGeoSitePK
  com.acme.cache.domain.BdaConnectorGeoSite
  com.acme.cache.domain.BdaConnectorGeoAreaPK
  com.acme.cache.domain.BdaConnectorGeoArea
  
   
   
   
   
    
    
   
   
   
   

   

  

 








Here http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd you have the XSD, you can notice it's pathetically generic.

Funny errors while using the OSB console

Could not deserialize session data. java.io.NotSerializableException: com.bea.console.taglib.html.model.TableModel





followed by


Could not deserialize session data.
java.lang.ClassCastException: cannot assign instance of com.bea.console.handles.JMXHandle to field com.bea.console.actionforms.ConsoleValidatorForm.handle of type com.bea.console.handles.Handle in instance of com.bea.console.actionforms.app.update.Form
 at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2032)
 at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1212)
 at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1953)
 at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
 at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
 at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
 at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
 at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
 at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
 at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
 at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
 at weblogic.common.internal.PassivationUtils.toObject(PassivationUtils.java:54)
 at weblogic.common.internal.PassivationUtils.toObject(PassivationUtils.java:46)
 at weblogic.common.internal.PassivationUtils.copy(PassivationUtils.java:64)
 at weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:93)
 at weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:43)
 at weblogic.servlet.internal.session.SessionData.getAttribute(SessionData.java:404)
 at weblogic.servlet.internal.ServletRequestImpl$SessionHelper.updateSessionId(ServletRequestImpl.java:2951)
 at weblogic.servlet.security.internal.SecurityModule.generateNewSession(SecurityModule.java:304)
 at weblogic.servlet.security.internal.SecurityModule.login(SecurityModule.java:291)
 at weblogic.servlet.security.internal.FormSecurityModule.processJSecurityCheck(FormSecurityModule.java:285)
 at weblogic.servlet.security.internal.FormSecurityModule.checkUserPerm(FormSecurityModule.java:209)
 at weblogic.servlet.security.internal.FormSecurityModule.checkAccess(FormSecurityModule.java:92)
 at weblogic.servlet.security.internal.ServletSecurityManager.checkAccess(ServletSecurityManager.java:82)
 at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2204)
 at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
 at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
 at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)




never seen before.... trying to identify the cause....

Tuesday, August 10, 2010

Error creating logFile: EmbeddedLDAP.log (Permission denied)

This is what happens when you forget that you are root and you start weblogic (never install and run weblogic as root!).... the access rights of some files get changed...

this
chown -R osbuser /path/to/your/domain
run as root

should bring you back to normal life

Sunday, August 8, 2010

WSDL Generation with Groovy

I am fed up of crafting WSDL by hand, it's mostly fluff and it can be generated from a template.

I don't like template languages like Velocity either.

So I have decided to generate my WSDL in Grovvy.

I have installed the Eclipse Plugin:
http://dist.springsource.org/release/GRECLIPSE/e3.5/

or
http://dist.springsource.org/release/GRECLIPSE/e3.6/



Here a good example of how to parse XML with Groovy:
http://groovy.codehaus.org/Reading+XML+using+Groovy%27s+XmlParser

The XML defining the service is:


GeoServicePS
1
../XSD/GEO_OSB_EJBSchema.xsd

 getCitiesByLikeCityName
 getLocationsByName
 getLocationsByLocationIds




First create a Groovy Project, then a Groovy class - this is only a POC on how to parse XML:


class WSDLGenerator {

 static main(args) {
  File file = new File("resources/geowsdl.xml");
  def records = new XmlParser().parseText(file.getText());
  def servicename = records.servicename.text();
  def version = records.version.text();
  def schemalocation = records.schemalocation.text();
  def operations = records.operations;
  for (operation in operations.operation) {
   println operation.text();
  }
 }
}



It's as simple as that! In Java it would have taken me 5 times more code!

I will never edit manually a WSDL again, all you need is a XSD with your domain model, and you can generate the blessed WSDL by script.

Wednesday, August 4, 2010

Fedora updates

Flash Player:

yum install flash-plugin nspluginwrapper alsa-plugins-pulseaudio libcurl


Wine:

yum upgrade
yum --enablerepo=updates-testing upgrade wine
yum install wine

SqlDeveloper:

rpm -Uhv sqldeveloper-2.1.1.64.45-1.noarch.rpm



DNS:

vi /etc/resolv.conf

domain localdomain
search localdomain
nameserver 192.168.232.2





The brain that changes itself




http://www.normandoidge.com/normandoidge/MAIN.html


I am really enjoying this book, providing infinite insights in the inner working of human (and other animals) brain.

I wish some neuroscientist could spend some time in a development floor, and write about his findings on the mental and social mechanisms involved in IT team work ... it would be so fascinating to understand what makes us tick and why IT projects are so often completely f...ed up because of personal and interpersonal behavioral and psychological issues.

Sunday, August 1, 2010

UBRUNTUS vs WIDOWS

After a virus has contaminated several machines in the organization, many of us have installed a dual partition system with UBUNTU and Windows XP 32 bits. Actually most people have wiped out Windows altogether.

Everyone else chose UBUNTU 32 bits, I have installed the 64 bits version, which seems quite stable and happily addresses all my 6 GB RAM.

In UBUNTU we run a VMWare virtual machine (4 GB Ram) running Fedora and Weblogic + OSB 11. It's a bit slower, but it has the great advantage that I can make a backup every day and we can replicate a new dev env in seconds.

The title is because a friend of mine always call it UBRUNTU, plus it reminds me Julius Caesar and Brutus. WIDOWS because men commit suicide for the depression of using Windows.

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