• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JNDI properties for JBoss 4.2.2

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey..
I'm still working with the basic stateless session e.g of "Apress Beginning JavaEE.5 from Novice to Professional".

I did manage to find the JAR's required for EJB deployment.
But when i deployed the EJB named

SimpleSessionApp.ejb3

into the deployment directory of JBoss which contain the SimpleSession.class - Remote interface and SimpleSessionBean.class, and i run the client using the follows




i get the following error.

 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Make sure the ejb-jar is deployed successfully. jndi.properties is to be used by the client program and so it needs not be in the ejb-jar. But jndi.properties must be in the classpath of your client program.

Regards,

Ujjwal Soni



"{A Well Directed Imagination is the source of great deeds...}"
 
palla sridhar
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Ujwal!
Thanks. But my ejb jar file is deployed right on the JBoss server. This is because, i could see the message in the JBoss server window.
Also, the following libraries were required in classpath, as mentioned in the book. "Apress Beginning JavaEE.5 from Novice to Professional".

I'm supplying the jndi properties via command line.



But still i'm getting the same error.

Exception in thread "main" javax.naming.NameNotFoundException: beans.SimpleSession not bound



The funny thing is that, when i use a Ant build script and put all the libraries in the classpath, i'm able to run the example.(i mean the client.)

This is the Ant build script.

<?xml version="1.0"?>

<!-- ======================================================================= -->
<!-- JBoss build file -->
<!-- ======================================================================= -->

<project name="JBoss" default="ejbjar" basedir=".">

<property environment="env"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="jboss.home" value="${env.JBOSS_HOME}"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>

<!-- Build classpath -->
<path id="classpath">
<fileset dir="${jboss.home}/server/default/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${jboss.home}/server/default/deploy/ejb3.deployer">
<include name="*.jar"/>
</fileset>
<fileset dir="${jboss.home}/server/default/deploy/jboss-aop-jdk50.deployer">
<include name="*.jar"/>
</fileset>
<fileset dir="${jboss.home}/lib">
<include name="*.jar"/>
</fileset>
<pathelement location="${build.classes.dir}"/>
<!-- So that we can get jndi.properties for InitialContext and log4j.xml file -->
<pathelement location="${basedir}/client-config"/>
</path>

<property name="build.classpath" refid="classpath"/>

<!-- =================================================================== -->
<!-- Prepares the build directory -->
<!-- =================================================================== -->
<target name="prepare" >
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes.dir}"/>
</target>

<!-- =================================================================== -->
<!-- Compiles the source code -->
<!-- =================================================================== -->
<target name="compile" depends="prepare">
<javac srcdir="${src.dir}"
destdir="${build.classes.dir}"
debug="on"
deprecation="on"
optimize="off"
includes="**">
<classpath refid="classpath"/>
</javac>
</target>

<target name="ejbjar" depends="compile">
<jar jarfile="build/simple.jar">
<fileset dir="${build.classes.dir}">
<include name="beans/*.class"/>
</fileset>
</jar>
<copy file="build/simple.jar" todir="${jboss.home}/server/default/deploy"/>
</target>

<target name="run.client" depends="ejbjar">
<java classname="client.SimpleSessionClient" fork="yes" dir=".">
<arg value ="i am a thief"/>
<arg value ="i am a fool"/>
<arg value ="i am a human"/>
<classpath refid="classpath"/>
</java>
</target>

<!-- =================================================================== -->
<!-- Cleans up generated stuff -->
<!-- =================================================================== -->
<target name="clean.db">
<delete dir="${jboss.home}/server/default/data/hypersonic"/>
</target>

<target name="clean">
<delete dir="${build.dir}"/>
<delete file="${jboss.home}/server/default/deploy/simple.jar"/>
</target>


</project>



Can anybody tell me what error i'm making when i'm running the client manually?
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Exception in thread "main" javax.naming.NameNotFoundException: beans.SimpleSession not bound



This error is usually because your are specifying an incorrect jndi-name while doing the lookup. The jmx-console shows the jndi-names of the deployed beans. Use the jmx-console to find out the jndi-name of your bean and use it for the lookup. This will tell you how to use the jmx-console.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic