Question

It was my understanding that JBossAS 5.x supported EJB3 bean injection in servlets with the @EJB3 annotation. I'm using the default configuration for JBossAS 5.0.1.GA and it's not working. I've added the mappedName argument to the @EJB annotation with the session beans JNDI name, and it just doesn't do anything. No apparent errors, the bean is just never injected.

The session beans are in the ejb-jar, the servlets in a war, everything is packaged in an ear. Manual JNDI lookups work just fine. Any ideas?

Was it helpful?

Solution

This may happen if your web.xml points to an older version of the spec. Ideally, it should be something like

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
         xmlns="http://java.sun.com/xml/ns/j2ee" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">

This link may help a little too.

OTHER TIPS

You should also check the jar file needed for EJB3 deployment in the classpath.JAr file is jboss-ejb3-ext-api.jar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top