Vuk Stanković
Vuk Stanković

Reputation: 7964

Glassfish javax.ejb.EJBException

I have problem trying to deploy Java Enterprise web application with EJB and JSF web module. Application builds successfully but when it gets deployed to Glassfish 4 server, I get this exception

javax.ejb.EJBException
at com.sun.ejb.containers.EJBContainerTransactionManager.processSystemException(EJBContainerTransactionManager.java:748)
at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:698)
at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:503)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4475)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2009)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1979)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:220)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
at com.sun.proxy.$Proxy325.vratiSveRelacije(Unknown Source)
at kontroler.KontrolerPrevoznika.vratiSveRelacije(KontrolerPrevoznika.java:275)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.el.ELUtil.invokeMethod(ELUtil.java:326)
at javax.el.BeanELResolver.invoke(BeanELResolver.java:536)
at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
at com.sun.el.parser.AstValue.getValue(AstValue.java:136)
at com.sun.el.parser.AstValue.getValue(AstValue.java:204)

Any suggestions?

Upvotes: 1

Views: 10499

Answers (3)

Max
Max

Reputation: 1157

I had the same issue, and it turns out that the cause was in Payara/Glassfish, not in the app. The admin portal - http://localhost:4848/ asked for login credentials all of a sudden, that was not the case before. Setting up a new domain / glassfish instance resolved this issue for me. Might not work for everybody, but I hope it will save some of you some time.

Upvotes: 0

Teodor
Teodor

Reputation: 124

I resolved this problem. My exception looks:

    javax.ejb.EJBException
        at com.sun.ejb.containers.EJBContainerTransactionManager.processSystemException(EJBContainerTransactionManager.java:748)
        at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:698)
        at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:503)
        at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4566)

And that because my EJB method throws an exception declared in another .jar file used by application as external library and that .jar library is in domain1/lib directory.

Try to throw another exceptions from EJB method and you will see the result.

Upvotes: 0

Jessai
Jessai

Reputation: 947

I have worked recently with EJB and I can tell you to check the JNDI that you are setting to connect to the EJB.

Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("org.omg.CORBA.ORBInitialHost", "*hostname*");
props.setProperty("org.omg.CORBA.ORBInitialPort", "*3700*");//default port
InitialContext ctx = new InitialContext(props);
FirstBeanRemote bean = (FirstBeanRemote) ctx.lookup("java:global/*EARNAME/EJBJARNAME*/FirstBean!*fullyqualifiedpackage*.FirstBeanRemote");
  1. The most important thing is to check if you are setting the ctx.lookup argument.

  2. Check also the EJB jar if is deploying correctly.

  3. I don't know If its a bug, but in Eclipse and Glassfish, The EJB can't have external jars

Upvotes: 1

Related Questions