This discussion is archived
6 Replies Latest reply: Dec 10, 2012 7:55 AM by Tom B RSS

After moving from weblogic 10.0.0 to Weblogic 10.3.3 - JMSException

978074 Newbie
Currently Being Moderated
After moving from weblogic 10.0.0 to Weblogic 10.3.3, web-application began to raise next exception:
<Dec 4, 2012 3:52:05 PM CET> <Error> <HTTP> <pl-1> <traffic-1> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1354632725104> <BEA-101017> <[ServletContext@518010907[app:XXXX-XXXX module:/XXXXXX-connector-servlet path:/XXXXXX-connector-servlet spec-version:2.5]] Root cause of ServletException.
javax.jms.JMSException: [JMSPool:169801]The JMS method setMessageListener may not be called inside an EJB or servlet
at weblogic.deployment.jms.JMSExceptions.getJMSException(JMSExceptions.java:22)
at weblogic.deployment.jms.WrappedMessageConsumer.preInvocationHandler(WrappedMessageConsumer.java:116)
at weblogic.deployment.jms.WrappedMessageConsumer_weblogic_jms_client_WLConsumerImpl.setMessageListener(Unknown Source)
at XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.createAndStart(OperatorMessageSession.java:174)
at XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.getWork(XXXXXXXXXServlet.java:265)
at XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.doRequest(XXXXXXXXXServlet.java:168)
at weblogic.servlet.http.AbstractAsyncServlet.service(AbstractAsyncServlet.java:100)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3700)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3664)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2276)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2175)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1452)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

Could anybody help me with this problem? Maybe there are any standard ways to fix this?
  • 1. Re: After moving from weblogic 10.0.0 to Weblogic 10.3.3 - JMSException
    Tom B Expert
    Currently Being Moderated
    Hi,

    The Java EE specification specifically disallows setting up asynchronous JMS listeners on a Java EE application server, and instead supplies MDBs for the purpose. WebLogic MDBs have multiple benefits in comparison to a vanilla async listener, and its highly recommended that they be leveraged. Benefits include control over concurrency, security, automatic reconnect after any error, transparent handling of distributed destinations, and extremely wide adoption by a broad customer base for over ten years.

    It's possible to bypass the check that's throwing the exception by changing your app code's Connection Factory resource reference to be of type java.lang.Object instead of javax.jms.[XA]ConnectionFactory, or by not using a resource reference at all, but this its not assured Oracle will be able to support any problems you might run into, plus this disables the JMS resource reference machinery (which provides pooling, security help, and XA enlist of foreign, etc).

    Tom
  • 2. Re: After moving from weblogic 10.0.0 to Weblogic 10.3.3 - JMSException
    978074 Newbie
    Currently Being Moderated
    Hello Tom,

    Big thanks for your support. Could you please answer one more question? Is there any ways to force Weblogic 10.3 to restrict JavaEE to version 1.4 (in our case for backward compatibility)?

    BR, Ilya
  • 3. Re: After moving from weblogic 10.0.0 to Weblogic 10.3.3 - JMSException
    Tom B Expert
    Currently Being Moderated
    Big thanks for your support. Could you please answer one more question? Is there any ways to force Weblogic 10.3 to restrict JavaEE to version 1.4 (in our case for backward compatibility)?
    I don't know the answer off the top of my head. If no-one can answer your question, you might try posting to the ejb or generic WL forum.
  • 4. Re: After moving from weblogic 10.0.0 to Weblogic 10.3.3 - JMSException
    Jeets Journeyer
    Currently Being Moderated
    user11282402 wrote:
    Hello Tom,

    Big thanks for your support. Could you please answer one more question? Is there any ways to force Weblogic 10.3 to restrict JavaEE to version 1.4 (in our case for backward compatibility)?

    BR, Ilya
    In first place, weblogic do allow backward compatibility, unless there is major change in API. As we all know that there is no default JEE implementation provided by the JDK, it is weblogic who is implementing the interface in this case.

    So it is highly risk and guess not possible to change the JEE implementation, as it might(not sure) cause issues with other APIs running on weblogic.
  • 5. Re: After moving from weblogic 10.0.0 to Weblogic 10.3.3 - JMSException
    978074 Newbie
    Currently Being Moderated
    I've rebuilt my web-application using MDB. For now I got new exception:
    ####<07.12.2012 16:03:06 FET> <Info> <EJB> <pc-XXXXXX> <AdminServer> <[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <BEA1-00340877198035A73969> <> <1354885386932> <BEA-010227> <EJB Exception occurred during invocation from home or business: weblogic.ejb.container.internal.StatelessEJBHomeImpl@14df37f threw exception: javax.ejb.EJBTransactionRolledbackException: EJB Exception: : java.lang.ClassCastException: com.XXX.XXXX.XXXXXX.persistence.OperatorBean cannot be cast to com.XXX.XXXX.XXXXXX.persistence.SwitchboardBean
         at com.XXX.XXXX.XXXXXX.SwitchboardDataImpl.initialize(SwitchboardDataImpl.java:147) // itsSwitchboardBean = itsEntityManager.find(SwitchboardBean.class, switchboardNumber);
         at com.XXX.XXXX.XXXXXX.SwitchboardDataImpl.create(SwitchboardDataImpl.java:86)
         at com.XXX.XXXX.XXXXXX.SwitchboardDataEJB.create(SwitchboardDataEJB.java:64)

    persistence.xml:
    ...     <persistence-unit name="xxxSwitchboard_PU" transaction-type="JTA">
              <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <jta-data-source>jdbc/xxSwitchboard</jta-data-source>
    <non-jta-data-source>jdbc/xxSwitchboard</non-jta-data-source>
              <class>com.XXX.XXXX.XXXXXX.switchboard.persistence.OwnerBean</class>
              <class>com.XXX.XXXX.XXXXXX.switchboard.persistence.OperatorBean</class>
              <class>com.XXX.XXXX.XXXXXX.switchboard.persistence.SwitchboardBean</class>
              <class>com.XXX.XXXX.XXXXXX.switchboard.persistence.CallBean</class>
              <exclude-unlisted-classes>false</exclude-unlisted-classes>
         </persistence-unit>...


    @Entity
    public class OperatorBean extends OwnerBean
    {
    @ManyToOne(optional = true, fetch = FetchType.EAGER)
    private SwitchboardBean switchboard;
    ....


    @Entity
    public class SwitchboardBean extends OwnerBean
    {
    @OneToMany(mappedBy = "switchboard", cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
    private List<OperatorBean> itsOperators = new ArrayList<OperatorBean>();
    ...


    Seems that it also happened due to updating weblogic version. Could you please advice me how to fix this issue?
  • 6. Re: After moving from weblogic 10.0.0 to Weblogic 10.3.3 - JMSException
    Tom B Expert
    Currently Being Moderated
    This looks like its unrelated to JMS. You might want to try posting to the EJB newsgroup.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points