[EJB 3.0 Development] New message: "Re: Lookup to java:comp/EJBContext during postconstruction"
by jaikiran pai
User development,
A new message was posted in the thread "Lookup to java:comp/EJBContext during postconstruction":
http://community.jboss.org/message/530932#530932
Author : jaikiran pai
Profile : http://community.jboss.org/people/jaikiran
Message:
--------------------------------------------------------------
> marius.bogoevici wrote:
>
>
> public class MilkMan implements MessageListener
> {
>
> @PostConstruct
> public void doAfterConstruction()
> {
> try
> {
> Context context = ((Context) new InitialContext().lookup("java:comp/EJBContext"));
> }
> catch (NamingException e)
> {
> e.printStackTrace();
> }
> }
>
>
> }
>
>
>
> Now, I would really like to know whether this assessment is corect and if that is something that is essentially expected to happen given the circumstances. If this is expected behaviour, then I think that we could work around this by treating EJBContext distinctly when injecting resources, but if not, then what would you think that would be the appropriate solution for doing a correct lookup for the purposes of CDI/Weld integration?
It shouldn't fail. If it's failing, then it's a bug (looks like similar to the one we just fixed for EAP-4.x version). And i don't think it's specific to the EJBContext. I guess it will fail for anything under java:comp for that bean. Can you give a quick try by looking up something else under java:comp from within the @Postconstruct of MDB?
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/530932#530932
16 years, 2 months
[EJB 3.0] New message: "Sharing an MDB class between multiple ejb jars"
by Emjay Khan
User development,
A new message was posted in the thread "Sharing an MDB class between multiple ejb jars":
http://community.jboss.org/message/530931#530931
Author : Emjay Khan
Profile : http://community.jboss.org/people/mjkhan21
Message:
--------------------------------------------------------------
Hello, all.
I want to share an MDB class between 2 ejb jars.
Specifically, I have an MDB class, say QListener.class,
and it handles messages arriving on the 'queue/app0-job' destination.
It is packaged and deployed in the app0-ejb.jar file,
and it works nicely.
A while later, I decide to reuse the MDB class for another application
and have it listen to the 'queue/app1-job' destination.
The application is deployed in the app1-ejb.jar file.
app0-ejb and app1-ejb are supposed to be deployed together on a JBoss.
Can I do this?
The MDB and other EJBs are written in EJB3
and the JBoss is 4.2.2.
Any adivce would be appreciated.
Thanks in advance.
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/530931#530931
16 years, 2 months
[EJB 3.0 Development] New message: "Lookup to java:comp/EJBContext during postconstruction"
by Marius Bogoevici
User development,
A new message was posted in the thread "Lookup to java:comp/EJBContext during postconstruction":
http://community.jboss.org/message/530930#530930
Author : Marius Bogoevici
Profile : http://community.jboss.org/people/marius.bogoevici
Message:
--------------------------------------------------------------
I will just refer to the problem indicated in http://seamframework.org/Community/TheMessageDrivenBeanSagaContinues
While a CDI problem per se, it seems like doing this:
@MessageDriven(activationConfig={
@ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
@ActivationConfigProperty(propertyName="destination", propertyValue="queue/testQueue")
})
public class MilkMan implements MessageListener
{
@PostConstruct
public void doAfterConstruction()
{
try
{
Context context = ((Context) new InitialContext().lookup("java:comp/EJBContext"));
}
catch (NamingException e)
{
e.printStackTrace();
}
}
@Inject Control control;
public void onMessage(Message message)
{
try
{
control.setMessageDelivered(((TextMessage) message).getText().equals(EJBTest.MESSAGE));
}
catch (JMSException e)
{
throw new RuntimeException(e);
}
}
}
will cause the deployment to fail, since doing that lookup from within the postconstructor does not get all the expected interceptors applied. Of course, this is not how exactly we intent to use this from Weld, but doing injection of resources during postconstruction has a similar effect.
Now, I would really like to know whether this assessment is corect and if that is something that is essentially expected to happen given the circumstances. If this is expected behaviour, then I think that we could work around this by treating EJBContext distinctly when injecting resources, but if not, then what would you think that would be the appropriate solution for doing a correct lookup for the purposes of CDI/Weld integration?
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/530930#530930
16 years, 2 months