[JBoss AOP] - Re: intercept TransactionManager->commit()
by flavia.rainone
It is not possible to intercept javax.transaction.TransactionManager, since, in this case, you want to intercept the execution of commit.
But TransactionManager is an interface, and does not have a commit body to be intercepted.
So, if you wanted to do this, you would need to intercept a specific class, whose name you don't know, of the application server you're using. But, to intercept the execution of this class' commit method, you would need security permission to do that.
This means that you can't do this with AOP.
But can't you use the hooks on javax.ejb.SessionSynchronization interface?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991715#3991715
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991715
19 years, 4 months
[EJB 3.0] - EJB Annotation question?
by jxcheng
I deployed and tested a simple EJB 3.0 program successfully with JBOSS 4.05.
The following code use JNDI lookup works fine.
| Hashtable<String,String> h= new Hashtable<String,String>();
| h.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
| h.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
| h.put(Context.PROVIDER_URL, "localhost");
|
| InitialContext ctx = new InitialContext(h);
|
| WordReverse wr = (WordReverse) ctx.lookup("/WordReverseBean/remote");
|
| wr.getReversedWorld("test")
|
However, I have problems using EJB annotation. The following code compiles fine. but run into run-time Exception
Exception in thread "main" java.lang.NullPointerException
It complains that the instance variable wr is NULL. I tried different attribute values for the EJB annotation without sucsess.
| @EJB(mappedName="jnp://localhost:1099/WordReverseBean/remote")
| //@EJB(beanName="WordReverseBean")
| //@EJB
| private static WordReverse wr;
|
| public static void main(String[] args) throws NamingException{
|
| ...
| wr.getReversedWorld("test")
| ...
|
Could anyone help here?
Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991714#3991714
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991714
19 years, 4 months