Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@EJB Annotation with Tomcat and JBoss

 
hal arres
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10091
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
hal arres
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic