I think I would like to do something that most people should be doing ?
My Project resides here ( an ear is present but not used ):
https://github.com/Inkimar/Media-3
Read about Jeffreys Onion Architecture ( http://jeffreypalermo.com/blog/the-onion-architecture-part-1/ ) and I am trying to let my project-structure reflect that Architecture :
a EJB-Servlet-JPA Maven project.
Using the latest Glassfish and MySQL ver 5.5
I would like to create everything in separate projects in Netbeans and minimize the dependency, no dependency between EJB and WEB - then link between those project is the Remote-interface ( Stored in a separate project ).
I want to be able to deploy the EJB and Web in different Glassfish on different machines.
First Shot :
1) EJB-Project ( 3 methods, one of them is 'save' using em.merge(object) )
- ( Bean with a remote interface )
2) WEB-Project
- ( 1 Servlet - with one util class ( IP-number to your EJB resides here )
- x number of entity classes )
3) Service-project
- ( The remote interface )
Dependencies :
1) EJB-Project depends on the Service-project
2) WEB-Project depends on the Service-project
The servlet is able to call 2 methods.
The ejb returns a text and the server-time.
it is not able to 'save'
i get an error then :
StandardWrapperValve[Testing]: PWC1406: Servlet.service() for servlet Testing threw exception javax.ejb.EJBException: java.rmi.RemoteException: CORBA UNKNOWN 1330446338 Maybe; nested exception is: org.omg.CORBA.UNKNOWN: ----------BEGIN server-side stack trace---------- org.omg.CORBA.UNKNOWN: WARNING: IOP00010002: Unknown user exception thrown by the server - exception: java.lang.NullPointerException; message: null vmcid: OMG minor code: 2 completed: Maybe at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248) at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95) at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387) at
Is that a bug !?
Using another structure then it works: If I have 1 EJB-project and 1 WEB-project
I am able to make it work without using any interface,
but then the WEB is dependent on the EJB and EJB&WEB must be deployed in the same Glassfish Server ... do not want to do that ...
Best regards, I