When you're looking up an ejb from a JSP (I assume the JSP is inside a war),
you must have ejb-ref elements in your web.xml file. You can either insert
these using XDoclet and putting @web:ejb-ref/@web:ejb-local-ref in one of
the classes that go into your war file (struts actions, servlets, whatever
you're using). If you don't have that, and only use jsp, you'll have to add
it to your web.xml by hand.

If you're not packaging your jsps inside a war at all, you'll have to look
up by JNDI name and not COMP name. See Sun's EJB/Servlet spec for details.
If this is the case, I recommend you check out Struts or WebWork Web MVC
frameworks. It's generally considered poor design to talk with EJBs from
JSPs. Check out some J2EE patterns. You'll find them on Sun's site and
theserverside.com

For the future, please consider more carefully whether your question is
XDoclet relevant when posting here. This is not a mailing list for general
J2EE/App server questions. It's for XDoclet. This question for example would
be more appropriate on http://newsgroups.bea.com/.

Good luck!

Aslak

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Grant
Marblestone
Sent: 17. april 2002 22:35
To: [EMAIL PROTECTED]
Subject: [Xdoclet-user] Help...getting javax.naming.NamingException.
WebLogic 6.1


We are starting to put Xdoclet generated Session Beans (see snip 1 below)
onto WebLogic 6.1 and we are getting Naming exceptions (see snip 2 below)
when we call this Bean from a jsp page (see snip 3) as a simple test. I'm
wondering how to browse the comp:env tree or how to write this xdoclet
correctly as I have been referring to the TellerBean example and trying to
duplicate that. I'm also thinking the jsp is perhaps not as simple as I've
designed it here. TIA for any help. I'll provide more info if needed and
what I've tried. To be brief, that's all folks!




////////////////////////////////////////SNIP
1///////////////////////////////////

/**
 *
 * @ejb:bean type="Stateless"
 *      name="cms/PersistenceFacade"
 *       jndi-name="com/atser/ejb/PersistenceFacade"
 *
 * @ejb:ejb-ref ejb-name="cms/RfiHome"
 * @ejb:ejb-ref ejb-name="cms/Rfi"
 * @ejb:transaction type="Required"
 * @ejb:transaction-type type="Container"
 * @ejb:resource-ref res-name="middlegen.database"
res-type="javax.sql.DataSource" res-auth="Container"
 *
 * @jboss:container-configuration name="Standard Stateless SessionBean"
 * @jboss:ejb-ref-jndi ref-name="cms/PersistenceFacade"
jndi-name="ejb/cms/PersistenceFacade"
 *
 * @weblogic:pool
 *    max-beans-in-free-pool="3"
 *    initial-beans-in-free-pool="1"
 *
 */

////////////////////////////////////////SNIP 2: WebLogic command onsole
////////////////////////////////////
javax.naming.NameNotFoundException: Unable to resolve
comp/env/cms/PersistenceFacadeStatelessLocal Resolved: 'comp/env'
Unresolved:'cms'
; remaining name 'PersistenceFacadeStatelessLocal'
        at
weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingN
ode.java:887)


////////////////////////////////////////SNIP 3: JSP file
//////////////////////////////////////
<%@ page
import="com.atser.interfaces.*,java.util.*,java.math.*,javax.ejb.*"%>
<%

 try
 {
  PersistenceFacadeStatelessLocalHome home =
PersistenceFacadeStatelessUtil.getLocalHome();
  PersistenceFacadeStatelessLocal persistence = home.create();

  HashMap hm = new HashMap();
  hm.put("param1",new BigDecimal(6666));
    persistence.storeData("Rfi",hm);

  hm = new HashMap();
  hm.put("param1",new BigDecimal(6667));
  persistence.storeData("Rfi",hm);
  out.println("Stored! Check your database for 6666 and 6667");
 }
 catch(Exception e)
 {
  e.printStackTrace();
 }
%>


_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to