I meant "adminManager".

--
Samuel Santos
http://www.samaxes.com/


On Wed, May 27, 2009 at 2:49 PM, Samuel Santos <sama...@gmail.com> wrote:

> Last time I checked JBoss 5, the annotation @LocalBinding was not working
> or supported.
> Can't remember anymore.
>
> Can you check in your jmx-console the bean JNDI name? Is it "AdminManager
> "?
>
> --
> Samuel Santos
> http://www.samaxes.com/
>
>
> On Wed, May 27, 2009 at 10:11 AM, CHEVILLON Paulin (Stagiaire IGTL) <
> ext.stagiaire.paulin.chevil...@sncf.fr> wrote:
>
>>  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-class>
>>
>>             <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 pièces jointes sont établis à l'intention
>> exclusive de ses destinataires et sont confidentiels. L'intégrité de ce
>> message n'étant pas assurée sur Internet, la SNCF ne peut être tenue
>> responsable des altérations qui pourraient se produire sur son contenu.
>> Toute publication, utilisation, reproduction, ou diffusion, même partielle,
>> non autorisée préalablement par la SNCF, est strictement interdite. Si vous
>> n'êtes pas le destinataire de ce message, merci d'en avertir immédiatement
>> l'expéditeur et de le détruire.
>> -------
>> 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
>>
>>
>
------------------------------------------------------------------------------
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