How to resolve java.lang.ClassCatException - Websphere

This is a discussion on How to resolve java.lang.ClassCatException - Websphere ; Hi Im using WAS 6.1.0.21 and WebSphere MQ 6.0. Whenever my application tries to execute *createQueueConnection()* statement, it throws ClassCastException. The SystemOut.logs are as follows: java.lang.ClassCastException: java.lang.UnsatisfiedLinkError incompatible with java.lang.Exception The SystemErr.log are as follows: java.lang.UnsatisfiedLinkError: mqjbnd05 (Not found in ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: How to resolve java.lang.ClassCatException

  1. How to resolve java.lang.ClassCatException

    Hi Im using WAS 6.1.0.21 and WebSphere MQ 6.0. Whenever my application tries to execute *createQueueConnection()* statement, it throws ClassCastException.
    The SystemOut.logs are as follows:
    java.lang.ClassCastException: java.lang.UnsatisfiedLinkError incompatible with java.lang.Exception

    The SystemErr.log are as follows:
    java.lang.UnsatisfiedLinkError: mqjbnd05 (Not found in java.library.path)
    at java.lang.ClassLoader.loadLibraryWithPath(ClassLoa der.java:986)
    at java.lang.ClassLoader.loadLibraryWithClassLoader(C lassLoader.java:950)
    at java.lang.System.loadLibrary(System.java:453)
    at com.ibm.mq.MQSESSION.loadLib(MQSESSION.java:1028)
    at com.ibm.mq.server.MQSESSION$1.run(MQSESSION.java:2 46)
    at java.security.AccessController.doPrivileged(Access Controller.java:197)
    at com.ibm.mq.server.MQSESSION. (MQSESSION.java:243)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    at java.lang.J9VMInternals.initialize(J9VMInternals.j ava:194)
    at com.ibm.mq.MQSESSIONServer.getMQSESSION(MQSESSIONS erver.java:68)
    at com.ibm.mq.MQSESSION.getSession(MQSESSION.java:508 )



    java.lang.NoClassDefFoundError: com.ibm.mq.server.MQSESSION (initialization failure)
    at java.lang.J9VMInternals.initialize(J9VMInternals.j ava:132)
    at com.ibm.mq.MQSESSIONServer.getMQSESSION(MQSESSIONS erver.java:68)
    at com.ibm.mq.MQSESSION.getSession(MQSESSION.java:508 )
    at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnec tionJ11.java:213)
    at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11._ createManagedConnection(MQBindingsManagedConnectio nFactoryJ11.java:186)

    Im really stuck up with this pblm and need an urgent solution.
    Thanks in advance.

  2. Re: How to resolve java.lang.ClassCatException

    iwanturhelp@gmail.com wrote:
    > Hi Im using WAS 6.1.0.21 and WebSphere MQ 6.0. Whenever my application tries to execute *createQueueConnection()* statement, it throws ClassCastException.
    > The SystemOut.logs are as follows:
    > java.lang.ClassCastException: java.lang.UnsatisfiedLinkError incompatible with java.lang.Exception
    >
    > The SystemErr.log are as follows:
    > java.lang.UnsatisfiedLinkError: mqjbnd05 (Not found in java.library.path)
    > at java.lang.ClassLoader.loadLibraryWithPath(ClassLoa der.java:986)
    > at java.lang.ClassLoader.loadLibraryWithClassLoader(C lassLoader.java:950)
    > at java.lang.System.loadLibrary(System.java:453)
    > at com.ibm.mq.MQSESSION.loadLib(MQSESSION.java:1028)
    > at com.ibm.mq.server.MQSESSION$1.run(MQSESSION.java:2 46)
    > at java.security.AccessController.doPrivileged(Access Controller.java:197)
    > at com.ibm.mq.server.MQSESSION. (MQSESSION.java:243)
    > at java.lang.J9VMInternals.initializeImpl(Native Method)
    > at java.lang.J9VMInternals.initialize(J9VMInternals.j ava:194)
    > at com.ibm.mq.MQSESSIONServer.getMQSESSION(MQSESSIONS erver.java:68)
    > at com.ibm.mq.MQSESSION.getSession(MQSESSION.java:508 )
    >
    >
    >
    > java.lang.NoClassDefFoundError: com.ibm.mq.server.MQSESSION (initialization failure)
    > at java.lang.J9VMInternals.initialize(J9VMInternals.j ava:132)
    > at com.ibm.mq.MQSESSIONServer.getMQSESSION(MQSESSIONS erver.java:68)
    > at com.ibm.mq.MQSESSION.getSession(MQSESSION.java:508 )
    > at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnec tionJ11.java:213)
    > at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11._ createManagedConnection(MQBindingsManagedConnectio nFactoryJ11.java:186)
    >
    > Im really stuck up with this pblm and need an urgent solution.
    > Thanks in advance.


    UnsatisfiedLinkError means that the named shared library (mqjbnd05.so or
    ..dll) is not on the process's PATH. Easiest way to fix this is to create
    a shared library containing the above file, and add a classloader to
    your server with this shared library.

    Ken

  3. Re: How to resolve java.lang.ClassCatException

    Do you have the stack trace for the ClassCastException? I would guess that there is some logic somewhere that is catching the UnsatisfiedLinkError and trying to cast it to a java.lang.Exception. Instead, it should probably cast it to a java.lang.Throwable or create a new Exception and pass the UnsatisfiedLinkError as the cause. UnsatisfiedLinkErrors do not inherit from Exception, they inherit from Error (both Exception and Error inherit from Throwable so one cannot be casted to another).

    It looks like the root of the problem is due to a missing native library for MQ. Because WAS cannot find this native library, it cannot complete the initialization of the MQSESSION class. This sounds like it would prevent MQ from working at all. I'm not MQ expert, but you could probably resolve this problem by including the MQ libraries in the native classpath for WAS.

    Hope this helps,

    Andy

  4. Re: How to resolve java.lang.ClassCatException

    Hi.

    Assuming you are trying to create a bindings mode connection you need to set the MQ_INSTALL_ROOT variable. If you search for MQ_INSTALL_ROOT in the forums you will get the instructions you need. Alternatively use a client mode connection.

    Cheers, Matt.

  5. Re: How to resolve java.lang.ClassCatException

    Hi,
    I created a Websphere variable at server scope ie MQ_INSTALL_ROOT and pointed the instrallation path of mqm.
    This resolved the problem.
    Thanx alot.

+ Reply to Thread