IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Java EE Discussion :

EJB déploiement WebSphere


Sujet :

Java EE

  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    358
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 358
    Par défaut EJB déploiement WebSphere
    Bonjour,

    Je suis actuellement sur un projet perso, j'aimerai monter un projet de dev. J'ai crée les pom etc.. J'ai crée un EJB simple, mais lorsque je vais sur la page jsp, j'ai une erreur :

    [17/04/13 23:58:52:760 CEST] 00000058 RequestProces E org.apache.struts.action.RequestProcessor processActionCreate No action instance for path /hello could be created
    javax.naming.NameNotFoundException: Context: LFR407524Node01Cell/nodes/LFR407524Node01/servers/server1, name: HelloBean: First component in name HelloBean not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
    at com.ibm.ws.naming.jndicos.CNContextImpl.mapNotFoundException(CNContextImpl.java:4563)
    at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1821)
    at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1776)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1433)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:615)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:165)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179)
    at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)
    at javax.naming.InitialContext.lookup(InitialContext.java:436)
    at org.xinotes.HelloAction.<init>(HelloAction.java:23)
    at java.lang.J9VMInternals.newInstanceImpl(Native Method)
    at java.lang.Class.newInstance(Class.java:1357)
    at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:143)
    at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:292)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:230)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3748)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1814)
    Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
    at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:568)
    at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:2169)
    at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(_NamingContextStub.java:538)
    at com.ibm.ws.naming.jndicos.CNContextImpl$2.run(CNContextImpl.java:2957)
    at com.ibm.ws.naming.jndicos.CNContextImpl$2.run(CNContextImpl.java:2953)
    at com.ibm.ws.naming.util.CommonHelpers.retry(CommonHelpers.java:801)
    at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:2951)
    at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1817)
    ... 41 more

    [17/04/13 23:58:52:783 CEST] 00000058 webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[action]: com.ibm.ws.webcontainer.webapp.WebAppErrorReport: No action instance for path /hello could be created
    at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendError(WebAppDispatcherContext.java:626)
    at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendError(WebAppDispatcherContext.java:656)
    at com.ibm.ws.webcontainer.srt.SRTServletResponse.sendError(SRTServletResponse.java:1255)
    at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:300)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:230)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3748)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1814)

    Classe struts
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
     
    package org.xinotes;
     
    import java.io.IOException;
     
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
     
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.xinotes.ejb.Hello;
     
    public class HelloAction extends Action {
        Hello helloEjb;
     
        public HelloAction() throws NamingException {
            Context ctx = new InitialContext();
            helloEjb = (Hello) ctx.lookup("HelloBean");
        }
     
        public ActionForward execute(ActionMapping map,
    				 ActionForm form,
    				 HttpServletRequest req,
    				 HttpServletResponse resp)
    			 throws IOException, 
                                    ServletException {
    	HelloForm f = (HelloForm) form;
    	String message = helloEjb.sayHello(f.getName());
    	req.setAttribute("message", message);
    	return map.findForward("hello");
        }
    }
    Interface
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    package org.xinotes.ejb;
     
    import javax.ejb.Local;
     
    @Local
    public interface Hello {
        public String sayHello(String name);
    }
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
     
    package org.xinotes.ejb;
     
    import javax.ejb.Stateless;
    import javax.ejb.Local;
     
    @Stateless
    public class HelloBean implements Hello {
        public HelloBean() {
        }
     
        public String sayHello(String name) {
    	return "Hello " + name + "!";
        }
    }
    ejb jar
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
     
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
    	version="3.0">
     
    	<enterprise-beans>
    		<session>
    			<ejb-name>HelloBean</ejb-name>
    			<ejb-class>org.xinotes.ejb.HelloBean</ejb-class>
    <!--			<env-entry>
    				<env-entry-name>serverName</env-entry-name>
    				<env-entry-type>java.lang.String</env-entry-type>
    				<env-entry-value>productionserver</env-entry-value>
    			</env-entry>-->
    		</session>
    	</enterprise-beans>
    </ejb-jar>
    web.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
     
    <!DOCTYPE web-app PUBLIC
     "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
     "http://java.sun.com/dtd/web-app_2_3.dtd" >
     
    <web-app>
      <display-name>Archetype Created Web Application</display-name>
     
      <servlet>
          <servlet-name>action</servlet-name>
          <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
          <init-param>
              <param-name>config</param-name>
              <param-value>/WEB-INF/struts-config.xml</param-value>
          </init-param>
          <load-on-startup>1</load-on-startup>
      </servlet>
     
      <servlet-mapping>
          <servlet-name>action</servlet-name>
          <url-pattern>*.do</url-pattern>
      </servlet-mapping>
    </web-app>
    struts-config
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
     
    <?xml version="1.0" encoding="ISO-8859-1" ?>
     
    <!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
    "http://struts.apache.org/dtds/struts-config_1_3.dtd">
     
     
     
    <struts-config>
        <form-beans>
            <form-bean name="helloForm" type="org.xinotes.HelloForm" />
        </form-beans>
     
        <global-forwards>
            <forward name="index" path="/jsp/index.jsp"/>
        </global-forwards>
     
     
     
        <action-mappings>
            <action
                path="/index"
    	    name="helloForm"
                type="org.apache.struts.actions.ForwardAction"
                parameter="/jsp/index.jsp"
                validate="false">
            </action>
     
            <action path="/hello"
    		name="helloForm"
    		scope="request"
    		type="org.xinotes.HelloAction"
    		validate="false">
                <forward name="hello" path="/jsp/hello.jsp" />
            </action>
        </action-mappings>
    </struts-config>
    index.jsp

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
     
    <html>
    <body>
        <html:form action="/hello" method="post">
    	Enter Name: <html:text property="name"/>
    	<br/>
    	<input type="submit" name="submit" value="Go"/>
        </html:form>
    </body>
    </html>
    ensuite je fais un mvn package, je déploie mon ear depuis la console admin du WAS et j'accède à l'écran d'accueil puis je lance mon formulaire, et là j'obtiens mon erreur.


    savez-vous d'où peut provenir le problème ?

    j'ai déjà manipulé des ejb, mais c'est la première fois que je dois en déployer.

    J'ai du certainement oublié des choses.

    merci d'avance.

  2. #2
    Membre éclairé
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    358
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 358
    Par défaut
    quand je met ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
            helloEjb = (Hello) ctx.lookup("ejblocal:org.xinotes.ejb.Hello");
    ça passe, sauf que Hello est une interface, comment il fait pour faire le lien entre le Hello et HelloBean, car il affiche bien ce qu'il y a dans la méthode de HelloBean

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     public String sayHello(String name) {
    	return "Hello " + name + "!";
        }
    avez-vous une idée ?

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    358
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 358
    Par défaut
    c'est bon, j'ai pigé

    c'est grâce au fichier ejb-jar.xml où je défini l'ejb bean.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Appel EJB sur Websphere à partir de Glassfish
    Par Fendal dans le forum Glassfish et Payara
    Réponses: 0
    Dernier message: 11/01/2012, 15h21
  2. [log4j] Erreur LOG4J lors d'un déploiement Websphere
    Par Dirty Henry dans le forum Websphere
    Réponses: 4
    Dernier message: 05/09/2007, 17h44
  3. [Normes] versions de J2EE/EJB et Websphere
    Par 2510041 dans le forum Websphere
    Réponses: 1
    Dernier message: 19/09/2006, 12h34
  4. [ ejb ] websphere
    Par hocinema dans le forum Websphere
    Réponses: 1
    Dernier message: 05/03/2004, 10h18

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo