Discussions

EJB programming & troubleshooting: Strange deployment errors

  1. Strange deployment errors (13 messages)

    I made some changes to my ant build scripts yesterday and started getting some strange session EJB deployment errors. All I did was to split up my project into several JARs instead of deploying everything as one JAR and made ant create several JARs.

    The deplyment error I get is this:
    <pre>
    14:03:50,853 WARN [verifier] EJB spec violation:
    Bean : ItemManagerFinder
    Section: 22.2
    Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's
     business methods in the <ejb-class> element.
    Info : Class not found on 'com.forisent.framework.itemManager.store.ItemManagerFinderSession': Unexpected error during load of: com.forisent.framework.itemManager.store.ItemManagerFinderSession, msg=com/forisent/framework/itemManager/store/ItemManagerFinderBean
    </pre>

    I have checked that my ejb-jar.xml looks correct:
    <pre>
    <session >
    <description><![CDATA[]]></description>
    <ejb-name>ItemManagerFinder</ejb-name>
    <home>com.forisent.framework.itemManager.store.ItemManagerFinderHome</home>
    <remote>com.forisent.framework.itemManager.store.ItemManagerFinder</remote>
    <local-home>com.forisent.framework.itemManager.store.ItemManagerFinderLocalHome</local-home>
    <local>com.forisent.framework.itemManager.store.ItemManagerFinderLocal</local>
    <ejb-class>com.forisent.framework.itemManager.store.ItemManagerFinderSession</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </pre>

    ...and I have made sure that the ItemManagerFinderSession class is in my JAR along with all the other classes.

    So, what may be going on here?

    Threaded Messages (13)

  2. Strange deployment errors[ Go to top ]

    You need to put the EJB class in the same JAR as its interfaces. If you really want to have a separate JAR with just the interfaces (such as for client development), you should write your build scripts to produce one JAR with everything and a second JAR with just the interfaces.
  3. Strange deployment errors[ Go to top ]

    Paul,

    I have double checked that all the classes are in the correct JARs.

    My JARs split at the package level: i.e.

    com.forisent...store -> StoreJAR
    com.forisent...logic -> LogicJAR

    so, all my beans, interfaces etc. are inte same JAR.
  4. Strange deployment errors[ Go to top ]

    Make sure that your LogicJAR is not in the classpath when you build/deploy your EJB.
  5. Strange deployment errors[ Go to top ]

    So I should clean out any old JARs at the begining of my build? Would that do it?
  6. Strange deployment errors[ Go to top ]

    That might be a problem, but as a rule, when Ant creates a JAR, it deletes the old one. Still, it can't hurt to delete the Jar.

    Better yet, delete everything except for your code and build everything from scratch. I always have a "clean" task to wipe everything out, which I use right before I build a distribution (though not for development builds).
  7. Strange deployment errors[ Go to top ]

    Thanks Paul, I tried that and it did not work. I am using Eclipse with the lomboz plugin on a Jboss 3.2.2 container.

    Here is the piece of ant script that I changed:

    <target name="ejb-jar" depends="init">
        <delete file="${container}.jar" />
          <jar jarfile="${container}.jar">
            <fileset dir="${bin.dir}">
               <include name="com/forisent/framework/itemManager/store/**/*.*"/>
            </fileset>
            <fileset dir=".">
               <include name="META-INF/**/*.*"/>
               <exclude name="META-INF/beans.xml"/>
               <exclude name="META-INF/build.xml"/>
               <exclude name="META-INF/build.properties"/>
               <exclude name="META-INF/ejbs.xml"/>
               <exclude name="META-INF/ejbGenerate.xml"/>
               <exclude name="META-INF/servers.xml"/>
            </fileset>
          </jar>
       </target>

    from:

    <target name="ejb-jar" depends="init">
        <delete file="${container}.jar" />
          <jar jarfile="${container}.jar">
            <fileset dir="${bin.dir}">
               <include name="**/*.*"/>
            </fileset>
            <fileset dir=".">
               <include name="META-INF/**/*.*"/>
               <exclude name="META-INF/beans.xml"/>
               <exclude name="META-INF/build.xml"/>
               <exclude name="META-INF/build.properties"/>
               <exclude name="META-INF/ejbs.xml"/>
               <exclude name="META-INF/ejbGenerate.xml"/>
               <exclude name="META-INF/servers.xml"/>
            </fileset>
          </jar>
       </target>

    If I change it back to the default, it works just fine again.
  8. Strange deployment errors[ Go to top ]

    OK ... here is another idea.

    Maybe your bean class has dependencies on other classes in your environment. For example, maybe it is a subclass of another class, or it stores another class in a variable (static, instance, method parameter or return value).

    Double check your class's dependencies, and ensure that those are in the JAR as well. See if that fixes things.
  9. Strange deployment errors[ Go to top ]

    Thanks Paul for all your help and brainstoring this with me.

    Ok, that is the idea I have also been drifting towards. However, if both JARs are deployed to the same container, shouldn't that take care of things? Although, I guess during deployment, that is not relevant. So, I should include one JAR in a lib dir of the other JAR maybe?
  10. Strange deployment errors[ Go to top ]

    EJB containers do strange things with their classloaders. Just putting your Jars somewhere in the EJB container's classpath may not work.

    The best way to put EJB and non-EJB jars together is to put them all in an Enterprise Archive (EAR). In addition, you may need to specify a reference in the manifest classpath of your EJB jar to import your non-EJB jar (). All of this gets pretty messy, but can work.

    For more on the Class-Path attribute of manifest files within Jars, see here:

    http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html
  11. Strange deployment errors[ Go to top ]

    Hope you are not compiling with jdk 5.0 because it would generate this exception at deployment time.
  12. JDK 5.0 JBoss 4.0.1[ Go to top ]

    Hi Mike,

    I used JDK1.4.2 to compile our app and it runs fine on JBoss 3.2. But I had the same problem on JBoss 4.0.1 if I compiled it by using JDK 5.0. With your suggestions, I tried to use JDK1.4.2 compiled version to deploy on JBoss 4.0.1 and it still has problem... I checked the ejb jar file and descriptor, but I still can't figure out why.

        <session>
          <display-name>ServicesFacadeEJB</display-name>
          <ejb-name>ServicesFacadeEJB</ejb-name>
          <home>net.odsp.facade.ServicesFacadeHome</home>
          <remote>net.odsp.facade.ServicesFacade</remote>
          <ejb-class>net.odsp.facade.ServicesFacadeEJB</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Container</transaction-type>
        </session>

    Thanks
    Kelvin
  13. Strange deployment errors[ Go to top ]

    I just fixed the problem by changing the java home from JDK1.4 to JDK1.5 for JBoss 4.0.1 run.bat.

    set JAVA_HOME=C:\jdk1.5.0_02 (You can set it in your environment)
    set JAVA=%JAVA_HOME%\bin\java
  14. Strange deployment errors[ Go to top ]

    I had the same problem with JBoss 3.2.3 running under Java 1.4.2.
    In the ejb-jar were some classes compiled with JDK 1.5.
    Compiling with JDK 1.4.2 solved the problem.