简体   繁体   中英

EJB Lookup works, but method call don't

I have an instance of a JBoss EAP 6.1 where i deployed 2 EJB applications. The server starts without errors!

Now I have created a javaSE application to call these EJBs.

And here is the problem...

If I make lookup of EJB from applicationA/EJBBean!br.com.sample.EJBRemote it works fine, and I can call any method form it.

But, I make lookup of EJB from applicationB/EJBBean!br.com.sample.EJBRemote it works fine to. But, when I call a method, the javaSE application stops. I got no errors, no outputs. I put a breakpoint on first line of the method implementation and i saw that is not executed.

My lookup code is following:

public static <T> T getEJB(final String moduleName, final String beanName, final Class<T> viewClass) throws NamingException {
    final String lookupName = aplicationName + "/" + beanName + "!" + viewClass.getName();
    return (T) ic.lookup(lookupName);
}

I call this from a main method:

 final MyRemote beanA = EJBUtils.getEJB("appA", "MyBean", MyRemote.class);
 final MyRemote beanB = EJBUtils.getEJB("appB", "MyBean", MyRemote.class);

Both of them works well

But when I do:

beanA.methodA(); // This works and prints "methodA" onto console.
beanB.methodA(); // This doesn't work. And dont print any thing onto console.
System.out.println("...") // This line doesn't execute

you're trying to lookup the same bean from two different deployments. i've never seen this really. you should have BeanA in BeanARemote, BeanA jar, etc. BeanB as BeanBRemote, BeanB jar, etc. i imagine if you wrap the whole thing in a catch block you'll see the exceptino that is getting thrown when you call a method on BeanB. the lookup doesn't always throw exception until you try to use it.

Looks like memory issue. Go to JVM installed folder and look for heap dump. You will definitely get some clues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM