Solved

ant run error with testing statelessSession from weblogic example

Posted on 2006-07-18
6
440 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:Mayank S
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:Mayank S
ID: 17136178
are you sure you have deployed the EJB at the server?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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:
Mayank S 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

831 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