We have an application in JBOSS. The application has a jar which has an abstract class and the class uses EJB. One of the classes is extending that abstract class. The application works fine in JBOSS and it is a SOAP service application.
I need to migrate that application in TC server. I am putting a REST layer using Spring and Jersey on top of that application. I am unable to instantiate the class which extends the abstract class in JBOSS application. I did some research but could not get a right answer and not sure if EJB is supported in TC server. The error I am getting is
javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/ejb/EJBObject
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420)
Thanks for the help.
Tomcat (which Spring TC server essentially is) is a pure servlet container, it does not have EJB support.
Related
While Developing a Java EE Web app, I would like to know simple ways to access an stateless EJB object through Rest.
This project needs no Dynamic Web from Java, as Client side is fully javascript deployed, so communication is done only with Ajax calls.
As I've read one way would be to create 2 EJB one for functionality other to represent Web Service.
Is there a way to avoid the Web Service part? (avoid completely the WAR) Maybe with DI?
Java EE 6, EJB 3.1, Eclipse desired. I also believe the right application server would be Glassfish instead of Jboss, due to it's compatibility with EJB 3.0
No interesting in using JAX-WS
With EJB 3.1 you can actually publish a session bean as a JAX-RS web service, if you package your (properly annotated) session bean inside a WAR.
So, the simplest solution I can think of would be to create a WAR (a dynamic web app if you're using Eclipse) and create a JAX-RS annotated stateless session bean inside the web app. You don't need any EJB projects at all.
Not really. In Java EE 6 you can directly publish a Session Bean as a JAX-WS web service, but not as a JAX-RS web service. You're pretty much stuck with creating a WAR that hosts that JAX-RS services that front the EJBs themselves.
I have implemented a RESTful web service using jersey and deployed it on Tomcat, I have used DAO classes to manipulate database operations, entities to wrap database records. and did the processing in separate package. I want to make this system distributed using EJB. First of all would it be easy to do this change. or i need to rewrite things from scratch. Second, I still need to have the REST WS, so would it be possible to expose the EJB as a REST WS and how? would the REST WS be in the same EJB project or in a different one?
You can definitely do it as an EJB and REST WS. Upgrade your Tomcat install to TomEE Plus, then just add #Stateless or #Singleton to the existing REST service.
You won't need Jersey in there anymore as the Java EE version of Tomcat (TomEE) includes CXF for JAX-RS support.
This example is not well documented, but shows a functional application that combines both EJB and JAX-RS.
http://tomee.apache.org/examples-trunk/rest-on-ejb/README.html
I am developing a REST web service with Apache CXF 2.3 and deploying in JBoss 4.2.3 GA. When I try to access my web service, I am getting this following error
java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader.
I was able to fix this error by adding the correct version of JAXB api jar in \lib\endorsed folder. But I am doubtful whether it will interfere in any other web application JAXB related functionality. One more web application is using some other version of JAXB. Is there any other graceful way of solving this issue. Thanks for any advice.
I am trying to create a EJB 3.0 session bean with methods exposed as webservice.I am using Eclipse and my weblogic server is integreated and is there a tutorial of sorts to create a sample webservice?
Have you seen the docs that have an example of an EJB 3.0 web service?
http://download.oracle.com/docs/cd/E21764_01/web.1111/e13758/jws.htm#i246190
Seam 2.1 and JBoss 4.2.2
I have set up the first App to have the EJB in the EAR with a local interface.
the 2nd app can look up JDNI name "ear-name/ejbname/local" but fails with "NoClassDefFound".
Does the EJB .jar need to be outside of the EAR?
Is this a classloader visibility issue or Is this a JBoss version issue? or something else?
Thank you for your thoughts..
I cannot answer if it will work or not. However, I can tell you how we do this.
We have created a #Webservice component that uses this EJB. And then we connect to the Webservice from our other application.
I blogged about this a while back. You can have a read if you are interested.