Re: [JBoss-user] java:/comp/env problems?
The java:comp/env namespace is a J2EE notion that applies to both J2EE ejb web components. The ejb spec goes into some detail on this and the j2ee spec generalizes this. The servlet spec briefly mentions the java:comp/env namespace and defers to the j2ee spec. - Original Message - From: Guy Rouillier [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 11, 2001 2:44 PM Subject: Re: [JBoss-user] java:/comp/env problems? I thought the comp/env space was only for use from within EJBs. I could be wrong, though, which is why I'm posting this so those who know can point that out. - Original Message - From: Mike Hoolehan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 11, 2001 12:30 PM Subject: Re: [JBoss-user] java:/comp/env problems? I've had trouble with lookups from web componenets to the comp/env space if I don't have a jboss-web.xml file included in my WEB-INF directory. Try in cluding an empty jboss-web.xml file, like this: ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] java:/comp/env problems?
I've had trouble with lookups from web componenets to the comp/env space if I don't have a jboss-web.xml file included in my WEB-INF directory. Try in cluding an empty jboss-web.xml file, like this: ?xml version=1.0? jboss-web/ I included one, and my lookups suddenly worked. (see a post I dyslexically named env-entry JDNI name) Mike On (11/05/01 06:38), David Ward wrote: Hi all, I'm having a problem where my JSP can't find my ejb when in the java:comp/env namespace in JBoss. In using the pre-configured/bundled JBoss-2.2.1_Tomcat-3.2.1 on RedHat Linux 7.0 (intel), JDK 1.3.0_02, and my EAR I created using the deploytool deploys fine on j2eesdk1.2.1. It's a simple app: a jsp looks up a stateless session ejb which looks up a DataSource pointing at Oracle 8i. I followed the online docs to the T to set up the OracleDS. I've included the pertinant files, but basically, it doesn't look like the jsp can find the ejb when I reference it with java:comp/env/... If I change my references back to not use java:comp/env/, it works on jboss but not on j2eesdk. How can an EAR be completely J2EE portable when this happens? Any suggestions? Also, another problem I'm having though is that (when I change my code so it can find the ejb) my ejb can't seem to find the datasource, though it can in the j2eesdk. Is there something wrong with my jboss.xml file? Thanks for any help (and sorry for the long include below)... David || index.jsp %! private UserAuthority auth = null; public void jspInit() { try { InitialContext ctx = new InitialContext(); Object ref = ctx.lookup(java:comp/env/ejb/UserAuthority); UserAuthorityHome home = (UserAuthorityHome)PortableRemoteObject.narrow(ref, UserAuthorityHome.class); auth = home.create(); } catch (Exception e) { e.printStackTrace(); } } public void jspDestroy() { auth = null; } % || UserAuthorityBean.java private void openConnection() throws NamingException, SQLException { InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup(java:comp/env/jdbc/database); mConnection = ds.getConnection(); } || application.xml ?xml version=1.0 encoding=ISO8859_1? !DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN' 'http://java.sun.com/j2ee/dtds/application_1_2.dtd' application display-nameUserTest/display-name descriptionApplication description/description module web web-uriwar-ic.war/web-uri context-rootuser/context-root /web /module module ejbejb-jar-ic.jar/ejb /module /application || web.xml ?xml version=1.0 encoding=ISO8859_1? !DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN' 'http://java.sun.com/j2ee/dtds/web-app_2.2.dtd' web-app display-nameUserTestWAR/display-name descriptionno description/description session-config session-timeout30/session-timeout /session-config welcome-file-list welcome-fileindex.jsp/welcome-file /welcome-file-list ejb-ref descriptionno description/description ejb-ref-nameejb/UserAuthority/ejb-ref-name ejb-ref-typeSession/ejb-ref-type hometest.UserAuthorityHome/home remotetest.UserAuthority/remote /ejb-ref /web-app || ejb-jar.xml ?xml version=1.0 encoding=ISO8859_1? !DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd' ejb-jar descriptionno description/description display-nameUserAuthorityJAR/display-name enterprise-beans session descriptionno description/description display-nameUserAuthority/display-name ejb-nameUserAuthority/ejb-name hometest.UserAuthorityHome/home remotetest.UserAuthority/remote ejb-classtest.UserAuthorityBean/ejb-class session-typeStateless/session-type transaction-typeBean/transaction-type resource-ref res-ref-namejdbc/database/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /session /enterprise-beans /ejb-jar || jboss.xml jboss enterprise-beans session ejb-nameUserAuthority/ejb-name jndi-nameejb/UserAuthority/jndi-name resource-ref
Re: [JBoss-user] java:/comp/env problems?
For the jsp issue you need to include a jboss-web.xml descriptor in the WEB-INF dir to map the ejb-refs in the web-app.xml descriptor to the deployment jndi name: jboss-web ejb-ref ejb-ref-nameejb/UserAuthority/ejb-ref-name jndi-nameejb/UserAuthority/jndi-name /ejb-ref /jboss-web Your jboss.xml is missing: resource-managers resource-manager res-class=javax.sql.DataSource res-nameOracleDS/res-name res-jndi-namejava:/OracleDS/res-jndi-name /resource-manager /resource-managers - Original Message - From: David Ward [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 11, 2001 6:38 AM Subject: [JBoss-user] java:/comp/env problems? Hi all, I'm having a problem where my JSP can't find my ejb when in the java:comp/env namespace in JBoss. In using the pre-configured/bundled JBoss-2.2.1_Tomcat-3.2.1 on RedHat Linux 7.0 (intel), JDK 1.3.0_02, and my EAR I created using the deploytool deploys fine on j2eesdk1.2.1. It's a simple app: a jsp looks up a stateless session ejb which looks up a DataSource pointing at Oracle 8i. I followed the online docs to the T to set up the OracleDS. I've included the pertinant files, but basically, it doesn't look like the jsp can find the ejb when I reference it with java:comp/env/... If I change my references back to not use java:comp/env/, it works on jboss but not on j2eesdk. How can an EAR be completely J2EE portable when this happens? Any suggestions? Also, another problem I'm having though is that (when I change my code so it can find the ejb) my ejb can't seem to find the datasource, though it can in the j2eesdk. Is there something wrong with my jboss.xml file? Thanks for any help (and sorry for the long include below)... David ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] java:/comp/env problems?
Scott, Thanks! That got rid of all my problems. It now finds everything, all the way down to the datasource, fine. Does anyone know where on the jboss site there are docs that talk about the jboss-web.xml file? There's a big DTD gif outlining jboss.xml, but I dont' remember reading anything about jboss-web.xml... Thanks again, David == Scott M Stark wrote: For the jsp issue you need to include a jboss-web.xml descriptor in the WEB-INF dir to map the ejb-refs in the web-app.xml descriptor to the deployment jndi name: jboss-web ejb-ref ejb-ref-nameejb/UserAuthority/ejb-ref-name jndi-nameejb/UserAuthority/jndi-name /ejb-ref /jboss-web Your jboss.xml is missing: resource-managers resource-manager res-class=javax.sql.DataSource res-nameOracleDS/res-name res-jndi-namejava:/OracleDS/res-jndi-name /resource-manager /resource-managers - Original Message - From: David Ward [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 11, 2001 6:38 AM Subject: [JBoss-user] java:/comp/env problems? Hi all, I'm having a problem where my JSP can't find my ejb when in the java:comp/env namespace in JBoss. In using the pre-configured/bundled JBoss-2.2.1_Tomcat-3.2.1 on RedHat Linux 7.0 (intel), JDK 1.3.0_02, and my EAR I created using the deploytool deploys fine on j2eesdk1.2.1. It's a simple app: a jsp looks up a stateless session ejb which looks up a DataSource pointing at Oracle 8i. I followed the online docs to the T to set up the OracleDS. I've included the pertinant files, but basically, it doesn't look like the jsp can find the ejb when I reference it with java:comp/env/... If I change my references back to not use java:comp/env/, it works on jboss but not on j2eesdk. How can an EAR be completely J2EE portable when this happens? Any suggestions? Also, another problem I'm having though is that (when I change my code so it can find the ejb) my ejb can't seem to find the datasource, though it can in the j2eesdk. Is there something wrong with my jboss.xml file? Thanks for any help (and sorry for the long include below)... David ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/ ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] java:/comp/env problems?
Integrated support for jboss-web.xml independent of the web container was just added recently and so has not been documented. The dtd is available in the jboss cvs module as src/resources/org/jboss/metadata/jboss-web.dtd which can be obtained online at sourceforge. - Original Message - From: David Ward [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, May 11, 2001 11:52 AM Subject: Re: [JBoss-user] java:/comp/env problems? Scott, Thanks! That got rid of all my problems. It now finds everything, all the way down to the datasource, fine. Does anyone know where on the jboss site there are docs that talk about the jboss-web.xml file? There's a big DTD gif outlining jboss.xml, but I dont' remember reading anything about jboss-web.xml... Thanks again, David ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user