File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes @EJB Annotation with Tomcat and JBoss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "@EJB Annotation with Tomcat and JBoss" Watch "@EJB Annotation with Tomcat and JBoss" New topic
Author

@EJB Annotation with Tomcat and JBoss

hal arres
Ranch Hand

Joined: Jan 10, 2003
Posts: 30
Hi all,

I want to migrate an JSF application to JSF2.
The application is running on a Tomcat 6.0.18 and the backend on a JBoss 4.2.2.GA.

My problem is that I want to use inside the ManagedBeans the "@EJB" Annotation, but it won't work.
Maybe someone of you could help me with this problem

I am using the following artefacts:
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jbossall-client</artifactId>
<version>4.2.2.GA</version>
</dependency>

This is my first ManagedBean:


And this is the context.xml:


But as soon as I try to access the RemoteBean I get a NullPointerException.

It would be very nice if someone of you could help me to fix my problem.

All the best,
arres
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9495
    
    2

Good that you use the artifacts, but who will provide the implementation for the @EJB annotation? It should be a container that implements the specification and @EJB belongs to the EJB 3.0 specification and JBoss AS 4.2.2.GA does not support EJB 3. Try using JBoss 5.x.x AS.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
hal arres
Ranch Hand

Joined: Jan 10, 2003
Posts: 30
Hi Jothi,

thanks for your fast answer.
Luckily I have a JBoss 5.1.0.GA installed, but using this AS I get the same behaviour as in the 4.2.2.GA.

In the Tomcat I switched to the follwoing artefact:
<dependency>
<groupId>org.jboss.client</groupId>
<artifactId>jbossall-client</artifactId>
<version>5.0.0.GA</version>
</dependency>

But I still get a NullPointerException
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @EJB Annotation with Tomcat and JBoss