NoClassDefFoundError, ejb-class was not found in the EJB jar
843829Jan 6 2003 — edited Jan 15 2003When I start the JRun4 server, the \JRun4\logs\default-event.log contained:
error Deployer Service failed to deploy file:/C:/JRun4/servers/default/default-ear/
* EJB Container Factory could not deploy EJB container from file:/C:/JRun4/servers/default/default-ear/default-ejb/.
* The class specified, com.zbeans.Entity1Bean, by ejb-class was not found in the EJB jar.
ejb-jar.xml resides under
C:/JRun4/servers/default/default-ear/default-ejb/Meta-inf
Entity1Bean.class resides under
c:\JRun4\servers\default\default-ear\default-war\WEB-INF\classes\com\zbeans.
I made sure Entity1Bean.class existed in Entity1.jar. I even tried using
absolute, instead of relative paths, when creating the jar file.
I tried placing Entity1.jar in various folders, such as
C:/JRun4/servers/default/default-ear/default-ejb/Meta-inf,
...\default-war\WEB-INF\classes\Meta-inf\.
I also renamed Entity1.jar to ejb.jar, but this also was not solution.
The various online documentation, and hardcopy books suggest different
paths (relative to the classes folder) to create the Meta-inf folder.
Does it have to appear under a specific parent folder for each type of
server (Weblogic vs Websphere vs Jrun)? I am using the JRun 'default'
server, which has worked for my simple beans in JSP.
I'm still unclear where the Entity1.jar, ejb-jar.xml should reside, and
whether it is mandatory to name the jar "ejb.jar" (I don't think so)?
My ejb-jar.xml contains:
<?xml version="1.0"?>
<!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>
<description>
My first EJB.
</description>
<enterprise-beans>
<entity>
<description>
Entity1 bean to represent ...
</description>
<ejb-name>com/zbeans/Entity1Remote</ejb-name>
<home>com.zbeans.Entity1RemoteHome</home>
<remote>com.zbeans.Entity1Remote</remote>
<local-home></local-home>
<local></local>
<ejb-class>com.zbeans.Entity1Bean</ejb-class> <-- above error message suggests it was not found in the EJB jar
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-field>
<description>this is the primary key (String)</description>
<field-name>property1</field-name>
</cmp-field>
<primkey-field>property1</primkey-field>
</entity>
</enterprise-beans>
</ejb-jar>
I successfully referenced a simple bean in JSP residing under
C:\JRun4\servers\default\default-ear\default-war\web-
inf\classes\com\zbeans\JavaBean_eg1.class. This would suggest the server
is running properly. I used the following Bean class reference in JSP:
<jsp:useBean id="prJavaBean1" scope="page" class="com.zbeans.JavaBean_eg1" />
My PC configuration:
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
JRun 4 (Build 47304)
WinNT 4.0 SP5
IE 5.50
CLASSPATH=.;c:\j2sdkee1.3.1\lib\j2ee.jar;D:\jakarta-tomcat-3.3.1\lib\common\serv
let.jar;C:\JRun4\servers\default\default-ear\default-war\WEB-INF\classes
J2EE_HOME=c:\j2sdkee1.3.1
JAVA_HOME=C:\j2sdk1.4.0_01
Path=C:\j2sdk1.4.0_01\bin;C:\WINNT\system32;C:\WINNT;C:\Program Files\Network As
sociates\PGPNT;C:\Program Files\MTS;d:\MSSQL7\BINN