2 Replies Latest reply on Jun 18, 2007 1:00 PM by cmogentale

    problem looking up my session ejb

    cmogentale

      H i!

      i've been experimenting issues for a week while trying to access my session ejb (MediasBean, implements Media) from a jsp page. deployment is successful thought. the jboss server is on my local machine as well as the mysql database in which data is persisted.

      this is the error message i encounter at the address http://localhost:8080/medias/index.jsp :


      21:48:27,747 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
      21:48:28,090 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=medias-beans.ejb3,name=MediasBean,service=EJB3 with dependencies:
      21:48:28,090 INFO [JmxKernelAbstraction] persistence.units:jar=medias-beans.ejb3.jar,unitName=hpdb
      21:48:28,246 INFO [EJBContainer] STARTED EJB: org.jboss.projectland.MediasBean ejbName: MediasBean
      21:48:28,331 INFO [EJB3Deployer] Deployed: file:/home/ark/jboss-4.0.5.GA/server/default/deploy/medias-beans.ejb3
      21:48:28,339 INFO [TomcatDeployer] deploy, ctxPath=/medias, warUrl=.../tmp/deploy/tmp6640medias-exp.war/
      21:48:47,581 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
      javax.naming.NameNotFoundException: org.jboss.projectland.MediasBean not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      ....


      here is the jsp code :


      <%@ page import = "javax.naming.Context" %>
      <%@ page import = "javax.naming.InitialContext" %>
      <%@ page import = "java.util.Properties" %>
      <%@ page import = "org.jboss.projectland.*" %>
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>TEST</title>
      </head>
      <body>
      <%
      Context ctx=new InitialContext();
      Medias medias = (Medias) ctx.lookup(MediasBean.class.getName()+"/remote");
      %>


      here is my MediasBean code :


      package org.jboss.projectland;
      import javax.ejb.Remote;
      @Remote
      public interface Medias {
      public Type_media addTypeMedia(String name);
      public Media addMedia(Type_media typeMedia,String mediaName);
      ...
      }



      jndiview in jboss returns :


      ...
      +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
      +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
      +- MediasBean (class: org.jnp.interfaces.NamingContext)
      | +- remote (proxy: $Proxy73 implements interface org.jboss.projectland.Medias,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)

      +- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
      ..


      i can't figure out what's going wrong .. thought i searched a lot . can you help me ?
      thanks in advance and keep up the good work.

      christophe

        • 1. Re: problem looking up my session ejb
          jaikiran

           

          +- MediasBean (class: org.jnp.interfaces.NamingContext)
          | +- remote (proxy: $Proxy73 implements interface org.jboss.projectland.Medias,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)


          Medias medias = (Medias) ctx.lookup(MediasBean.class.getName()+"/remote");


          Change your lookup code to:

          Medias medias = (Medias) ctx.lookup("MediasBean/remote");




          • 2. Re: problem looking up my session ejb
            cmogentale

            it worked ! Thanks a lot !!! i'm such a fool not having tried this earlier.
            thanks anyway.

            christophe