dkim18
asked on
ant run error with testing statelessSession from weblogic example
Hi,
I am trying to run statelessSession from weblogic example, but I got this error message when I tried 'ant run' command. My ant command works fine and I didn't change any directories.
++++++++++++++++++++++
C:\bea81\weblogic81\sample s\server\e xamples\sr c\examples \ejb20\bas ic\statele ssSe
ssion>ant run
Buildfile: build.xml
run:
[java] Beginning statelessSession.Client...
[java] The client was unable to lookup the EJBHome. Please make sure
[java] javax.naming.NameNotFoundE xception: Unable to resolve 'ejb20-statele
ssSession-TraderHome' Resolved ; remaining name 'ejb20-statelessSession-Tr aderHo
me'
[java] at weblogic.rjvm.BasicOutboun dRequest.s endReceive (BasicOutb oundR
equest.java:108)
[java] that you have deployed the ejb with the JNDI name ejb20-statelessSes
sion-TraderHome on the WebLogic server at t3://localhost:7001
[java] at weblogic.rmi.cluster.Repli caAwareRem oteRef.inv oke(Replic aAwar
eRemoteRef.java:284)
[java] Unable to look up the beans home: Unable to resolve 'ejb20-stateless
Session-TraderHome' Resolved
[java] at weblogic.rmi.cluster.Repli caAwareRem oteRef.inv oke(Replic aAwar
eRemoteRef.java:244)
[java] at weblogic.jndi.internal.Ser verNamingN ode_812_WL Stub.looku p(Unk
nown Source)
[java] at weblogic.jndi.internal.WLC ontextImpl .lookup(WL ContextImp l.jav
a:343)
[java] at weblogic.jndi.internal.WLC ontextImpl .lookup(WL ContextImp l.jav
a:336)
[java] at javax.naming.InitialContex t.lookup(I nitialCont ext.java:3 47)
[java] at examples.ejb20.basic.state lessSessio n.Client.l ookupHome( Clien
t.java:118)
[java] at examples.ejb20.basic.state lessSessio n.Client.< init>(Clie nt.ja
va:32)
[java] at examples.ejb20.basic.state lessSessio n.Client.m ain(Client .java
:59)
[java] Caused by: javax.naming.NameNotFoundE xception: Unable to resolve 'ej
b20-statelessSession-Trade rHome' Resolved
[java] at weblogic.jndi.internal.Bas icNamingNo de.newName NotFoundEx cepti
on(BasicNamingNode.java:85 8)
[java] at weblogic.jndi.internal.Bas icNamingNo de.lookupH ere(BasicN aming
Node.java:230)
[java] at weblogic.jndi.internal.Ser verNamingN ode.lookup Here(Serve rNami
ngNode.java:154)
[java] at weblogic.jndi.internal.Bas icNamingNo de.lookup( BasicNamin gNode
.java:188)
[java] at weblogic.jndi.internal.Roo tNamingNod e_WLSkel.i nvoke(Unkn own S
ource)
[java] at weblogic.rmi.internal.Basi cServerRef .invoke(Ba sicServerR ef.ja
va:477)
[java] at weblogic.rmi.cluster.Repli caAwareSer verRef.inv oke(Replic aAwar
eServerRef.java:108)
[java] at weblogic.rmi.internal.Basi cServerRef $1.run(Bas icServerRe f.jav
a:420)
[java] at weblogic.security.acl.inte rnal.Authe nticatedSu bject.doAs (Auth
enticatedSubject.java:353)
[java] at weblogic.security.service. SecurityMa nager.runA s(Security Manag
er.java:144)
[java] at weblogic.rmi.internal.Basi cServerRef .handleReq uest(Basic Serve
rRef.java:415)
[java] at weblogic.rmi.internal.Basi cExecuteRe quest.exec ute(BasicE xecut
eRequest.java:30)
[java] at weblogic.kernel.ExecuteThr ead.execut e(ExecuteT hread.java :197)
[java] at weblogic.kernel.ExecuteThr ead.run(Ex ecuteThrea d.java:170 )
[java] Exception in thread "main"
BUILD FAILED
file:C:/bea81/weblogic81/s amples/ser ver/exampl es/src/exa mples/ejb2 0/basic/st atel
essSession/build.xml:76: Java returned: 1
Total time: 4 seconds
++++++++++++++++
this is the build.xml file
++++++++++++++
<project name="ejb20-basic-stateles sSession" default="all" basedir=".">
<!-- set global properties for this build -->
<property environment="env"/>
<property file="../../../../examples .propertie s"/>
<property name="build.compiler" value="${compiler}"/>
<property name="source" value="."/>
<property name="build" value="${source}/build"/>
<property name="dist" value="${source}/dist"/>
<target name="all" depends="clean, init, compile_ejb, jar.ejb, appc, ear_app,
compile_client"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile
and copy the deployment descriptors into it-->
<mkdir dir="${build}"/>
<mkdir dir="${build}/META-INF"/>
<mkdir dir="${dist}"/>
<copy todir="${build}/META-INF">
<fileset dir="${source}">
<include name="ejb-jar.xml"/>
<include name="weblogic-ejb-jar.xml "/>
</fileset>
</copy>
</target>
<!-- Compile ejb classes into the build directory (jar preparation) -->
<target name="compile_ejb">
<javac srcdir="${source}" destdir="${build}"
includes="Trader.java, TraderHome.java, TradeResult.java,
TraderBean.java"/>
</target>
<!-- Update ejb jar file or create it if it doesn't exist, including XML
deployment descriptors -->
<target name="jar.ejb" depends="compile_ejb">
<jar jarfile="${dist}/ejb20_bas ic_statele ssSession. jar"
basedir="${build}"
update="yes">
</jar>
</target>
<target name="appc" depends="jar.ejb">
<wlappc debug="${debug}"
source="${dist}/ejb20_basi c_stateles sSession.j ar"
/>
</target>
<!-- Put the ejb into an ear, to be deployed from the ${apps.dir} dir -->
<target name="ear_app" depends="jar.ejb">
<ear earfile="${apps.dir}/ejb20 _basic_sta telessSess ion.ear" appxml="${source}/applicat ion.xml">
<fileset dir="${dist}" includes="ejb20_basic_stat elessSessi on.jar"/>
</ear>
</target>
<!-- Compile client app into the clientclasses directory, and move the client jar file (created by appc) there as well -->
<target name="compile_client">
<move file="${user.dir}/ejb20_ba sic_statel essSession _client.ja r" tofile="${client.classes.d ir}/ejb20_ basic_stat elessSessi on_client. jar"/>
<javac srcdir="${source}"
destdir="${client.classes. dir}"
includes="Client.java"
classpath="${ex.classpath} ;${client. classes.di r}/ejb20_b asic_state lessSessio n_client.j ar"
/>
</target>
<target name="clean">
<delete dir="${build}"/>
</target>
<!-- Run the example -->
<target name="run">
<java classname="examples.ejb20. basic.stat elessSessi on.Client" fork="yes" failonerror="true">
<arg value="t3://localhost:${po rt}"/>
<classpath>
<pathelement path="${ex.classpath};${cl ient.class es.dir}/ej b20_basic_ statelessS ession_cli ent.jar"/>
</classpath>
</java>
</target>
</project>
++++++++++++++++++=
Of course, I started the weblogic server before I ran.
thanks in advance.
I am trying to run statelessSession from weblogic example, but I got this error message when I tried 'ant run' command. My ant command works fine and I didn't change any directories.
++++++++++++++++++++++
C:\bea81\weblogic81\sample
ssion>ant run
Buildfile: build.xml
run:
[java] Beginning statelessSession.Client...
[java] The client was unable to lookup the EJBHome. Please make sure
[java] javax.naming.NameNotFoundE
ssSession-TraderHome' Resolved ; remaining name 'ejb20-statelessSession-Tr
me'
[java] at weblogic.rjvm.BasicOutboun
equest.java:108)
[java] that you have deployed the ejb with the JNDI name ejb20-statelessSes
sion-TraderHome on the WebLogic server at t3://localhost:7001
[java] at weblogic.rmi.cluster.Repli
eRemoteRef.java:284)
[java] Unable to look up the beans home: Unable to resolve 'ejb20-stateless
Session-TraderHome' Resolved
[java] at weblogic.rmi.cluster.Repli
eRemoteRef.java:244)
[java] at weblogic.jndi.internal.Ser
nown Source)
[java] at weblogic.jndi.internal.WLC
a:343)
[java] at weblogic.jndi.internal.WLC
a:336)
[java] at javax.naming.InitialContex
[java] at examples.ejb20.basic.state
t.java:118)
[java] at examples.ejb20.basic.state
va:32)
[java] at examples.ejb20.basic.state
:59)
[java] Caused by: javax.naming.NameNotFoundE
b20-statelessSession-Trade
[java] at weblogic.jndi.internal.Bas
on(BasicNamingNode.java:85
[java] at weblogic.jndi.internal.Bas
Node.java:230)
[java] at weblogic.jndi.internal.Ser
ngNode.java:154)
[java] at weblogic.jndi.internal.Bas
.java:188)
[java] at weblogic.jndi.internal.Roo
ource)
[java] at weblogic.rmi.internal.Basi
va:477)
[java] at weblogic.rmi.cluster.Repli
eServerRef.java:108)
[java] at weblogic.rmi.internal.Basi
a:420)
[java] at weblogic.security.acl.inte
enticatedSubject.java:353)
[java] at weblogic.security.service.
er.java:144)
[java] at weblogic.rmi.internal.Basi
rRef.java:415)
[java] at weblogic.rmi.internal.Basi
eRequest.java:30)
[java] at weblogic.kernel.ExecuteThr
[java] at weblogic.kernel.ExecuteThr
[java] Exception in thread "main"
BUILD FAILED
file:C:/bea81/weblogic81/s
essSession/build.xml:76: Java returned: 1
Total time: 4 seconds
++++++++++++++++
this is the build.xml file
++++++++++++++
<project name="ejb20-basic-stateles
<!-- set global properties for this build -->
<property environment="env"/>
<property file="../../../../examples
<property name="build.compiler" value="${compiler}"/>
<property name="source" value="."/>
<property name="build" value="${source}/build"/>
<property name="dist" value="${source}/dist"/>
<target name="all" depends="clean, init, compile_ejb, jar.ejb, appc, ear_app,
compile_client"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile
and copy the deployment descriptors into it-->
<mkdir dir="${build}"/>
<mkdir dir="${build}/META-INF"/>
<mkdir dir="${dist}"/>
<copy todir="${build}/META-INF">
<fileset dir="${source}">
<include name="ejb-jar.xml"/>
<include name="weblogic-ejb-jar.xml
</fileset>
</copy>
</target>
<!-- Compile ejb classes into the build directory (jar preparation) -->
<target name="compile_ejb">
<javac srcdir="${source}" destdir="${build}"
includes="Trader.java, TraderHome.java, TradeResult.java,
TraderBean.java"/>
</target>
<!-- Update ejb jar file or create it if it doesn't exist, including XML
deployment descriptors -->
<target name="jar.ejb" depends="compile_ejb">
<jar jarfile="${dist}/ejb20_bas
basedir="${build}"
update="yes">
</jar>
</target>
<target name="appc" depends="jar.ejb">
<wlappc debug="${debug}"
source="${dist}/ejb20_basi
/>
</target>
<!-- Put the ejb into an ear, to be deployed from the ${apps.dir} dir -->
<target name="ear_app" depends="jar.ejb">
<ear earfile="${apps.dir}/ejb20
<fileset dir="${dist}" includes="ejb20_basic_stat
</ear>
</target>
<!-- Compile client app into the clientclasses directory, and move the client jar file (created by appc) there as well -->
<target name="compile_client">
<move file="${user.dir}/ejb20_ba
<javac srcdir="${source}"
destdir="${client.classes.
includes="Client.java"
classpath="${ex.classpath}
/>
</target>
<target name="clean">
<delete dir="${build}"/>
</target>
<!-- Run the example -->
<target name="run">
<java classname="examples.ejb20.
<arg value="t3://localhost:${po
<classpath>
<pathelement path="${ex.classpath};${cl
</classpath>
</java>
</target>
</project>
++++++++++++++++++=
Of course, I started the weblogic server before I ran.
thanks in advance.
Can you post the ejb-jar xml?
ASKER
<?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>
<enterprise-beans>
<session>
<ejb-name>statelessSession </ejb-name >
<home>examples.ejb20.basic .stateless Session.Tr aderHome</ home>
<remote>examples.ejb20.bas ic.statele ssSession. Trader</re mote>
<ejb-class>examples.ejb20. basic.stat elessSessi on.TraderB ean</ejb-c lass>
<session-type>Stateless</s ession-typ e>
<transaction-type>Containe r</transac tion-type>
<env-entry>
<env-entry-name>WEBL</env- entry-name >
<env-entry-type>java.lang. Double </env-entry-type>
<env-entry-value>10.0</env -entry-val ue>
</env-entry>
<env-entry>
<env-entry-name>INTL</env- entry-name >
<env-entry-type>java.lang. Double </env-entry-type>
<env-entry-value>15.0</env -entry-val ue>
</env-entry>
<env-entry>
<env-entry-name>tradeLimit </env-entr y-name>
<env-entry-type>java.lang. Integer </env-entry-type>
<env-entry-value>500</env- entry-valu e>
</env-entry>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>statelessSession </ejb-name >
<method-name>*</method-nam e>
</method>
<trans-attribute>Required< /trans-att ribute>
</container-transaction>
</assembly-descriptor>
<ejb-client-jar>ejb20_basi c_stateles sSession_c lient.jar< /ejb-clien t-jar>
</ejb-jar>
<!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>
<enterprise-beans>
<session>
<ejb-name>statelessSession
<home>examples.ejb20.basic
<remote>examples.ejb20.bas
<ejb-class>examples.ejb20.
<session-type>Stateless</s
<transaction-type>Containe
<env-entry>
<env-entry-name>WEBL</env-
<env-entry-type>java.lang.
<env-entry-value>10.0</env
</env-entry>
<env-entry>
<env-entry-name>INTL</env-
<env-entry-type>java.lang.
<env-entry-value>15.0</env
</env-entry>
<env-entry>
<env-entry-name>tradeLimit
<env-entry-type>java.lang.
<env-entry-value>500</env-
</env-entry>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>statelessSession
<method-name>*</method-nam
</method>
<trans-attribute>Required<
</container-transaction>
</assembly-descriptor>
<ejb-client-jar>ejb20_basi
</ejb-jar>
are you sure you have deployed the EJB at the server?
ASKER
it says:
Running the build script places the EJB in the %applications% directory, where it automatically deploys once the server is started. If you are already running the server and build another EJB, it is automatically placed in this directory and instantly deployed.
do I need to deploy manually?
Running the build script places the EJB in the %applications% directory, where it automatically deploys once the server is started. If you are already running the server and build another EJB, it is automatically placed in this directory and instantly deployed.
do I need to deploy manually?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It is always good to to a manual deploy. If the automatic deployment fails you would have to do it manualyl anyway.