Hey :) I see sweet xdoclet code :)) Try to interchange COMP_NAME with JNDI_NAME in looking up and it'll get your Controller! Look at JNDIView bounding and compare the value with COMP_NAME and JNDI_NAME.
alex > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of manish > sharan > Sent: Thursday, February 28, 2002 9:40 PM > To: [EMAIL PROTECTED] > Subject: [JBoss-user] NameNotFound Exception even though the ejb seems > to be bound ok > > > > Hi all , > > > My struts action class always fails to get the Home Object > reference. Its > always returns NameNotFound Exception SiteContoller is not > bound. I think > the ejb is bound as I can see it at http://localhost:8082 > (snippet at the > bottom). > > I have read the manuals and the book and searched the forums > but I couldn't > find a fix ; I hope that one of you JBos user experts will be > able to figure > out what I missed. > . > > I my ear file contais the ejb jar file and the war file. The > war file > contains all the action code as well as the ejb interfaces. > > This is the method that I use to fetch the object > > > > public SiteControllerHome getHome1( Hashtable environment ) throws > NamingException > { > String COMP_NAME="java:comp/env/ejb/SiteController"; > String JNDI_NAME="ejb/SiteController"; > > SiteControllerHome home=null; > System.out.println(" trying "+COMP_NAME); > try{ > Object objRef = > getParameterisedInitialContext(environment).lookup(COMP_NAME); > home = > (SiteControllerHome)PortableRemoteObject.narrow(objRef, > SiteControllerHome.class); > } > catch(Exception e){ > logger.error("failed to get for "+COMP_NAME); > logger.error(e); > } > > return home; > } > > // this is how initilize the environment > Hashtable getContext(){ > Hashtable ht = new Hashtable(); > > ht.put("java.naming.factory.initial","org.jnp.interfaces.Namin > gContextFactory"); > ht.put("java.naming.provider.url","localhost:1099"); > ht.put("java.naming.factory.url.pkgs","org.jboss.naming"); > return ht; > > } > > --------------web.xml snippet--------------- > <ejb-ref> > <description><![CDATA[This is a SiteController > bean.]]></description> > <ejb-ref-name>ejb/SiteController</ejb-ref-name> > <ejb-ref-type>Session</ejb-ref-type> > > <home>com.transethnic.controller.sitecontroller.SiteController > Home</home> > > <remote>com.transethnic.controller.sitecontroller.SiteControll > er</remote> > <ejb-link>SiteController</ejb-link> > </ejb-ref> > > --------------ejb-jar.xml snippet for the session bean--------------- > > <session id="SiteController"> > <description><![CDATA[This is a SiteController > bean.]]></description> > > <ejb-name>SiteController</ejb-name> > > > <home>com.transethnic.controller.sitecontroller.SiteController > Home</home> > > <remote>com.transethnic.controller.sitecontroller.SiteControll > er</remote> > > <local-home>com.transethnic.controller.sitecontroller.SiteCont > rollerLocalHome</local-home> > > <local>com.transethnic.controller.sitecontroller.SiteControlle > rLocal</local> > > <ejb-class>com.transethnic.controller.sitecontroller.SiteContr > ollerSession</ejb-class> > <session-type>Stateless</session-type> > <transaction-type>Container</transaction-type> > > <ejb-local-ref> > <ejb-ref-name>ejb/FolderLocal</ejb-ref-name> > <ejb-ref-type>Entity</ejb-ref-type> > > <local-home>com.transethnic.entity.folder.FolderLocalHome</local-home> > <local>com.transethnic.entity.folder.FolderLocal</local> > <ejb-link>Folder</ejb-link> > </ejb-local-ref> > <ejb-local-ref> > <ejb-ref-name>ejb/PageLocal</ejb-ref-name> > <ejb-ref-type>Entity</ejb-ref-type> > > <local-home>com.transethnic.entity.page.PageLocalHome</local-home> > <local>com.transethnic.entity.page.PageLocal</local> > <ejb-link>Page</ejb-link> > </ejb-local-ref> > > <resource-ref> > <res-ref-name>jdbc/DBPool</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > > </session> > > --------------jboss.xml snippet------------------------- > > <session> > <ejb-name>SiteController</ejb-name> > <jndi-name>ejb/SiteController</jndi-name> > <configuration-name>Standard Stateless > SessionBean</configuration-name> > <resource-ref> > <res-ref-name>jdbc/DBPool</res-ref-name> > <resource-name>MyDataSourceManager</resource-name> > </resource-ref> > </session> > > ------------ from localhost:8082--------------------- > (it does show siteconroller bean --- is it Bound correctly?? > * Management > > * jndiName=NonOptimized > * jndiName=Optimized > * jndiName=com.transethnic.messagedriven.traillogger.TrailLogger > * jndiName=ejb/AccountController > * jndiName=ejb/Address > * jndiName=ejb/Content > * jndiName=ejb/ContentController > * jndiName=ejb/Converter > * jndiName=ejb/Folder > * jndiName=ejb/Link > * jndiName=ejb/OfficeController > * jndiName=ejb/Organization > * jndiName=ejb/Page > * jndiName=ejb/SiteController > * jndiName=ejb/TrackingController > * jndiName=ejb/Trail > * jndiName=ejb/User > * service=Collector > > > Any help would be much appreciated. Thanks ! > > regards > -manish > > > > > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
