Evrika! I have finally did it. The problem was that without using a jboss.xml the local ejbs are mapped under "local".
Basically you have to do a search like this: ##### home = (HandlerHome) initial.lookup("local/HandlerBean"); getServletContext().log("Got reference"); #### I have found this using a jmx-console(which btw, I recommend to everyone on a daily basis). Using the JNDIView MBean, and invoking the list method you get a couple of names. Browse under the global ones and there you are... Btw, how can I use the general context search, i.e. "java:/comp/env/..." c> Hi! c> First of all thanks a lot. I know I made a childish mistake and until c> the money for the official docs will come I have to stick with ones c> I`ve got. c> I finally got the structure right: c> [EMAIL PROTECTED] deploy]$ tree bs.ear c> bs.ear c> |-- META-INF c> | `-- application.xml c> |-- bs-ejb.jar c> | |-- META-INF c> | | |-- ejb-jar.xml c> | | |-- jboss.xml c> | | `-- jbosscmp-jdbc.xml c> | `-- test c> | |-- Handler.class c> | |-- HandlerBean.class c> | `-- HandlerHome.class c> `-- bs-web.war c> |-- WEB-INF c> | `-- web.xml c> |-- index.html c> `-- test.jsp c> 6 directories, 10 files c> And with the application.xml pointing to the proper directions. c> I know have to handle the beans configurations as I finally have a c> different message :). c> Thanks a lot, now I have a starting point. c> P.S. btw, except the payed docs can you recommend something else? c> P.P.S how important are the payed docs? (on a scale from 1 to 10)? AS>> First of the names of the beans should match in your AS>> ejb-jar.xml (HandlerBean) and jbosscmp-jdbc.xml (you have TestBean) AS>> Second of all I am not sure if you can deploy your app in AS>> a single war. My suspision is that you would nedd to break AS>> it up on war [put your web stuff in here] and ejb.jar [put AS>> your ejbs in here] then merge them together into ear. AS>> Basically the structure should look something like the following: AS>> your-ejb.jar AS>> test/ AS>> YourEjb.class AS>> META-INF/ AS>> jbosscmp-jdbc.xml AS>> jboss.xml AS>> ejb-jar.xml AS>> your-app.war AS>> index.jsp AS>> WEB-INF/ AS>> web.xml AS>> jbossweb.xml AS>> lib/ AS>> ejb-client.jar AS>> app.ear AS>> your-app.war AS>> your-ejb.jar AS>> MEAT-INF/ AS>> application.xml AS>> and you only copy app.ear into deploy directory AS>> you basically have anywhere from 3 to 6 xml descriptors AS>> to figure out :-) AS>> ejb-jar.xml [required] AS>> web.xml [required] AS>> application.xml [required] AS>> jbosscmp-jdbc.xml [optional] AS>> jboss.xml [optional] AS>> jbossweb.xml [optional] >>> -----Original Message----- >>> From: [EMAIL PROTECTED] >>> [mailto:[EMAIL PROTECTED] Behalf Of costin >>> Sent: Wednesday, February 26, 2003 7:33 AM >>> To: [EMAIL PROTECTED] >>> Subject: [JBoss-user] help with bounding entity bean >>> >>> >>> Hi! >>> >>> I know that there are responses on the list for this kind of >>> problem but there is no archive...yet. >>> >>> I am new to JBoss after moving from Resin EE and I am trying to get >>> the hand of it - especially in the deployment area. >>> >>> I have read a lot of tutorials based on ant (includind the official >>> doc) but I can`t make the entity bean bound. >>> >>> I have been banging my head agains the wall for the last day and it`s >>> starting to hurt really bad so any help will be greatly appreciated. >>> >>> >>> Okay, before giving the details here is the behaviour: >>> >>> the war is deployed okay and I can see the index.html page. The bean >>> classes are very simple - I have listed them at the end of the >>> message. The problem is that when I am accessing the jsp I cannot >>> get the entity bean reference: >>> >>> <snip from the log - the extra logging is from the jsp> >>> >>> 14:11:10,217 INFO [jbossweb] Started >>> WebApplicationContext[/bs,file:/usr/local/jboss-3.0.6/server/defau >>> lt/deploy/bs.war/] >>> 14:11:10,394 INFO [jbossweb] successfully deployed >>> file:/usr/local/jboss-3.0.6/server/default/deploy/bs.war/ to /bs >>> 14:11:10,394 INFO [MainDeployer] Deployed package: >>> file:/usr/local/jboss-3.0.6/server/default/deploy/bs.war/ >>> 14:11:31,375 INFO [jbossweb] Registered >>> jboss.web:Jetty=0,HttpContext=0,context=/ >>> 14:11:31,389 INFO [jbossweb] Registered >>> jboss.web:Jetty=0,HttpContext=0,context=/,RootNotFoundHandler=0 >>> 14:11:31,390 INFO [jbossweb] Started HttpContext[/] >>> 14:11:44,567 INFO [jbossweb] Got context >>> 14:11:44,644 WARN [jbossweb] WARNING: Naming Exception 1046261504621 >>> javax.naming.NameNotFoundException: HandlerBean not bound >>> at org.apache.jsp.test$jsp.jspInit(test$jsp.java:52) >>> at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:90) >>> at >>> org.apache.jasper.servlet.JspServlet$JspServletWrapper.load(JspSer >>> vlet.java:142) >>> at >>> org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNeces >>> sary(JspServlet.java:178) >>> at >>> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(Jsp >>> Servlet.java:188) >>> at >>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381) >>> at >>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473) >>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) >>> at >>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360) >>> at >>> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplic >>> ationHandler.java:280) >>> at >>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:553) >>> at org.mortbay.http.HttpContext.handle(HttpContext.java:1717) >>> at >>> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicat >>> ionContext.java:549) >>> at org.mortbay.http.HttpContext.handle(HttpContext.java:1667) >>> at org.mortbay.http.HttpServer.service(HttpServer.java:862) >>> at org.jboss.jetty.Jetty.service(Jetty.java:497) >>> at >>> org.mortbay.http.HttpConnection.service(HttpConnection.java:759) >>> at >>> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:923) >>> at org.mortbay.http.HttpConnection.handle(HttpConnection.java:776) >>> at >>> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:202) >>> at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289) >>> at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455) >>> >>> 14:11:44,645 INFO [jbossweb] Naming Exception 1046261504621: >>> javax.naming.NameNotFoundException: HandlerBean not bound >>> >>> </snip> >>> >>> Here`s is my configuration: >>> >>> jboss-3.0.6 on RH 7.3 >>> >>> $ java -version >>> java version "1.4.1_01" >>> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01) >>> Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode) >>> >>> I have configured jboss with mysql using the samples xml and here >>> goes the application. >>> >>> I have a very light entity bean that is being called by a jsp. The >>> directory structure is: >>> >>> $ tree bs >>> >>> bs >>> |-- META-INF >>> | |-- ejb-jar.xml >>> | `-- jbosscmp-jdbc.xml >>> |-- WEB-INF >>> | `-- web.xml >>> |-- index.html >>> |-- test >>> | |-- Handler.class >>> | |-- HandlerBean.class >>> | `-- HandlerHome.class >>> `-- test.jsp >>> >>> 3 directories, 8 files >>> >>> I have symlinked the directory to >>> $JBOSS_HOME/server/default/deploy/bs.war >>> >>> The sources are as follow: >>> >>> #### test.jsp >>> >>> <%@ page import="javax.ejb.*,javax.naming.*,test.*, java.util.*" %> >>> <html> >>> <%! >>> HandlerHome home; >>> >>> public void jspInit() >>> { >>> try >>> { >>> >>> // Get a naming context >>> InitialContext initial = new InitialContext(); >>> >>> getServletContext().log("Got context"); >>> >>> home = (HandlerHome) initial.lookup("HandlerBean"); >>> getServletContext().log("Got reference"); >>> } >>> catch (NamingException e) >>> { >>> getServletContext().log("Naming Exception >>> "+System.currentTimeMillis(), >>> >>> e.fillInStackTrace()); >>> } >>> } >>> %> >>> >>> <% >>> %> >>> </html> >>> >>> ########################## >>> >>> As you can see this jsp only get`s the context and then a reference to >>> the entity bean. >>> >>> The deployment files is listed here: >>> >>> ########### ejb-jar.xml >>> <?xml version="1.0" encoding="UTF-8"?> >>> <!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> >>> <entity> >>> >>> <ejb-name>HandlerBean</ejb-name> >>> >>> <local-home>test.HandlerHome</local-home> >>> <local>test.Handler</local> >>> <ejb-class>test.HandlerBean</ejb-class> >>> >>> <persistence-type>Container</persistence-type> >>> <cmp-version>2.x</cmp-version> >>> <reentrant>True</reentrant> >>> >>> <prim-key-class>java.lang.String</prim-key-class> >>> <primkey-field>entry</primkey-field> >>> >>> <abstract-schema-name>ejbtest</abstract-schema-name> >>> >>> <cmp-field> >>> <field-name>entry</field-name> >>> </cmp-field> >>> <cmp-field> >>> <field-name>name</field-name> >>> </cmp-field> >>> >>> </entity> >>> >>> </enterprise-beans> >>> >>> </ejb-jar> >>> ##################################### >>> ##################### jboss-cmp >>> <?xml version="1.0" encoding="UTF-8"?> >>> <!DOCTYPE jbosscmp-jdbc PUBLIC >>> "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN" >>> "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd"> >>> >>> <jbosscmp-jdbc> >>> >>> <enterprise-beans> >>> >>> <entity> >>> <ejb-name>TestBean</ejb-name> >>> <table-name>TestBean</table-name> >>> >>> <cmp-field> >>> <field-name>entry</field-name> >>> <column-name>entry</column-name> >>> </cmp-field> >>> <cmp-field> >>> <field-name>name</field-name> >>> <column-name>name</column-name> >>> </cmp-field> >>> >>> </entity> >>> >>> </enterprise-beans> >>> >>> </jbosscmp-jdbc> >>> ################# >>> >>> >>> the classes: >>> >>> ################# Handler.java >>> package test; >>> >>> import javax.ejb.EJBLocalObject; >>> >>> public interface Handler extends EJBLocalObject >>> { >>> public String getName(); >>> void setName(String name); >>> >>> public String getEntry(); >>> void setEntry(String id); >>> } >>> ############## >>> >>> ################# HandlerBean.java >>> package test; >>> >>> import javax.ejb.*; >>> >>> public abstract class HandlerBean implements EntityBean { >>> >>> public abstract String getName(); >>> public abstract void setName(String name); >>> >>> public abstract String getEntry(); >>> public abstract void setEntry(String id); >>> >>> >>> public String ejbCreate(String id, String name) >>> throws CreateException >>> { >>> setEntry(id); >>> setName(name); >>> >>> return null; >>> } >>> >>> public void ejbPostCreate(String name, String id) >>> { >>> } >>> >>> } >>> ########################### >>> ##################### HandlerHome.java >>> package test; >>> >>> import javax.ejb.EJBLocalHome; >>> import javax.ejb.CreateException; >>> import javax.ejb.FinderException; >>> >>> public interface HandlerHome extends EJBLocalHome >>> { >>> public Handler create(String id, String name) >>> throws CreateException; >>> >>> public Handler findByPrimaryKey(String entry) >>> throws FinderException; >>> >>> } >>> ############################## >>> >>> >>> P.S. Sorry about this huge email. >>> >>> >>> -- >>> Thanks, >>> costin >>> >>> >>> >>> ------------------------------------------------------- >>> This SF.net email is sponsored by: Scholarships for Techies! >>> Can't afford IT training? All 2003 ictp students receive scholarships. >>> Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more. >>> www.ictp.com/training/sourceforge.asp >>> _______________________________________________ >>> JBoss-user mailing list >>> [EMAIL PROTECTED] >>> https://lists.sourceforge.net/lists/listinfo/jboss-user >>> AS>> ------------------------------------------------------- AS>> This SF.net email is sponsored by: Scholarships for Techies! AS>> Can't afford IT training? All 2003 ictp students receive scholarships. AS>> Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more. AS>> www.ictp.com/training/sourceforge.asp AS>> _______________________________________________ AS>> JBoss-user mailing list AS>> [EMAIL PROTECTED] AS>> https://lists.sourceforge.net/lists/listinfo/jboss-user -- costin mailto:[EMAIL PROTECTED] ------------------------------------------------------- This SF.net email is sponsored by: Scholarships for Techies! Can't afford IT training? All 2003 ictp students receive scholarships. Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more. www.ictp.com/training/sourceforge.asp _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user