Skip to content
Advertisement

TOMEEE – Can’t lookup ejb

I have implemented a basic EJB Object in my code. Then I created a jar for this ejb. The jar file contains:

  1. package containing the ejb classes (home interface/remote bean interface/bean implementaion)
  2. META-INF folder containing the ejb-jar.xml

ejb-jar.xml

JavaScript

Then I deployed the EJB by placing the jar in webapps folder and from the server logs it seems to have been deployed successfully. But when I try to reference the ejb from my code I get error. Code:

JavaScript

I have used “java:global/NewTransactionEjb/NewTransactionEjb” because upon ejb deployment I see this line in the server logs:

JavaScript

In the execution it seems the the above code is working and it retrieves the EJBHome, but when I try to cast it to my own home interface class it fails with the following error:

JavaScript

What am I doing wrong?

Advertisement

Answer

I have finally found the solution to this issue. To be precise the actual problem has nothing to do with the exception which is just confusing. So I will mention my problem anyway, in case someone faces the same issue.

My problem was that 2 of the EJB classes (home interface and remote bean interface) were also in TOMEE /lib directory except for the EJB deployable jar file which was placed in /webapps directory. So I removed them from the jar file (now it contains only the bean implementaion class), deployed it and everything is working fine.

Advertisement