• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

java.lang.reflect.InvocationTargetException

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello,

I am trying to learn EJB3, and I started to read "EJB in Action".
The first example is very simple, yet it doesn't seem to wprk for me:
It looks like that:

package bean;
import javax.ejb.Remote;


@Remote
public interface HelloFirstUser {
public void sayHello(String name);
}

//--------------------------------------------------------------------------

package bean;
import javax.ejb.Stateless;


@Stateless
public class HelloFirstUserBean implements HelloFirstUser {
public void sayHello(String name) {
System.out.println("Hello " + name + " welcome to EJB 3 In Action!");
}
}

//--------------------------------------------------------------------------

package client;

import bean.HelloFirstUser;
import javax.ejb.EJB;
import javax.naming.*;


public class HelloFirstUserClient {

@EJB
private static HelloFirstUser helloUser;

public static void main(String[] args) throws Exception{

helloUser.sayHello("Hello world to the first user ... ");
System.out.println("Invoked EJB successfully .. see server console for output");
}
}

//-------------------------------------------------------------------------------------------------------------

I used the deploy and run targets in the ant build file, but when running the first example I get the error:

Executing client class using D:\Sun\SDK/bin/appclient.bat
[exec] 08.02.2009 12:15:49 com.sun.enterprise.deployment.annotation.impl.DefaultErrorHandler error
[exec] SEVERE: Class [ Lbean/HelloFirstUser; ] not found. Error while loading [ class client.HelloFirstUserClient ]
[exec] 08.02.2009 12:15:49 com.sun.enterprise.deployment.archivist.Archivist readAnnotations
[exec] WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: Lbean/HelloFirstUser;
[exec] 08.02.2009 12:15:50 com.sun.enterprise.appclient.MainWithModuleSupport <init>
[exec] WARNING: ACC003: Application threw an exception.
[exec] java.lang.NoClassDefFoundError: bean/HelloFirstUser
[exec] at client.HelloFirstUserClient.main(HelloFirstUserClient.java:15)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[exec] at java.lang.reflect.Method.invoke(Method.java:585)
[exec] at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
[exec] at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
[exec] at com.sun.enterprise.appclient.Main.main(Main.java:180)
[exec] Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
[exec] at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:340)
[exec] at com.sun.enterprise.appclient.Main.main(Main.java:180)
[exec] Caused by: java.lang.reflect.InvocationTargetException
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[exec] at java.lang.reflect.Method.invoke(Method.java:585)
[exec] at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
[exec] at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
[exec] ... 1 more
[exec] Caused by: java.lang.NoClassDefFoundError: bean/HelloFirstUser
[exec] at client.HelloFirstUserClient.main(HelloFirstUserClient.java:15)
[exec] ... 7 more

What could be the problem ? Please give me a hint, because I cannot run the simplest example.

thank you
 
What a show! What atmosphere! What fun! What a tiny ad!
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic