Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within EJB and other Jakarta /Java EE Technologies
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
EJB and other Jakarta /Java EE Technologies
JBoss 5.1 ejbCreate method not called on mdb
M. Phaneendra Vijay
Greenhorn
Posts: 26
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
Could anyone tell me, why ejbCreate method is NOT called on MDB in
JBoss
5.1.0 for
EJB
3.0. The same code worked in weblogic 10.
Please find the code below
package com.pyro.reader; import javax.ejb.ActivationConfigProperty; import javax.ejb.CreateException; import javax.ejb.EJBException; import javax.ejb.MessageDriven; import javax.ejb.MessageDrivenBean; import javax.ejb.MessageDrivenContext; import javax.jms.*; @MessageDriven(mappedName = "SampleQueue", activationConfig = { @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/SampleQueue"), @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")}) public class Reader implements MessageListener, MessageDrivenBean { static int totalMessageCount = 0; public Reader() { System.out.println("Reader() constructor"); } public void ejbCreate() throws CreateException { System.out.println("*****************************Reader ejbCreate() called"); } public void onMessage(Message message) { TextMessage msg = (TextMessage) message; String requestReceived = null; try { requestReceived = msg.getText(); totalMessageCount++; System.out.println(totalMessageCount + ", " + requestReceived); } catch (JMSException ex) { ex.printStackTrace(); } } public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException { System.out.println("setMessageDrivenContext()" + ctx); } public void ejbRemove() throws EJBException { System.out.println("ejbRemove()"); } }
Jaikiran Pai
Sheriff
Posts: 10445
227
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
This was a bug
https://issues.jboss.org/browse/EJBTHREE-2160
in JBoss AS which got fixed in JBoss AS 6.0.0.Final. Try upgrading to 6.0.0.Final of JBoss AS.
[
My Blog
] [
JavaRanch Journal
]
M. Phaneendra Vijay
Greenhorn
Posts: 26
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I got it working. Annotate the ejbCreate method with @PostConstruct. It works!!!
@PostConstruct public void ejbCreate() throws CreateException { System.out.println("*****************************Reader ejbCreate() called"); }
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Associate Same Mdb file to multiple queue in Ejb3 jboss 5.x server
Query about MDB throwing application exception
setMessageDrivenContext() doubt
my MDB does not recives any messages
I can't see ejbCreat(),ejbRemove or initialize() methods in this MDB.
More...