wood burning stoves
The moose likes Websphere and the fly likes EJB deployment and calling local interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "EJB deployment and calling local interface" Watch "EJB deployment and calling local interface" New topic

EJB deployment and calling local interface

Alana Sparx
Ranch Hand

Joined: Feb 14, 2006
Posts: 121

I've been trying to get an EJB jar file loaded into WebSphere, but every time I get confronted with the same error message on deployment:
[15/02/06 08:53:18:876 GMT] 3d83305b ApplicationMg A WSVR0200I: Starting application: IntlHealthcare
[15/02/06 08:53:18:985 GMT] 3d83305b EJBContainerI I WSVR0207I: Preparing to start EJB jar: EligabilityEJB.jar
[15/02/06 08:53:19:094 GMT] 3d83305b BeanMetaData E CNTR0075E: The user-provided class "com.intl.ecommerce.healthcare.business.eligability.ejb.EligabilityLocal" needed by the EnterpriseBean could not be found or loaded.
[15/02/06 08:53:19:126 GMT] 3d83305b EJBContainerI E WSVR0209E: Unable to prepare EJB jar EligabilityEJB.jar [class com.ibm.ws.runtime.component.DeployedModuleImpl], enterprise bean com.ibm.etools.ejb.impl.SessionImpl(Eligability) (transactionType: Container, sessionType: Stateless)
java.lang.NoClassDefFoundError: com/intl/ecommerce/healthcare/business/eligability/bean/EligabilityPolicy
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:1753)
at java.lang.Class.privateGetPublicMethods(Class.java:1781)

I can see two problems above, and they are related!

The class �EligabilityPolicy� exists in a project utility jar file called EligabilityBusiness.jar

The local interface �EligabilityLocal� has �EligabilityPolicy� as one of its return types. If I change this so the method in question returns a String, deployment is fine. This is going to be down to the way my project utilities are ordered / included in the EAR descriptor, but I really can�t see anything wrong in this respect!

Also, once deployed (with the method returning a String), the WAR client application insists on calling the Bean�s remote interface � the entire application will be running inside the same JVM, so I want to call the Bean�s local interface; the exception stack is:
[15/02/06 09:21:25:938 GMT] 6ef77336 SystemErr R java.lang.ClassCastException: cannot cast class com.intl.ecommerce.healthcare.business.eligability.ejb._EligabilityHome_Stub to interface com.intl. ecommerce.healthcare.business.eligability.ejb.EligabilityLocalHome
[15/02/06 09:21:25:938 GMT] 6ef77336 SystemErr R at com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:409)
[15/02/06 09:21:25:938 GMT] 6ef77336 SystemErr R at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:156)
[15/02/06 09:21:25:938 GMT] 6ef77336 SystemErr R at com.intl.ecommerce.healthcare.web.eligability.facade.EligabilityFacade.init(EligabilityFacade.java:50)

The code responsible for invoking this is

As you can imagine, changing the jndi name from
  • �../../EligabilityHome� to
  • �../../EligabilityLocalHome�

  • throws a NameNotFoundException. Does the jndi name strictly point to the remote interface? If so, how do I get a hold of the Local interface? Many thanks
    Alana Sparx
    Ranch Hand

    Joined: Feb 14, 2006
    Posts: 121
    I�ve been trying some other approaches, still can�t discover the Local interface � experiencing naming context exceptions. I�ve tried amending the invocation code to

    but this still throws a NameNotFoundException (Name comp/env/ejb not found in context "java:")

    I�ve tried the name as
  • "java:comp/env/ejb/Eligability"
  • "java:/ejb/Eligability"
  • "comp/env/ejb/Eligability"
  • "ejb/Eligability"
  • "Eligability"

  • All with no luck.

    The ejb depolyment descriptor is as follows
    Alana Sparx
    Ranch Hand

    Joined: Feb 14, 2006
    Posts: 121

    The ejb deployment descriptor looks like:

    xml version="1.0" encoding="UTF-8"?>
    < !DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar id="ejb-jar_ID">
    <session id="Eligability">
    <ejb-local-ref id="EJBLocalRef_1139997836094">
    Alana Sparx
    Ranch Hand

    Joined: Feb 14, 2006
    Posts: 121
    Much internal swearing, screaming and dark thoughts later.....

    is the prefix ie "local:ejb/" documented anywhere? Reasonable? Grrrr....

    Secondly, jar dependencies are managed by ...... The jar dependency editor
    On this last point I will admit to my own stupidity.

    Bloody thing.
    Marc Peabody
    pie sneak

    Joined: Feb 05, 2003
    Posts: 4727

    "AM Sparx", I'm glad you figured out your problem. I must inform you, we don't have many rules around here but our naming policy is one of them. Not complying with the policy will lead to your account becoming locked. This warning hopefully will prevent that from happening, but some action is required on your part.

    Please review the policy here and you can change your Publicly Displayed Name here.

    A good workman is known by his tools.
    I agree. Here's the link: http://aspose.com/file-tools
    subject: EJB deployment and calling local interface
    It's not a secret anymore!