Friday, July 6, 2012

Thank God I belong to another generation

Does anyone actually talk to one another

Grab a cup of coffee



Dine out at your favorite restaurant


Spend some time at the museum



Meet at a popular diner



Relax at the beach


Go to a game


Going out on a date


Take a drive around town




But, no worries, the wireless network is on the brink of a planetarian collapse for lack of investments and for forthcoming energy blackouts, so we shall revert soon to more traditional, less power-hungry and less abstract ways to communicate.

Tuesday, July 3, 2012

WebLogic, move JMS messages in Java

Here how to move JMS messages in WLST http://www.javamonamour.org/2011/09/wlst-move-jms-messages.html


Here the Javadoc of the JMSDestinationRuntimeMBean.moveMessages():

http://docs.oracle.com/cd/E24001_01/apirefs.1111/e13951/mbeans/JMSDestinationRuntimeMBean.html?skipReload=true#moveMessages



selector is "JMSMessageID = '${jmsmessageid}'"

javax.management.openmbean.CompositeData you can get it with the JMSDestinationRuntimeMBean.getDestinationInfo() method.



So this code will work:

// ctx is a proper InitialContext

  String destinationJNDI = request.getParameter("destinationJNDI");
  String intermediateJNDI = destinationJNDI.replace("ReprocessQ", "Q");
  String jmsmessageid = request.getParameter("jmsmessageid");
  javax.jms.Queue queue = (javax.jms.Queue) ctx.lookup(destinationJNDI);
  javax.jms.Queue intermediateQueue = (javax.jms.Queue) ctx.lookup(intermediateJNDI);
    
  // lookup the queue connection factory
  QueueConnectionFactory queueConnFactory = (QueueConnectionFactory) ctx.lookup(WEBLOGIC_JMS_XA_CONNECTION_FACTORY);
  // create a queue connection
  QueueConnection queueConn = queueConnFactory.createQueueConnection();
  // create a queue session
  Session queueSession = queueConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
  
  // start the connection
  queueConn.start();
  
  JMSDestinationRuntimeMBean reprocessQueueMBean = JMSRuntimeHelper.getJMSDestinationRuntimeMBean( ctx, queue);
  JMSDestinationRuntimeMBean intermediateQueueMBean = JMSRuntimeHelper.getJMSDestinationRuntimeMBean( ctx, intermediateQueue);
  // see http://docs.oracle.com/cd/E24001_01/apirefs.1111/e13951/mbeans/JMSDestinationRuntimeMBean.html?skipReload=true#moveMessages
  reprocessQueueMBean.moveMessages("JMSMessageID = '" + jmsmessageid + "'", intermediateQueueMBean.getDestinationInfo());




Monday, July 2, 2012

weblogic.security.acl.internal.AuthenticatedSubject and weblogic.security.acl.internal.AuthenticatedUser

today I had this REALLY weird error in Tomcat.... it turned out that having weblogic.jar AND wlfullclient.jar in the classpath is NOT good...


java.lang.ClassCastException: weblogic.security.acl.internal.AuthenticatedSubject cannot be cast to weblogic.security.acl.internal.AuthenticatedUser
weblogic.common.internal.RMIBootServiceImpl_1035_WLStub.authenticate(Unknown Source)
weblogic.security.acl.internal.RemoteAuthenticate$1.run(RemoteAuthenticate.java:72)
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
weblogic.security.acl.internal.RemoteAuthenticate.authenticate(RemoteAuthenticate.java:68)
weblogic.jndi.WLInitialContextFactoryDelegate.authenticateRemotely(WLInitialContextFactoryDelegate.java:747)
weblogic.jndi.WLInitialContextFactoryDelegate.pushSubject(WLInitialContextFactoryDelegate.java:679)
weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:469)
weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:376)
weblogic.jndi.Environment.getContext(Environment.java:315)
weblogic.jndi.Environment.getContext(Environment.java:285)
weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
javax.naming.InitialContext.init(InitialContext.java:223)
javax.naming.InitialContext.(InitialContext.java:197)