EJB deployment question


EJB programming & troubleshooting: EJB deployment question

  1. EJB deployment question (6 messages)


    I'm trying to deploy the simple HelloWorld example ejb, found in the Mastering EJB book. This is my ejb-jar.xml file:
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

    This is my weblogic-ejb-jar.xml file:
    <!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN" "http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd">


    When I log into the admin console & try to deploy, I get the message : Unable to load a class specified in your ejb-jar.xml: examples.HelloBean

    Can anybody please help?

    Threaded Messages (6)

  2. Re: EJB deployment question[ Go to top ]

    Is the class really named "examples.HelloBean"? Is it in your ejb jar file? Open your jar file in winzip or do a jar -tf on it to verify that your class files are actually in there. Make sure you include all necessary dependencies (like helper classes, if any since this is just a hello world example) in there too.
  3. Re: EJB deployment question[ Go to top ]

    Thank you for replying.
    This is what I did to create the jar file:
    I was in the c:\examples directory and I said
    jar -cf HelloWorld.jar examples\*

    and when I did jar -xvf HelloWorld.jar, I get

    C:\examples>jar -xvf HelloWorld.jar
      created: META-INF/
    extracted: META-INF/MANIFEST.MF
    extracted: examples/Hello.class
    extracted: examples/Hello.java
    extracted: examples/HelloBean.class
    extracted: examples/HelloBean.java
    extracted: examples/HelloHome.class
    extracted: examples/HelloHome.java
    extracted: examples/HelloLocal.class
    extracted: examples/HelloLocal.java
    extracted: examples/HelloLocalHome.class
    extracted: examples/HelloLocalHome.java
    extracted: examples/HelloWorld.jar
      created: examples/META-INF/
    extracted: examples/META-INF/ejb-jar.xml
    extracted: examples/META-INF/MANIFEST.MF
    extracted: examples/META-INF/WebLogic-ejb-jar.xml

    Is it not right? I stil get the error about not being able to load the class
  4. Re: EJB deployment question[ Go to top ]

    Did you make sure you have a package statement at the top of the source files, indicating that all of the classes/interfaces will be in the examples package?
  5. Re: EJB deployment question[ Go to top ]

    Don't you have to run, EJBC or APPC (Weblogic) on the jar file before you try to deploy ?
  6. Re: EJB deployment question[ Go to top ]


    open ur jar file in zip, at the end of column ie 'path' it shows the beans path. if it is empty then you have created wrong jar file

    eg: if ur package is like this


    then go to bin directory and make the jar file like

    jar cvf myejb.jar com\mycompany\trade\ejb\*.class

    to add META-INF(ejb-jar.xml and weblogic-ejb-jar.xml)

    jar uvf myejbjar.jar META-INF/*.xml
    and remove all the .package from myserver and applications redeploy it.

  7. ahmed karim's solution[ Go to top ]

    yup,......what ever ahmed karim posted really helps

    thanks ahmed karim