PDA

View Full Version : [J2EE] webservice non funziona con annotation @EJB


blackskop
24-11-2008, 15:28
Ciao. Ho realizzato un progetto con eclipse, un'applicazione enterprise. L'applicazione è composta da un progetto EJB e da un progetto web dinamico. Il progetto EJB contiene soltanto un entity bean e un session bean stateless che impelementa l'interfaccia Local. Il progetto web ha una sola classe Pippo con un semplice metodo getTrue che restituisce sempre true. Se volessi utilizzare il session bean in questa classe per fare altre operazioni, dovrei utilizzare l'annotation @EJB seguita dalla dichiarazione del session bean. Se realizzo un webservice partendo da questa classe Pippo che non contiene l'annotation EJB, il webservice funziona (testato con un banale client). Se invece aggiungo l'annotation EJB, il client mi restituisce errore del tipo


[29/Aug/2008:15:50:04] warning ( 6245): CORE3283: stderr: AxisFault
[29/Aug/2008:15:50:04] warning ( 6245): CORE3283: stderr: faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
[29/Aug/2008:15:50:04] warning ( 6245): CORE3283: stderr: faultSubcode:
[29/Aug/2008:15:50:04] warning ( 6245): CORE3283: stderr: faultString: java.lang.NullPointerException
[29/Aug/2008:15:50:04] warning ( 6245): CORE3283: stderr: faultActor:
[29/Aug/2008:15:50:04] warning ( 6245): CORE3283: stderr: faultNode:
[29/Aug/2008:15:50:04] warning ( 6245): CORE3283: stderr: faultDetail:
[29/Aug/2008:15:50:04] warning ( 6245): CORE3283: stderr: {http://xml.apache.org/axis/}stackTrace: java.lang.NullPointerException
[29/Aug/2008:15:50:04] warning ( 6245): CORE3283: stderr: at java.util.Hashtable.put(Hashtable.java:396)


Perchè l'annotation @EJB da questo problema?