Bugs item #599229, was opened at 2002-08-23 05:57
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=599229&group_id=22866

Category: None
Group: v3.0 Rabbit Hole
Status: Closed
Resolution: Works For Me
Priority: 5
Submitted By: Brian Johnson (johnsbrn)
Assigned to: Nobody/Anonymous (nobody)
Summary: comp/env not available from servlet

Initial Comment:
Using JBoss 3.0.1 (Jetty)  with JDK 1.4 on Windows, the
java:comp/env resources configured in web.xml and
jboss-web.xml (or jboss-web_3_0.xml) are not available
from servlets. Name Not Bound error is returned. I have
seen several postings on the forums related to this,
but no solutions. It also appears to affect other
version of JBoss and Tomcat.

----------------------------------------------------------------------

>Comment By: Scott M Stark (starksm)
Date: 2002-08-26 20:23

Message:
Logged In: YES 
user_id=175228

Jetty is a 2.3 servlet container and it is enforcing the 2.3 dtd 
in the example I gave. Try it with the 2.2 dtd and the latest 3.0 
branch code and see if it downgrades its checking. Else 
open about the real issue.

<!--
The res-auth element specifies whether the web application 
code signs
on programmatically to the resource manager, or whether 
the Container
will sign on to the resource manager on behalf of the web 
application. In the
latter case, the Container uses information that is supplied 
by the
Deployer.

The value of this element must be one of the two following:

   <res-auth>Application</res-auth>
   <res-auth>Container</res-auth>

Used in: resource-ref
-->
<!ELEMENT res-auth (#PCDATA)>


----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2002-08-26 18:47

Message:
Logged In: NO 

I don't see that error message on 3.0.1 or 3.0.2, but it
does seem to work with 3.0.2 and "Container". "CONTAINER" is
automatically generated by JBuilder 6.0. Here is the
relevant portion of the spec:

<!--
The res-auth element indicates whether the application component
code performs resource signon programmatically or whether the
container signs onto the resource based on the principle mapping
information supplied by the deployer.
Must be CONTAINER or SERVLET
-->
<!ELEMENT res-auth (#PCDATA)>

It looks to me like it should be all caps, but I think it
would probably be best to ignore case to eliminate these
types of problems.

----------------------------------------------------------------------

Comment By: Scott M Stark (starksm)
Date: 2002-08-26 17:21

Message:
Logged In: YES 
user_id=175228

You res-auth tag should be Container not CONTAINER. The 
3.0.2 release prints the following error when parsing such a 
web.xml descriptor:

17:19:23,281 ERROR [JettyService] Failed to parse WEB-
INF/web.xml
org.jboss.deployment.DeploymentException: res-auth tag 
should be 'Container' or
'Application'
        at 
org.jboss.metadata.ResourceRefMetaData.importEjbJarXml
(ResourceRefMet
aData.java:112)
        at org.jboss.metadata.WebMetaData.importWebXml
(WebMetaData.java:150)
        at org.jboss.metadata.WebMetaData.importXml
(WebMetaData.java:132)
        at 
org.jboss.web.AbstractWebContainer.parseMetaData
(AbstractWebContainer
.java:874)
        at org.jboss.web.AbstractWebContainer.start
(AbstractWebContainer.java:29
8)
        at org.jboss.deployment.MainDeployer.start
(MainDeployer.java:796)
        at org.jboss.deployment.MainDeployer.start
(MainDeployer.java:788)
        at org.jboss.deployment.MainDeployer.deploy
(MainDeployer.java:616)
        at org.jboss.deployment.MainDeployer.deploy
(MainDeployer.java:580)
        at java.lang.reflect.Method.invoke(Native Method)
        at 
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke
(ReflectedMBea
nDispatcher.java:284)
        at org.jboss.mx.server.MBeanServerImpl.invoke
(MBeanServerImpl.java:517)
        at org.jboss.util.jmx.MBeanProxy.invoke
(MBeanProxy.java:174)
        at $Proxy4.deploy(Unknown Source)
        at 
org.jboss.deployment.scanner.URLDeploymentScanner.depl
oy(URLDeploymen
tScanner.java:427)
        at 
org.jboss.deployment.scanner.URLDeploymentScanner.scan
Directory(URLDe
ploymentScanner.java:648)
        at 
org.jboss.deployment.scanner.URLDeploymentScanner.scan
(URLDeploymentS
canner.java:499)
        at 
org.jboss.deployment.scanner.AbstractDeploymentScanner.
startService(A
bstractDeploymentScanner.java:261)
        at org.jboss.system.ServiceMBeanSupport.start
(ServiceMBeanSupport.java:1
64)
        at java.lang.reflect.Method.invoke(Native Method)
        at 
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke
(ReflectedMBea
nDispatcher.java:284)
        at org.jboss.mx.server.MBeanServerImpl.invoke
(MBeanServerImpl.java:517)
        at 
org.jboss.system.ServiceController$ServiceProxy.invoke
(ServiceControl
ler.java:967)
        at $Proxy0.start(Unknown Source)
        at org.jboss.system.ServiceController.start
(ServiceController.java:396)
        at java.lang.reflect.Method.invoke(Native Method)
        at 
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke
(ReflectedMBea
nDispatcher.java:284)
        at org.jboss.mx.server.MBeanServerImpl.invoke
(MBeanServerImpl.java:517)
        at org.jboss.util.jmx.MBeanProxy.invoke
(MBeanProxy.java:174)
        at $Proxy3.start(Unknown Source)
        at org.jboss.deployment.SARDeployer.start
(SARDeployer.java:249)
        at org.jboss.deployment.MainDeployer.start
(MainDeployer.java:796)
        at org.jboss.deployment.MainDeployer.deploy
(MainDeployer.java:616)
        at org.jboss.deployment.MainDeployer.deploy
(MainDeployer.java:580)
        at org.jboss.deployment.MainDeployer.deploy
(MainDeployer.java:564)
        at java.lang.reflect.Method.invoke(Native Method)
        at 
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke
(ReflectedMBea
nDispatcher.java:284)
        at org.jboss.mx.server.MBeanServerImpl.invoke
(MBeanServerImpl.java:517)
        at org.jboss.system.server.ServerImpl.doStart
(ServerImpl.java:324)
        at org.jboss.system.server.ServerImpl.start
(ServerImpl.java:221)
        at org.jboss.Main.boot(Main.java:142)
        at org.jboss.Main$1.run(Main.java:375)
        at java.lang.Thread.run(Thread.java:479)

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2002-08-26 16:54

Message:
Logged In: NO 

Here is the code for the web.xml and jboss-web.xml
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!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-name>Test</display-name>
  <description>Test</description>
  <servlet>
    <servlet-name>Test</servlet-name>
    <servlet-class>com.test.TestServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Test</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>
  <mime-mapping>
    <extension>css</extension>
    <mime-type>text/css</mime-type>
  </mime-mapping>
  <resource-ref>
    <res-ref-name>jdbc/XAOracleDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>CONTAINER</res-auth>
  </resource-ref>
  <resource-ref>
    <res-ref-name>jdbc/FirebirdDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>CONTAINER</res-auth>
  </resource-ref>
</web-app>

jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application
2.3//EN"
                          
"http://www.jboss.org/j2ee/dtd/jboss-web_3_0.dtd";>
<jboss-web>
<security-domain>java:/jaas/other</security-domain>
<resource-ref>
        <res-ref-name>jdbc/XAOracleDS</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:/XAOracleDS</jndi-name>
</resource-ref>
<resource-ref>
        <res-ref-name>jdbc/FirebirdDS</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:/FirebirdDS</jndi-name>
</resource-ref>
</jboss-web>

A call to ctx.lookup("java:/XAOracleDS") works, but a call
to ctx.lookup("java:comp/env/jdbc/XAOracleDS") throws
NameNotFoundException: jdbc not bound

----------------------------------------------------------------------

Comment By: Scott M Stark (starksm)
Date: 2002-08-26 15:44

Message:
Logged In: YES 
user_id=175228

Provide an example that illustrates the problem as there are 
numerous testcases in the web integration unit tests that 
demonstrate this does work.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=599229&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to