File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes Issue with MDB and weblogic 9.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Issue with MDB and weblogic 9.2" Watch "Issue with MDB and weblogic 9.2" New topic
Author

Issue with MDB and weblogic 9.2

Manoj Raghuwanshi
Ranch Hand

Joined: Jun 20, 2004
Posts: 75
Hi all...

I'm facing a strange kind of problem with MDB using weblogic 9.2
The code worked perfectly in weblogic 8.1
This is wht i'm trying to achieve..
i'm having a MDB which implements a onMessage().
I'm publishing message thru a standalone client. Publishing works fine..
The problem is onMessage(javax.jms.Message msg) is never been called .
when i monitor it shows that messages are recieved..
Am is missing something that is really important..

Here is my code ,

public class PaymentProcessorBean implements MessageDrivenBean, MessageListener {

public PaymentProcessorBean() {
super();
// TODO Auto-generated constructor stub
}

public void setMessageDrivenContext(MessageDrivenContext ctx)
throws EJBException {
// TODO Auto-generated method stub

}

public void ejbRemove() throws EJBException {
// TODO Auto-generated method stub

}

public void onMessage(Message message) {
ObjectMessage objMsg=(ObjectMessage)message;
try {
System.out.println(message);
} catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}


here are the 2 xml files....

<message-driven >
<description><![CDATA[Description for PaymentProcessor]]></description>
<display-name>Name for PaymentProcessor</display-name>

<ejb-name>PaymentProcessor</ejb-name>

<ejb-class>com.exo.epayment.ejb.PaymentProcessorBean</ejb-class>

<transaction-type>Container</transaction-type>
<acknowledge-mode>Auto-acknowledge</acknowledge-mode>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>

</message-driven>



<weblogic-ejb-jar>

<weblogic-enterprise-bean>
<ejb-name>PaymentProcessor</ejb-name>
<message-driven-descriptor>
<pool>
<max-beans-in-free-pool>10</max-beans-in-free-pool>
<initial-beans-in-free-pool>2</initial-beans-in-free-pool>
</pool>
<destination-jndi-name>jms/JMSQueue</destination-jndi-name>
<initial-context-factory>weblogic.jndi.WLInitialContextFactory</initial-context-factory>
<provider-url>t3://localhost:7001</provider-url>
<connection-factory-jndi-name>jms/JMSConnectionFactory</connection-factory-jndi-name>
<jms-polling-interval-seconds>20</jms-polling-interval-seconds>
</message-driven-descriptor>
<jndi-name>PaymentProcessor</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>


Am i missing something somewhere???
any help in this is highly appreciated..

thanks in advance.

Manoj
Manoj Raghuwanshi
Ranch Hand

Joined: Jun 20, 2004
Posts: 75
solved the problem. I thought weblogic will deploy the EJB as soon as it is uploaded to server but you need to start the ejb from admin console.
Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
Hi Manoj,

I am having the same problem and I figured that I need to Initialize the MDB explicitly. It keeps showing me that MDB status is "initializing".

When I tried to Resume or Suspend the MDB, it told me "the destination is not available".

It is strange to say that the destination is not available as my producer can submit successfully to the Queue destination and I confirm that by checking the console and seeing that a new message is now in the queue.

Following are the settings on WLS 9.2:
JMS Module :
Name Type JNDI Name Subdeployment Targets
BatchQueue Queue ebp/jms/qd/BatchQueue JMS eBPJMSServer

Here are my MDB deployment descriptor excerpts:
-- ejb-jar.xml


-- weblogic-ejb-jar.xml



Where else can I look given the above ?


<b><i>KaReEm</i><br /><ul type="square"><li>SCJP-Free Range Web Developer <br /></ul></b>
Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
Hi Manoj,

I am having the same problem and I figured that I need to Initialize the MDB explicitly. It keeps showing me that MDB status is "initializing".

When I tried to Resume or Suspend the MDB, it told me "the destination is not available".

It is strange to say that the destination is not available as my producer can submit successfully to the Queue destination and I confirm that by checking the console and seeing that a new message is now in the queue.

Following are the settings on WLS 9.2:
JMS Module :
Name Type JNDI Name Subdeployment Targets
BatchQueue Queue ebp/jms/qd/BatchQueue JMS eBPJMSServer

Here are my MDB deployment descriptor excerpts:
-- ejb-jar.xml


-- weblogic-ejb-jar.xml



Where else can I look given the above ?
Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
I realize this must be quite late, but just in case nobody ever got a work around for this, this is how we figured it out here.

On WLS9.2 you need to create the JMS store / server / queues while the server still does not have any application that is trying to consume these resources. Meaning, you should create all your JMS stuff on the server, do a restart to ensure freshness of the configuration, then deploy your EAR/WAR/JARs that consume the JMS resources.

Note : It was quite a while back but just remembered to update this post when someone asked me from another team.
 
jQuery in Action, 2nd edition
 
subject: Issue with MDB and weblogic 9.2
 
Similar Threads
Need Clarification - MDBs with topic
Message Driven Bean reading multiple times from a jms queue
WL guru's - message bean not receiving messages from JMS
Problem integrating Weblogic 8.1 with Sonic MQ 6.1
MDB onMessage() not firing....Help needed please!