Hello,

 

I've kind of problem with EJB3 injection using stripes. I'm new to this
framework, and I have to mention that I'm neither familiar with Struts
use. My JEE web experience comes from Seam use only. So it's strongly
possible I'm missing something in this stripes use case.

 

Environment description:

- JDK 1.6

- JBoss 5.0.1 GA (for JVM 1.6)

 

Project structure:

--> EAR

    --> WAR : contains stripes ActionBeans, jsp, etc

    --> EJB-JAR : contains EJB 3.0 both entity & business Beans

 

Problem:

I want to access a Stateless Bean from a Stripes ActionBean. I followed
the documentation to use EJB3 Interceptor, but no EJB instance is
injected into my ActionBean EJB field (field remains null). It seems to
have no JNDI resolution problem (verified with the JMX-console in
JBoss).

 

So here is my code, if someone can help...

 

Thanks, 

Regards,

PC

 

 

web.xml:

<filter>

            <display-name>Stripes Filter</display-name>

            <filter-name>StripesFilter</filter-name>

 
<filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-c
lass>

            <init-param>

                        <param-name>Interceptor.Classes</param-name>

                        <param-value>

                                   com.samaxes.stripejb3.EJBInterceptor

                        </param-value>

            </init-param>

            <init-param>

                        <param-name>ActionResolver.Packages</param-name>

 
<param-value>com.sncf.igtl.re.promet.server.admin</param-value>

            </init-param>    

</filter>

 

index.jsp:

 

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ taglib prefix="stripes"
uri="http://stripes.sourceforge.net/stripes.tld"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>

<html>

<head>

            <title>My First Stripe</title>

                        <style type="text/css">

                                   input.error { background-color:
yellow; }

                        </style>

            </head>

            <body>

            <h1>Stripes Test</h1>

 

   

            <stripes:form
beanclass="com.sncf.igtl.re.promet.server.admin.TestActionBean">

                        <c:forEach items="${test.list}" var="number"
varStatus="loop">

                                   <p>${number}</p>

                        </c:forEach>

                        <stripes:submit name="refresh" value="Refresh
list"/>

            </stripes:form>

            </body>

</html>

 

 

TestActionBean.java:

 

package com.sncf.igtl.re.promet.server.admin;

 

import java.util.List;

 

import net.sourceforge.stripes.action.ActionBean;

import net.sourceforge.stripes.action.ActionBeanContext;

import net.sourceforge.stripes.action.DefaultHandler;

import net.sourceforge.stripes.action.ForwardResolution;

import net.sourceforge.stripes.action.Resolution;

 

import com.samaxes.stripejb3.EJBBean;

import com.sncf.igtl.re.promet.server.ejb3.admin.AdminManagerLocal;

 

public class TestActionBean implements ActionBean {

            

            public AdminManagerLocal adminManager;

 

            private ActionBeanContext context;

            

            private List<String> list;

            

            public TestActionBean() {}

            

            @EJBBean("adminManager")

            public void setAdminManager(AdminManagerLocal
adminManagerLocal) {

                this.adminManager = adminManagerLocal;

            }

            

            @DefaultHandler

    public Resolution refresh() {

        list = adminManager.getMarcheList();

        return new ForwardResolution("/index.jsp");

    }

 

            @Override public ActionBeanContext getContext() { return
context; }

            @Override public void setContext(ActionBeanContext context)
{ this.context = context; }

            

            public void setList(List<String> list) {

                        this.list = list;

            }

            public List<String> getList() {

                        list = adminManager.getMarcheList();

                        return list;

            }

}

 

EJB Local Interface :

 

package com.sncf.igtl.re.promet.server.ejb3.admin;

import java.util.List;

import javax.ejb.Local;

 

@Local

public interface AdminManagerLocal {

            List<String> getMarcheList();

}

 

EJB Bean :

 

/**

 * Session Bean implementation class ClientAdminManager

 */

@Stateless

@LocalBinding(jndiBinding="adminManager")

public class AdminManager implements AdminManagerLocal {

 

            @PersistenceContext(unitName="3RPEMF")

            private EntityManager em;

 

            @Override

            public List<String> getMarcheList() {

                        List<String> list = new ArrayList<String>();

                        Query q = em.createQuery("from MsgUpPogg");

 

                        for (int i=0; i<q.getResultList().size();i++) {

                                   MsgUpPogg msg =
(MsgUpPogg)q.getResultList().get(i);

                                   list.add(msg.getTrain().getNumber());

                        }

                        return list;

            }           

            /* ... */

}

 




-------
Ce message et toutes les pieces jointes sont etablis a l'intention exclusive de 
ses destinataires et sont confidentiels. L'integralite de ce message n'etant 
pas assuree sur Internet, la SNCF ne peut etre tenue responsable des 
alterations qui pourraient se produire sur son contenu. Toute publication, 
utilisation, reproduction ou diffusion, meme partielle, non autorisee 
prealablement par la SNCF, est strictement interdite. Si vous n'etes pas le 
destinataire de ce message, merci d'en avertir immediatement l'expediteur et de 
le detruire.
-------
This message and any attachments are intended solely for the addressees and are 
confidential. SNCF may not be held responsible for their contents, accuracy and 
completeness which cannot be guaranteed over the Internet. Unauthorized use, 
disclosure, distribution and copying of this message or any part thereof is 
strictly prohibited. If you are not the intended recipient of this message, 
please notify the sender immediately and delete it.
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to