1

I am working an enterprise application and built EAR file which contains WAR and ejb jar file and SOAP web services. I am successfully able to deploy the application without any startup errors and published the web services and I can access the wsdl file and make a web service call from SOAP UI. The web service makes a call to some Manager class which does an EJB look up to find session bean which is failing with exception javax.naming.NameNotFoundException: Name com.chubb.dgmk.dus.client.DigitalUserServiceLocal not found in context "ejblocal:".

My session ejb is marked as @Stateless and local interface with @Local annotations. But when I look at my application in admin console, I don't see any EJB's that are deployed. There is no "EJB References" link present under References section as shown in the below diagram. As I am not getting any deployment errors, I don't have any clue about what went wrong.

try {
            context = new InitialContext();
            Object obj = context.lookup("ejblocal:com.chubb.dgmk.dus.client.DigitalUserServiceLocal");
            dusService = (IDigitalUserService)obj;
        } catch (NamingException e) {
        }

enter image description here

enter image description here

user1614862
  • 3,701
  • 7
  • 29
  • 46
  • Worked and was detected the ejb module for me after I added a entry in my application.xml of my EAR. Maven by default added only the war file. I added another entry like lib/core-ejb.jar – Shoaib Jun 28 '18 at 07:35

2 Answers2

0

You don't see references, as there is no reference defined in your web module where you have service. You would need to have ejb-local-ref entry in the web.xml or @EJB annotation.

Regarding your ejblocal: lookup, it should work. Verify in the SystemOut.log, what are the bindings under which the DigitalUserService is bound. Maybe you have ibm-ejb-jar-bnd.xml file, which overrides the default bindings.

You should also be able to see EJB JNDI names on that page, in the Enterprise Java Beans Properties section. If you don't, then looks like your EJB is not detected.

Gas
  • 17,601
  • 4
  • 46
  • 93
  • application.xml in my EJB project is missing the module declaration for ejb jar.So I have just added it as below. Now I am getting deployment exception regarding client classes. My @Local is present in different project which I have added as ejb-client-jar in ejb-jar.xml of this project. But still it is not able to lo load that local interface, hence could not deploy my ejb. DigitalUserServicesDomain.jar – user1614862 Sep 10 '15 at 01:07
  • @user1614862 Yor ejb client jar should be in EAR/lib folder, or if it is placed in different path e.g. ear root, you should put it in the ejb module classpath in the MANIFEST.MF. The easiest is to do it via Project properties > Deployment Assembly in Eclipse. – Gas Sep 10 '15 at 09:46
  • It is already in the EAR/lib folder. But, I am still getting class loading exception while starting the server. More over, I cannot generate wsdl for my service after moving/declaring my EJB jar to application.xml. I am getting "failed to localize" error when executing wsgen command from my RAD. – user1614862 Sep 14 '15 at 06:37
0

It is because of not specifying the dependent jars in the MANIFEST file of EJB project. After adding all those jars in the MANIFEST files, I am able to successfully load and lookup the EJBs.

user1614862
  • 3,701
  • 7
  • 29
  • 46