Hi,
I am relatively new to j2ee, and am having problems getting the basics working.
I am using sun's j2ee application server, and sun's deploytool to deploy the application.
The application deploys no problem, but when I run it I get the following error -
Application threw an exception:java.lang.NoClassDefFoundError: provisioning.ProvisioningHome
where provisioning is the package name, and ProvisioningHome is the home interface of the Provisioning session bean.
Here is the home interface code -
package provisioning;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
public interface ProvisioningHome extends EJBHome {
public Provisioning create()
throws RemoteException, CreateException;
}
...and the client code -
package client;
import java.util.*;
import java.io.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import provisioning.*;
public class ProvisioningClient {
public static void main(String[] args) {
try {
InitialContext initial = new InitialContext();
Object objref = initial.lookup("java:comp/env/ejb/Provisioning"
;
ProvisioningHome home =
(ProvisioningHome)PortableRemoteObject.narrow(objref, ProvisioningHome.class);
Provisioning myProvisioning = home.create();
System.exit(0);
} catch (Exception ex) {
System.err.println("Caught an exception:"
;
ex.printStackTrace();
}
}
} // class
I've obviously missed something obvious, but just can't see it.
Here is the xml generated by the deploytool -
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' '
<application>
<display-name>PrototypeApp</display-name>
<description>Application description</description>
<module>
<ejb>ejb-jar-ic0.jar</ejb>
</module>
<module>
<java>app-client-ic.jar</java>
</module>
<module>
<ejb>ejb-jar-ic.jar</ejb>
</module>
</application>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE j2ee-ri-specific-information PUBLIC '-//Sun Microsystems Inc.//DTD J2EE Reference Implementation 1.3//EN' '
<j2ee-ri-specific-information>
<rolemapping />
<enterprise-beans>
<module-name>ejb-jar-ic0.jar</module-name>
<unique-id>0</unique-id>
<ejb>
<ejb-name>ProvisioningBean</ejb-name>
<jndi-name>MyProvisioning</jndi-name>
<ior-security-config>
<transport-config>
<integrity>supported</integrity>
<confidentiality>supported</confidentiality>
<establish-trust-in-target>supported</establish-trust-in-target>
<establish-trust-in-client>supported</establish-trust-in-client>
</transport-config>
<as-context>
<auth-method>username_password</auth-method>
<realm>default</realm>
<required>false</required>
</as-context>
<sas-context>
<caller-propagation>supported</caller-propagation>
</sas-context>
</ior-security-config>
<ejb-ref>
<ejb-ref-name>ejb/LogicalElement</ejb-ref-name>
<jndi-name></jndi-name>
</ejb-ref>
<gen-classes />
</ejb>
</enterprise-beans>
<enterprise-beans>
<module-name>ejb-jar-ic.jar</module-name>
<unique-id>0</unique-id>
<ejb>
<ejb-name>LogicalElementBean</ejb-name>
<jndi-name>MyLogicalElement</jndi-name>
<ior-security-config>
<transport-config>
<integrity>supported</integrity>
<confidentiality>supported</confidentiality>
<establish-trust-in-target>supported</establish-trust-in-target>
<establish-trust-in-client>supported</establish-trust-in-client>
</transport-config>
<as-context>
<auth-method>username_password</auth-method>
<realm>default</realm>
<required>false</required>
</as-context>
<sas-context>
<caller-propagation>supported</caller-propagation>
</sas-context>
</ior-security-config>
<gen-classes />
<ejb20-cmp>
<sql-statement>
<operation>storeRow</operation>
<sql>UPDATE "LogicalElementBeanTable" SET "adminState" = ? , "opState" = ? , "reasonCode" = ? WHERE "logicalElementId" = ? </sql>
</sql-statement>
<sql-statement>
<operation>loadRow</operation>
<sql>SELECT "adminState" , "opState" , "reasonCode" FROM "LogicalElementBeanTable" WHERE "logicalElementId" = ? </sql>
</sql-statement>
<sql-statement>
<operation>deleteRow</operation>
<sql>DELETE FROM "LogicalElementBeanTable" WHERE "logicalElementId" = ? </sql>
</sql-statement>
<sql-statement>
<operation>createRow</operation>
<sql>INSERT INTO "LogicalElementBeanTable" ( "adminState" , "logicalElementId" , "opState" , "reasonCode" ) VALUES ( ? , ? , ? , ? )</sql>
</sql-statement>
<sql-statement>
<operation>deleteTable</operation>
<sql>DROP TABLE "LogicalElementBeanTable"</sql>
</sql-statement>
<sql-statement>
<operation>findByPrimaryKey</operation>
<sql>SELECT "logicalElementId" FROM "LogicalElementBeanTable" WHERE "logicalElementId" = ? </sql>
</sql-statement>
<sql-statement>
<operation>createTable</operation>
<sql>CREATE TABLE "LogicalElementBeanTable" ("adminState" INTEGER NOT NULL , "logicalElementId" VARCHAR(255) , "opState" INTEGER NOT NULL , "reasonCode" INTEGER NOT NULL, CONSTRAINT "pk_LogicalElementBeanTabl" PRIMARY KEY ("logicalElementId"
)</sql>
</sql-statement>
<create-table-deploy>true</create-table-deploy>
<delete-table-undeploy>false</delete-table-undeploy>
</ejb20-cmp>
</ejb>
<cmpresource>
<ds-jndi-name>jdbc/Cloudscape</ds-jndi-name>
<default-resource-principal>
<name></name>
<password></password>
</default-resource-principal>
</cmpresource>
</enterprise-beans>
</j2ee-ri-specific-information>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application-client PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN' '
<application-client>
<display-name>ProvisioningClient</display-name>
<ejb-ref>
<ejb-ref-name>ejb/Provisioning</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>provisioning.ProvisioningHome</home>
<remote>provisioning.Provisioning</remote>
</ejb-ref>
</application-client>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE j2ee-ri-specific-information PUBLIC '-//Sun Microsystems Inc.//DTD J2EE Reference Implementation 1.3//EN' '
<j2ee-ri-specific-information>
<app-client>
<ejb-ref>
<ejb-ref-name>ejb/Provisioning</ejb-ref-name>
<jndi-name>MyProvisioning</jndi-name>
</ejb-ref>
</app-client>
</j2ee-ri-specific-information>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' '
<ejb-jar>
<display-name>provisioning</display-name>
<enterprise-beans>
<session>
<display-name>ProvisioningBean</display-name>
<ejb-name>ProvisioningBean</ejb-name>
<home>provisioning.ProvisioningHome</home>
<remote>provisioning.Provisioning</remote>
<ejb-class>provisioning.ProvisioningBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<ejb-ref-name>ejb/LogicalElement</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>entities.LocalLogicalElementHome</local-home>
<local>entities.LocalLogicalElement</local>
<ejb-link>LogicalElementBean</ejb-link>
</ejb-local-ref>
<security-identity>
<description></description>
<use-caller-identity></use-caller-identity>
</security-identity>
</session>
</enterprise-beans>
<assembly-descriptor>
<method-permission>
<unchecked />
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>java.lang.Object</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>createLogicalElement</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getHandle</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>javax.ejb.Handle</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>getHomeHandle</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getPrimaryKey</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>remove</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>getEJBMetaData</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getLogicalElement</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>create</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>isIdentical</method-name>
<method-params>
<method-param>javax.ejb.EJBObject</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getEJBHome</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>submit</method-name>
<method-params />
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>submit</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getLogicalElement</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>createLogicalElement</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
sorry for all the xml...
Thanks,
Eamon.
I am relatively new to j2ee, and am having problems getting the basics working.
I am using sun's j2ee application server, and sun's deploytool to deploy the application.
The application deploys no problem, but when I run it I get the following error -
Application threw an exception:java.lang.NoClassDefFoundError: provisioning.ProvisioningHome
where provisioning is the package name, and ProvisioningHome is the home interface of the Provisioning session bean.
Here is the home interface code -
package provisioning;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
public interface ProvisioningHome extends EJBHome {
public Provisioning create()
throws RemoteException, CreateException;
}
...and the client code -
package client;
import java.util.*;
import java.io.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import provisioning.*;
public class ProvisioningClient {
public static void main(String[] args) {
try {
InitialContext initial = new InitialContext();
Object objref = initial.lookup("java:comp/env/ejb/Provisioning"
ProvisioningHome home =
(ProvisioningHome)PortableRemoteObject.narrow(objref, ProvisioningHome.class);
Provisioning myProvisioning = home.create();
System.exit(0);
} catch (Exception ex) {
System.err.println("Caught an exception:"
ex.printStackTrace();
}
}
} // class
I've obviously missed something obvious, but just can't see it.
Here is the xml generated by the deploytool -
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' '
<application>
<display-name>PrototypeApp</display-name>
<description>Application description</description>
<module>
<ejb>ejb-jar-ic0.jar</ejb>
</module>
<module>
<java>app-client-ic.jar</java>
</module>
<module>
<ejb>ejb-jar-ic.jar</ejb>
</module>
</application>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE j2ee-ri-specific-information PUBLIC '-//Sun Microsystems Inc.//DTD J2EE Reference Implementation 1.3//EN' '
<j2ee-ri-specific-information>
<rolemapping />
<enterprise-beans>
<module-name>ejb-jar-ic0.jar</module-name>
<unique-id>0</unique-id>
<ejb>
<ejb-name>ProvisioningBean</ejb-name>
<jndi-name>MyProvisioning</jndi-name>
<ior-security-config>
<transport-config>
<integrity>supported</integrity>
<confidentiality>supported</confidentiality>
<establish-trust-in-target>supported</establish-trust-in-target>
<establish-trust-in-client>supported</establish-trust-in-client>
</transport-config>
<as-context>
<auth-method>username_password</auth-method>
<realm>default</realm>
<required>false</required>
</as-context>
<sas-context>
<caller-propagation>supported</caller-propagation>
</sas-context>
</ior-security-config>
<ejb-ref>
<ejb-ref-name>ejb/LogicalElement</ejb-ref-name>
<jndi-name></jndi-name>
</ejb-ref>
<gen-classes />
</ejb>
</enterprise-beans>
<enterprise-beans>
<module-name>ejb-jar-ic.jar</module-name>
<unique-id>0</unique-id>
<ejb>
<ejb-name>LogicalElementBean</ejb-name>
<jndi-name>MyLogicalElement</jndi-name>
<ior-security-config>
<transport-config>
<integrity>supported</integrity>
<confidentiality>supported</confidentiality>
<establish-trust-in-target>supported</establish-trust-in-target>
<establish-trust-in-client>supported</establish-trust-in-client>
</transport-config>
<as-context>
<auth-method>username_password</auth-method>
<realm>default</realm>
<required>false</required>
</as-context>
<sas-context>
<caller-propagation>supported</caller-propagation>
</sas-context>
</ior-security-config>
<gen-classes />
<ejb20-cmp>
<sql-statement>
<operation>storeRow</operation>
<sql>UPDATE "LogicalElementBeanTable" SET "adminState" = ? , "opState" = ? , "reasonCode" = ? WHERE "logicalElementId" = ? </sql>
</sql-statement>
<sql-statement>
<operation>loadRow</operation>
<sql>SELECT "adminState" , "opState" , "reasonCode" FROM "LogicalElementBeanTable" WHERE "logicalElementId" = ? </sql>
</sql-statement>
<sql-statement>
<operation>deleteRow</operation>
<sql>DELETE FROM "LogicalElementBeanTable" WHERE "logicalElementId" = ? </sql>
</sql-statement>
<sql-statement>
<operation>createRow</operation>
<sql>INSERT INTO "LogicalElementBeanTable" ( "adminState" , "logicalElementId" , "opState" , "reasonCode" ) VALUES ( ? , ? , ? , ? )</sql>
</sql-statement>
<sql-statement>
<operation>deleteTable</operation>
<sql>DROP TABLE "LogicalElementBeanTable"</sql>
</sql-statement>
<sql-statement>
<operation>findByPrimaryKey</operation>
<sql>SELECT "logicalElementId" FROM "LogicalElementBeanTable" WHERE "logicalElementId" = ? </sql>
</sql-statement>
<sql-statement>
<operation>createTable</operation>
<sql>CREATE TABLE "LogicalElementBeanTable" ("adminState" INTEGER NOT NULL , "logicalElementId" VARCHAR(255) , "opState" INTEGER NOT NULL , "reasonCode" INTEGER NOT NULL, CONSTRAINT "pk_LogicalElementBeanTabl" PRIMARY KEY ("logicalElementId"
</sql-statement>
<create-table-deploy>true</create-table-deploy>
<delete-table-undeploy>false</delete-table-undeploy>
</ejb20-cmp>
</ejb>
<cmpresource>
<ds-jndi-name>jdbc/Cloudscape</ds-jndi-name>
<default-resource-principal>
<name></name>
<password></password>
</default-resource-principal>
</cmpresource>
</enterprise-beans>
</j2ee-ri-specific-information>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application-client PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN' '
<application-client>
<display-name>ProvisioningClient</display-name>
<ejb-ref>
<ejb-ref-name>ejb/Provisioning</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>provisioning.ProvisioningHome</home>
<remote>provisioning.Provisioning</remote>
</ejb-ref>
</application-client>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE j2ee-ri-specific-information PUBLIC '-//Sun Microsystems Inc.//DTD J2EE Reference Implementation 1.3//EN' '
<j2ee-ri-specific-information>
<app-client>
<ejb-ref>
<ejb-ref-name>ejb/Provisioning</ejb-ref-name>
<jndi-name>MyProvisioning</jndi-name>
</ejb-ref>
</app-client>
</j2ee-ri-specific-information>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' '
<ejb-jar>
<display-name>provisioning</display-name>
<enterprise-beans>
<session>
<display-name>ProvisioningBean</display-name>
<ejb-name>ProvisioningBean</ejb-name>
<home>provisioning.ProvisioningHome</home>
<remote>provisioning.Provisioning</remote>
<ejb-class>provisioning.ProvisioningBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<ejb-ref-name>ejb/LogicalElement</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>entities.LocalLogicalElementHome</local-home>
<local>entities.LocalLogicalElement</local>
<ejb-link>LogicalElementBean</ejb-link>
</ejb-local-ref>
<security-identity>
<description></description>
<use-caller-identity></use-caller-identity>
</security-identity>
</session>
</enterprise-beans>
<assembly-descriptor>
<method-permission>
<unchecked />
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>java.lang.Object</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>createLogicalElement</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getHandle</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>javax.ejb.Handle</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>getHomeHandle</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getPrimaryKey</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>remove</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>getEJBMetaData</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getLogicalElement</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>create</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>isIdentical</method-name>
<method-params>
<method-param>javax.ejb.EJBObject</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getEJBHome</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>submit</method-name>
<method-params />
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>submit</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getLogicalElement</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>createLogicalElement</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
sorry for all the xml...
Thanks,
Eamon.