Discussions

EJB programming & troubleshooting: problem in installing jar on websphere

  1. problem in installing jar on websphere (3 messages)

    I am trying to learn EJB using Websphere application server.I have my home,remote, bean and deployment descriptor in C:\EJB and client classes lies in C:\EJBClient.Now I putted home,remote ,bean and deployment descriptor in a jar file and trying to install this jar on websphere and it gives following error:

    The EAR file could be corrupt and/or incomplete.
    java.lang.ClassCastException: com.ibm.etools.commonarchive.impl.ArchiveImpl

    Please help me!!
  2. Probably i would appreciate if u could provide with more details on what u actually did. However I would suggest following a simple tutorial for weblogic
    EJB and then trying to take it from there.
    -sriram
  3. I am using Websphere and I took some sample code from this server and putted home,remote interfaces ,bean class and deployment descriptor from their samples in C:\EJB.This sample code is a calculator .I created jar file by issuing following command from c prompt:
    C:\>jar cf test1.jar EJB\*.class EJB\ejb-jar.xml(My home,remote and bean class files are in C:\EJB and ejb-jar.xml(deployment descriptor) is also in same directory)
    Here is my ejb-jar.xml:(When I try to install test1.jar on websphere then it gives error).

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">
       <ejb-jar id="ejb-jar_ID">
          <description>Basic Calculator Stateless Session EJB</description>
          <display-name>Basic Calculator EJB Module</display-name>
          <enterprise-beans>
             <session id="Session_1">
                <description>Basic Calculator to add, subtract, multiply, divide</description>
                <display-name>Basic Calculator Stateless Session</display-name>
                <ejb-name>BasicCalculator</ejb-name>
                <home>BasicCalculatorHome</home>
                <remote>BasicCalculator</remote>
                <ejb-class>BasicCalculatorBean</ejb-class>
                <session-type>Stateless</session-type>
                <transaction-type>Container</transaction-type>
             </session>
          </enterprise-beans>
          <assembly-descriptor id="AssemblyDescriptor_1">
             <container-transaction id="MethodTransaction_1">
                <method id="MethodElement_1">
                   <ejb-name>BasicCalculator</ejb-name>
                   <method-name>*</method-name>
                </method>
                <trans-attribute>Never</trans-attribute>
             </container-transaction>
          </assembly-descriptor>
       </ejb-jar>
  4. I would suggest you to use sophisticated way of creating ejb jar using WSAD if it is for websphere. Because there can be numerous other things might causing problem in the creation of ur ejb jar. Your deployment description looks perfect. May be problem is in generation of deployed code.
      Simply, drag drop your ejb component in the ejb project in WSAD(resolve dependencies), generate deployed code and export ejb jar and use it for your WAS wherever you want.
    Thanks
    Bhupesh