Trying to deploy the Converter example and run its client
quereinsteiger Mar 16, 2004 4:24 PMI am new to J2EE and JBoss. I try a very simple thing: deploying the Converter example of the Sun tutorial and to run the console client for it.
What I want to do is simple. But I have problems with it. I can manage to deploy it. But when I start the client, I get this:
run-client: [echo] C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-antlr.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-apache-bsf.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-apache-resolver.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-commons-logging.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-commons-net.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-icontract.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-jai.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-jakarta-bcel.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-jakarta-log4j.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-jakarta-oro.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-jakarta-regexp.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-javamail.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-jdepend.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-jmf.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-jsch.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-junit.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-launcher.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-netrexx.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-nodeps.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-starteam.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-stylebook.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-swing.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-trax.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-vaj.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-weblogic.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-xalan1.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-xalan2.jar;C:\eclipse3.0M7\plugins\org.apache.ant_1.6.0\lib\ant-xslp.jar;C:\eclipse3.0M7\plugins\org.eclipse.ant.ui_3.0.0\lib\remoteAnt.jar;C:\j2sdk1.4.2_04\lib\tools.jar [java] Caught an unexpected exception! [java] javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: converter.ConverterHome (no security manager: RMI class loader disabled)] [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:652) [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507) [java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
Can you please help me? I show you now all the files I use, except for the Java source files, which are the same as in the tutorial.
<project name="test" default="deploy" basedir="."> <property file="/build.properties"/> <property name="src.dir" value="/src"/> <property name="build.dir" value="/build"/> <!-- | The classpath for running the client --> <path id="client.classpath"> <pathelement location=""/> <fileset dir="/client"> <include name="**/*.jar"/> </fileset> </path> <!-- | The build classpath --> <path id="build.classpath"> <path refid="client.classpath"/> </path> <target name="clean"> <delete dir="" /> </target> <!-- =================================================================== --> <!-- Initialises the build. --> <!-- =================================================================== --> <target name="prepare" depends="clean"> <mkdir dir=""/> </target> <!-- =================================================================== --> <!-- Compiles the source code --> <!-- =================================================================== --> <target name="compile" depends="prepare" > <javac destdir="" classpathref="build.classpath"> <src path=""/> </javac> </target> <target name="package-ejb" depends="compile"> <delete file="jar/converter-ejb.jar"/> <copy file="dd/converter-ejb.xml" tofile="build/ejb-jar.xml" overwrite="true"/> <copy file="dd/converter-jboss.xml" tofile="build/jboss.xml" overwrite="true"/> <jar jarfile="jar/converter-ejb.jar"> <metainf dir="" includes="ejb-jar.xml,jboss.xml" /> <fileset dir=""> <include name="converter/**" /> </fileset> </jar> </target> <target name="package-client" depends="compile"> <delete file="jar/app-client.jar"/> <copy file="dd/app-client.xml" tofile="/application-client.xml" overwrite="true"/> <copy file="dd/jboss-client.xml" todir="" overwrite="true"/> <copy file="dd/jndi.properties" todir=""/> <jar jarfile="jar/app-client.jar"> <metainf dir="" includes="application-client.xml,jboss-client.xml" /> <fileset dir=""> <include name="ConverterClient.class" /> <include name="jndi.properties" /> </fileset> </jar> </target> <!-- | Creates an ear file containing the ejb jars and the web client war. --> <target name="assemble-app" depends="package-ejb,package-client"> <delete file="jar/ConverterApp.ear"/> <ear destfile="jar/ConverterApp.ear" appxml="dd/application.xml"> <fileset dir="jar" includes="converter-ejb.jar,app-client.jar"/> </ear> </target> <!-- | Deploys the EAR file by copying it to the JBoss deploy directory. --> <target name="deploy" depends="assemble-app"> <copy file="jar/ConverterApp.ear" todir="/deploy"/> </target> <target name="undeploy"> <delete file="/deploy/ConverterApp.ear"/> </target> <!-- | Run the standalone client --> <target name="run-client"> <echo></echo> <java classname="ConverterClient" fork="yes"> <classpath> <pathelement path="jar/app-client.jar"/> <path refid="client.classpath"/> <pathelement path=""/> </classpath> </java> </target> </project>
app-client.xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE application-client PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN' 'http://java.sun.com/dtd/application-client_1_3.dtd'> <application-client> <display-name>ConverterClient</display-name> <ejb-ref> <ejb-ref-name>ejb/SimpleConverter</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>converter.ConverterHome</home> <remote>converter.Converter</remote> </ejb-ref> </application-client>
application.xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' 'http://java.sun.com/dtd/application_1_3.dtd'> <application> <display-name>ConverterApp</display-name> <description>Application description</description> <module> <java>app-client.jar</java> </module> <module> <ejb>converter-ejb.jar</ejb> </module> </application>
converter-ejb.xml:
<?xml version="1.0" encoding="UTF-8"?> <!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> <display-name>ConverterJAR</display-name> <enterprise-beans> <session> <display-name>ConverterEJB</display-name> <ejb-name>ConverterEJB</ejb-name> <home>converter.ConverterHome</home> <remote>converter.Converter</remote> <ejb-class>converter.ConverterBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Bean</transaction-type> <ejb-ref> <ejb-ref-name>ejb/SimpleConverter</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>converter.ConverterHome</home> <remote>converter.Converter</remote> </ejb-ref> <security-identity> <description></description> <use-caller-identity></use-caller-identity> </security-identity> </session> </enterprise-beans> </ejb-jar>
converter-jboss.xml:
<jboss> <enterprise-beans> <session> <ejb-name>ConverterEJB</ejb-name> <jndi-name>MyConverter</jndi-name> <ejb-ref> <ejb-ref-name>ejb/SimpleConverter</ejb-ref-name> <jndi-name>MyConverter</jndi-name> </ejb-ref> </session> </enterprise-beans> </jboss>
jboss-client.xml:
<jboss-client> <jndi-name>MyConverter</jndi-name> <ejb-ref> <ejb-ref-name>ejb/SimpleConverter</ejb-ref-name> <jndi-name>MyConverter</jndi-name> </ejb-ref> </jboss-client>
jndi.properties:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory #java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces java.naming.provider.url=jnp://localhost:1099 java.naming.factory.url.pkgs=org.jboss.naming.client j2ee.clientName=MyConverter
Whats wrong? Maybe it would even help me if you could tell me a very simple example where I can look at it. The DukeBank is a too complicated example for me as a beginner.