users@glassfish.java.net

Re: Glassfish + Application Client + ClassNotFoundException (V2ur2/Netbeans

From: <glassfish_at_javadesktop.org>
Date: Mon, 28 Jul 2008 06:04:47 PDT

hello,

i've exactly the same problem!

working with NetBeans IDE 6.1 (Build 200805300101) + Glassfish (V2U2 => Sun Java System Application Server 9.1_02 (build b04-fcs))

created, build and deployed a new simple EJB project and start it with a remote java client on the same pc.

it works fine when i debug the application but when i run the application in "runtime" mode i'll get the following error:

> Error in annotation processing: java.lang.NoClassDefFoundError:
> Ltest/eap/ejb/remote/CalculatorRemote;

But additional, i found out that the error comes only when i call the EJB with the new ejb3-style

[b]Example 1:[/b]

As member field in the class:
[code]
  @EJB
  private static CalculatorRemote calc;
[/code]

Later in a member function:
[code]
  int result = calc.add(3, 5);
  System.out.println("The Result = " + result);
[/code]


When i call the same EJB with the "old" style then the code runs (in debug AND runtime mode) without any errors.

[b]Example 2:[/b]

[code]
   Context jndiContext = new InitialContext();
   String jndiContextName = CalculatorRemote.class.getName();
   CalculatorRemote calc = (CalculatorRemote) jndiContext.lookup(jndiContextName);

   int result = calc.add(3, 5);
   System.out.println("The Result = " + result);
[/code]



[code]
   Results: Debug Runtime
   -------- ----- -------
   Example 1: ok exception
   Example 2: ok ok
[/code]


1. question: what wrong?
2. question: from where comes the additional "L" in the package/class name (in the error message)?!


thx for infos
[Message sent by forum member 'finniq' (finniq)]

http://forums.java.net/jive/thread.jspa?messageID=289777