• 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
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

j2ee1.3 basic EJB Not Executing.

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

i tried executing the stand-alone program to use deployed Bean.

i tried with the following command but its throwing error as mentioned.

E:\New Folder (2)\Projects\ManyProjects\Advice>java -classpath AdviceAppClient.jar AdviceClient

Exception in thread "main" java.lang.NoClassDefFoundError: AdviceClient

the AdviceAppClient.jar and AdviceClient is in Advice directory.

let me know the solutions please.

thanks in advance,
Bennet
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

Either the class is not in the jar, the class is not correctly installed into the jar, or you did not correctly specify the class.

For example, if the class is in package 'yourpack' and is named Advice, it must be in the jar as yourpack/Advice. You must specify that full path as in:

java -classpath AdviceAppClient.jar yourpack.Advice

Hope that helps!
 
Bennet Xavier
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Martijn Verburg,

the classes is correctly installed in jar.

the AdviceClient program is in Advice directory. but its showing that error.

if i tried to executing the AdviceClient program with out classpath then its executing fine and its showing javax.naming.NoInitialContextException(its should show this exception).

if i tried with classpath then the mentioned error was reported.

i have installed java1.4, j2ee1.3, j2ee1.4, j2ee1.5, Glassfish and netbeans6.1.

but while compiling and executing the program i set the path to java1.4.

is this correct or not.

do reply.....
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try:

java -classpath .;AdviceAppClient.jar AdviceClient

To add the explanation, you were missing your current directory '.' from your classpath. It worked without specifying the classpath because when you provide no parameter the classpath is automatically the current directory.
[ September 03, 2008: Message edited by: Martijn Verburg ]
 
Bennet Xavier
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Martijn Verburg,

now its showing
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at AdviceClient.gone(AdviceClient.java:20)
at AdviceClient.main(AdviceClient.java:12)

do reply........
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK,

The error you are getting is telling you that you need a Factory class in order to perform JNDI lookups (this is a common requirement). Something like:



Now the code example above is not going to work for you (It's a FileSystem factory). You need to research what the factory class for you should be (I assume you're trying to perform the lookup on a running application server). The tutorial/docs for your app server should give you the example code for what you need to do.
[ September 03, 2008: Message edited by: Martijn Verburg ]
 
Bennet Xavier
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes i am performing the lookup on a running application server.

i am doing all this example from HF EJB.

there nothing mentioned like this.

please tell me how to do that.

do reply.
[ September 03, 2008: Message edited by: Bennet Xavier ]
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm, I don't have that book unfortunately. Does it get you to work with a specific application server (e.g. Jboss, Glassfish, Geronimo)? You really need to lookup the documentation that comes with whatever app server you are working with.
 
Bennet Xavier
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am using sun's RI1.3

but in the HF EJB book nothing is mentioned, like what you said.

do reply...
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll need to look up the documentation for sun's RI1.3, you'll be able to find it via Googling
 
roses are red, violets are blue. Some poems rhyme and some are a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic