Adam Bien's Weblog

Tuesday Jun 10, 2008

How To Get Rid Of: com.sun.messaging.jmq.io.Packet cannot be cast to com.sun.messaging.jms.ra.DirectPacket in Glassfish V2.X

If you are running Glassfish and using JMS (e.g. a Message Driven Bean), you probably saw already the following error in the log files: DirectConsumer:Caught Exception delivering messagecom.sun.messaging.jmq.io.Packet cannot be cast to com.sun.messaging.jms.ra.DirectPacket.

The error is caused by directly embedding the JMS-Host into Glassfish v2 - it can be easily fixed in the admin console:

 

  1. Open the admin console: http://localhost:4848
  2. Select: Configuration -> Java Message Service node in the tree on the left side.
  3. Change the type from "Embedded" into "Local". The doc says:
    "Choose LOCAL (the default for the server-config configuration) to access the JMS service on the local host. The JMS service is started and managed by the Application Server."
  4. Restart Glassfish
This will cause the openmq.dev.java.net runtime to run out-of-process locally, and not in embedded mode. This fixes the classpath problem.


[my tweets]  Rss My book: Real World Java EE - Rethinking Best Practices

Kommentare:

Thanks, Adam,
I've just stepped into this trap!

Gesendet von Bernd Zimmermann am June 10, 2008 at 12:17 PM CEST #

Running Glassfish on UBUNTU Linux (probably on other distributions too) I had to do a little more to get type "LOCAL" broker running.

in <glassfish_home>/imq/etc/imqenv.con I found these lines causing problems when GF wants to start the broker:

IMQ_DEFAULT_EXT_JARS=/opt/SUNWhadb/4/lib/hadbjdbc4.jar:/opt/SUNWjavadb/derby.jar:/usr/share/java/postgresql.jar
set IMQ_DEFAULT_JAVAHOME=/usr/lib/jvm/java-6-sun
set IMQ_DEFAULT_VARHOME=/home/bernd/glassfish-v2ur2/domains/domain1/imq

Here 'set' is the problem - because it is not Linux bash compatible.

After removing 'set' the environment vars got assigned as supposed and GF starts without complaining about port 7676 connections.

Cheers,
Bernd

Gesendet von Bernd Zimmermann am June 10, 2008 at 08:51 PM CEST #

No more warnings now. Thanx for the tip.
BG

Gesendet von Bogdan am December 12, 2008 at 12:46 PM CET #

Thanks alot ! I experienced the same problem, do a quick search and found this articles. Problemo solved

Gesendet von Fikri am December 14, 2008 at 07:02 AM CET #

http://www.adam-bien.com/roller/abien/entry/how_to_get_rid_of

Danke schön

Hank.

Gesendet von Hank Burkhalter am March 04, 2009 at 02:30 AM CET #

Thanks alot, it helped!

Gesendet von 194.236.14.138 am May 07, 2009 at 10:18 AM CEST #

Senden Sie einen Kommentar:
  • HTML Syntax: Ausgeschaltet
Meta-stuff / Interviews
My Recent Book
Java One 2009
CommunityOne East N.Y.C
JavaONE 2008 Interview
Search
...the last 150 posts
...the last 10 comments
greenfire.dev.java.net
Links
my.netbeans.org
Visitors
License