Can someone please confirm what is required to use a session Bean from a JSP, all 
deplayed on JBoss 3.2.5.

I'm continually getting
Error.javax.naming.NameNotFoundException: comp not bound

I've got the default jndi.properties file in conf in the classpath.

Also tried this method in the JSP:
  public static Context getInitialContext() throws javax.naming.NamingException {
       java.util.Properties p = new java.util.Properties();
       p.put(Context.INITIAL_CONTEXT_FACTORY, 
"org.jnp.interfaces.NamingContextFactory");
       p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
       p.put(Context.PROVIDER_URL, "localhost:1099");
       return new javax.naming.InitialContext(p);     
  }

Code segment in the JSP
try {
             Context jndiContext = getInitialContext(); 
             Object ref = jndiContext.lookup("java:comp/env/ejb/UnwyAppHome");
           
           UnwyAppHome home = (UnwyAppHome)
           PortableRemoteObject.narrow(ref,UnwyAppHome.class);
           UnwyApp unwyApp = home.create();
 
Then added a jboss.xml although I thought it was optional.
jboss.xml
<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" 
"http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd";>

     <enterprise-beans>
       
         <ejb-name>UnwyAppBean</ejb-name>
         <jndi-name>UnwyAppHome</jndi-name>
       
       
         <ejb-name>UnwyBean</ejb-name>
         <jndi-name>UnwyLocalHome</jndi-name>
       
     </enterprise-beans>


ejb-jar.xml
<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" 
"http://java.sun.com/dtd/ejb-jar_2_0.dtd";>
<ejb-jar>
  <enterprise-beans>
    
      Session Bean ( Stateful )
      <display-name>UnwyApp</display-name>
      <ejb-name>UnwyApp</ejb-name>
      unwy.model.UnwyAppHome
      unwy.model.UnwyApp
      <ejb-class>unwy.model.UnwyAppBean</ejb-class>
      <session-type>Stateful</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-local-ref>
        <ejb-ref-name>ejb/local/Unwy</ejb-ref-name>
        <ejb-ref-type>Entity</ejb-ref-type>
        <local-home>unwy.model.UnwyLocalHome</local-home>
        unwy.model.UnwyLocal
        <ejb-link>Unwy</ejb-link>
      </ejb-local-ref>
    
    ....

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3847674#3847674

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3847674


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to