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\samples\server\examples\src\examples\ejb20\basic\statelessSe
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.NameNotFoundException: Unable to resolve 'ejb20-statele
ssSession-TraderHome' Resolved ; remaining name 'ejb20-statelessSession-TraderHo
me'
     [java]     at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundR
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.ReplicaAwareRemoteRef.invoke(ReplicaAwar
eRemoteRef.java:284)
     [java] Unable to look up the beans home: Unable to resolve 'ejb20-stateless
Session-TraderHome' Resolved
     [java]     at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwar
eRemoteRef.java:244)
     [java]     at weblogic.jndi.internal.ServerNamingNode_812_WLStub.lookup(Unk
nown Source)
     [java]     at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.jav
a:343)
     [java]     at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.jav
a:336)
     [java]     at javax.naming.InitialContext.lookup(InitialContext.java:347)
     [java]     at examples.ejb20.basic.statelessSession.Client.lookupHome(Clien
t.java:118)
     [java]     at examples.ejb20.basic.statelessSession.Client.<init>(Client.ja
va:32)
     [java]     at examples.ejb20.basic.statelessSession.Client.main(Client.java
:59)
     [java] Caused by: javax.naming.NameNotFoundException: Unable to resolve 'ej
b20-statelessSession-TraderHome' Resolved
     [java]     at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundExcepti
on(BasicNamingNode.java:858)
     [java]     at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNaming
Node.java:230)
     [java]     at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNami
ngNode.java:154)
     [java]     at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode
.java:188)
     [java]     at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown S
ource)
     [java]     at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.ja
va:477)
     [java]     at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwar
eServerRef.java:108)
     [java]     at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.jav
a:420)
     [java]     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Auth
enticatedSubject.java:353)
     [java]     at weblogic.security.service.SecurityManager.runAs(SecurityManag
er.java:144)
     [java]     at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServe
rRef.java:415)
     [java]     at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecut
eRequest.java:30)
     [java]     at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)

     [java]     at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
     [java] Exception in thread "main"

BUILD FAILED
file:C:/bea81/weblogic81/samples/server/examples/src/examples/ejb20/basic/statel
essSession/build.xml:76: Java returned: 1

Total time: 4 seconds

++++++++++++++++
this is the build.xml file
++++++++++++++
<project name="ejb20-basic-statelessSession" default="all" basedir=".">

  <!-- set global properties for this build -->
  <property environment="env"/>
  <property file="../../../../examples.properties"/>
  <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_basic_statelessSession.jar"
      basedir="${build}"
      update="yes">
    </jar>
  </target>

  <target name="appc" depends="jar.ejb">
    <wlappc debug="${debug}"
      source="${dist}/ejb20_basic_statelessSession.jar"
      />
  </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_statelessSession.ear" appxml="${source}/application.xml">
      <fileset dir="${dist}" includes="ejb20_basic_statelessSession.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_basic_statelessSession_client.jar" tofile="${client.classes.dir}/ejb20_basic_statelessSession_client.jar"/>
    <javac srcdir="${source}"
      destdir="${client.classes.dir}"
      includes="Client.java"
      classpath="${ex.classpath};${client.classes.dir}/ejb20_basic_statelessSession_client.jar"
    />
  </target>

  <target name="clean">
    <delete dir="${build}"/>
  </target>

  <!-- Run the example -->
  <target name="run">
  <java classname="examples.ejb20.basic.statelessSession.Client" fork="yes" failonerror="true">
    <arg value="t3://localhost:${port}"/>
    <classpath>
      <pathelement path="${ex.classpath};${client.classes.dir}/ejb20_basic_statelessSession_client.jar"/>
    </classpath>
  </java>
  </target>

</project>
++++++++++++++++++=
Of course, I started the weblogic server before I ran.

thanks in advance.
dkim18Asked:
Who is Participating?
 
Mayank SAssociate Director - Product EngineeringCommented:
Personally - I would says yes.
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Can you post the ejb-jar xml?
0
 
dkim18Author Commented:
<?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.statelessSession.TraderHome</home>
      <remote>examples.ejb20.basic.statelessSession.Trader</remote>
      <ejb-class>examples.ejb20.basic.statelessSession.TraderBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-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-value>
      </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-value>
      </env-entry>
      <env-entry>
        <env-entry-name>tradeLimit</env-entry-name>
      <env-entry-type>java.lang.Integer </env-entry-type>
      <env-entry-value>500</env-entry-value>
      </env-entry>
    </session>
  </enterprise-beans>
  <assembly-descriptor>
    <container-transaction>
      <method>
        <ejb-name>statelessSession</ejb-name>
      <method-name>*</method-name>
      </method>
      <trans-attribute>Required</trans-attribute>
    </container-transaction>
  </assembly-descriptor>
  <ejb-client-jar>ejb20_basic_statelessSession_client.jar</ejb-client-jar>
</ejb-jar>
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Mayank SAssociate Director - Product EngineeringCommented:
are you sure you have deployed the EJB at the server?
0
 
dkim18Author Commented:
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?
0
 
girionisCommented:
It is always good to to a manual deploy. If the automatic deployment fails you would have to do it manualyl anyway.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.