Solved

ant run error with testing statelessSession from weblogic example

Posted on 2006-07-18
6
438 Views
Last Modified: 2008-02-20
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.
0
Comment
Question by:dkim18
  • 3
  • 2
6 Comments
 
LVL 30

Expert Comment

by:mayankeagle
ID: 17136088
Can you post the ejb-jar xml?
0
 

Author Comment

by:dkim18
ID: 17136105
<?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
 
LVL 30

Expert Comment

by:mayankeagle
ID: 17136178
are you sure you have deployed the EJB at the server?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:dkim18
ID: 17136192
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
 
LVL 30

Accepted Solution

by:
mayankeagle earned 400 total points
ID: 17136215
Personally - I would says yes.
0
 
LVL 35

Expert Comment

by:girionis
ID: 17136272
It is always good to to a manual deploy. If the automatic deployment fails you would have to do it manualyl anyway.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now