Re: [jetty-user] Bind with EnvEntry works, bind with Resource does not work?

Jan Bartel <[email protected]> Fri, 4 Nov 2011 08:11:16 +1100
Newsgroups gmane.comp.java.jetty.support
Message-ID <CALg=Vpi+OkLZW5PmVywO6KVnkZ005PDVdSs0qLdYpFvx+Ei1hw@mail.gmail.com>
Justin,

Please take a look at my answer to your other question this list re
how you are starting
jetty.

cheers
Jan

On 4 November 2011 01:29, Justin Cranford <[email protected]> wrote:
> Hello,
>
> Here is my environment:
>
> 1) jetty-8.0.4.v20111024
> 2) Oracle JDK 6u27 x32
> 3) Windows 7 Ultimate x64
> 4) IE 9.0.3 x32 (9.0.8112.16421)
> 5) Command Line: ***See end of email***
>
> I am trying to bind atomikosDS to java:comp/env/jdbc/mydatasource using
> context/test-jndi.xml and access it in my webapp via JDNI lookup. The
> example uses org.eclipse.jetty.plus.jndi.Resource to do the bind.
>
> In DEBUG mode, I see an AtomikosDataSourceBean object bound to a context,
> but InitialContext lookup in my webapp always fails. I tried adding
> <resource-ref> to my web.xml but that fails too complaining about "Nothing
> to bind for name javax.sql.DataSource/default".
>
> Here is the odd thing. If I use org.eclipse.jetty.plus.jndi.EnvEntry instead
> to bind the exact sameatomikosDS then my webapp context lookup works. This
> seems to imply my classpath and jndi settings are ok, so perhaps I am not
> using org.eclipse.jetty.plus.jndi.Resource properly or maybe there is a bug?
>
>
> So here is my question: Why does org.eclipse.jetty.plus.jndi.EnvEntry
> work when org.eclipse.jetty.plus.jndi.Resource does not work?
>
>
> <!-- BINDING THIS WAY IN context/test-jndi.xml ALLOWS ME TO LOOKUP
> jdbc/mydatasource SUCCESSFULLY IN MY WEBAPP -->
>  <New id="mydatasource" class="org.eclipse.jetty.plus.jndi.EnvEntry">
>   <Arg><Ref id='wac'/></Arg>
>   <Arg>jdbc/mydatasource</Arg>
>   <Arg>
>    <New id="atomikosDS" class="com.atomikos.jdbc.AtomikosDataSourceBean">
>     <Set
> name="xaDataSourceClassName">org.apache.derby.jdbc.EmbeddedXADataSource</Set>
>     <Set name="xaProperties">
>      <New class="java.util.Properties">
>       <Call name="setProperty">
>        <Arg>databaseName</Arg>
>        <Arg>testdb</Arg>
>       </Call>
>       <Call name="setProperty">
>        <Arg>createDatabase</Arg>
>        <Arg>create</Arg>
>       </Call>
>      </New>
>     </Set>
>     <Set name="UniqueResourceName">mydatasource2</Set>
>    </New>
>   </Arg>
>   <Arg type="boolean">true</Arg>
>  </New>
>
> <!-- BINDING THIS WAY IN context/test-jndi.xml DOES NOT ALLOW ME TO LOOKUP
> jdbc/mydatasource IN MY WEBAPP -->
>  <New id="mydatasource" class="org.eclipse.jetty.plus.jndi.Resource">
>   <Arg><Ref id='wac'/></Arg>
>   <Arg>jdbc/mydatasource</Arg>
>   <Arg>
>    <New id="atomikosDS" class="com.atomikos.jdbc.AtomikosDataSourceBean">
>     <Set
> name="xaDataSourceClassName">org.apache.derby.jdbc.EmbeddedXADataSource</Set>
>     <Set name="xaProperties">
>      <New class="java.util.Properties">
>       <Call name="setProperty">
>        <Arg>databaseName</Arg>
>        <Arg>testdb</Arg>
>       </Call>
>       <Call name="setProperty">
>        <Arg>createDatabase</Arg>
>        <Arg>create</Arg>
>       </Call>
>      </New>
>     </Set>
>     <Set name="UniqueResourceName">mydatasource</Set>
>    </New>
>   </Arg>
>  </New>
>
>
>
> Command Line: C:\jdk6u27\bin\javaw.exe -Dfile.encoding=Cp1252
>
> -Xbootclasspath:C:\jdk6u27\jre\lib\resources.jar;C:\jdk6u27\jre\lib\rt.jar;C:\jdk6u27\jre\lib\jsse.jar;C:\jdk6u27\jre\lib\jce.jar;C:\jdk6u27\jre\lib\charsets.jar;C:\jdk6u27\lib\tools.jar;C:\lib\slf4j16\slf4j-api-1.6.3.jar;C:\lib\slf4j16\slf4j-log4j12-1.6.3.jar;C:\lib\apache\log4j\log4j-1.2.16.jar;C:\lib\jetty-ajp-8.0.4.v20111024.jar;C:\lib\jetty-all-8.0.4.v20111024-javadoc.jar;C:\lib\jetty-annotations-8.0.4.v20111024.jar;C:\lib\jetty-client-8.0.4.v20111024.jar;C:\lib\jetty-continuation-8.0.4.v20111024.jar;C:\lib\jetty-deploy-8.0.4.v20111024.jar;C:\lib\jetty-http-8.0.4.v20111024.jar;C:\lib\jetty-io-8.0.4.v20111024.jar;C:\lib\jetty-jmx-8.0.4.v20111024.jar;C:\lib\jetty-jndi-8.0.4.v20111024.jar;C:\lib\jetty-overlay-deployer-8.0.4.v20111024.jar;C:\lib\jetty-plus-8.0.4.v20111024.jar;C:\lib\jetty-policy-8.0.4.v20111024.jar;C:\lib\jetty-rewrite-8.0.4.v20111024.jar;C:\lib\jetty-security-8.0.4.v20111024.jar;C:\lib\jetty-server-8.0.4.v20111024.jar;C:\lib\jetty-servlet-8.0.4.v20111024.jar;C:\lib\jetty-servlets-8.0.4.v20111024.jar;C:\lib\jetty-util-8.0.4.v20111024.jar;C:\lib\jetty-webapp-8.0.4.v20111024.jar;C:\lib\jetty-websocket-8.0.4.v20111024.jar;C:\lib\jetty-xml-8.0.4.v20111024.jar;C:\lib\servlet-api-3.0.jar;C:\lib\annotations\asm-3.1.jar;C:\lib\annotations\asm-commons-3.1.jar;C:\lib\annotations\asm-tree-3.1.jar;C:\lib\annotations\geronimo-annotation_1.0_spec-1.1.1.jar;C:\lib\annotations\javax.annotation_1.1.0.v201105051105.jar;C:\lib\annotations\org.objectweb.asm_3.3.1.v201101071600.jar;C:\lib\jdbc\derby\derby-10.6.1.0.jar;C:\lib\jdbc\derby\derbytools-10.6.1.0.jar;C:\lib\jndi\javax.activation_1.1.0.v201105071233.jar;C:\lib\jndi\javax.mail.glassfish_1.4.1.v201005082020.jar;C:\lib\jta\javax.transaction_1.1.1.v201004190952.jar;C:\lib\jta\atomikos\atomikos-util-3.7.0.jar;C:\lib\jta\atomikos\transactions-3.7.0.jar;C:\lib\jta\atomikos\transactions-api-3.7.0.jar;C:\lib\jta\atomikos\transactions-jdbc-3.7.0.jar;C:\lib\jta\atomikos\transactions-jta-3.7.0.jar;C:\lib\monitor\jetty-monitor-8.0.4.v20111024.jar;C:\lib\jsp\com.sun.el_2.2.0.v201105051105.jar;C:\lib\jsp\javax.el_2.2.0.v201105051105.jar;C:\lib\jsp\javax.servlet.jsp.jstl_1.2.0.v201004190952.jar;C:\lib\jsp\javax.servlet.jsp_2.2.0.v201103241009.jar;C:\lib\jsp\org.apache.jasper.glassfish_2.2.2.v201108011116.jar;C:\lib\jsp\org.apache.taglibs.standard.glassfish_1.2.0.v201004190952.jar;C:\lib\setuid\jetty-setuid-java-8.0.4.v20111024.jar;C:\lib\setuid\jna-3.2.2.jar;C:\lib\spring\jetty-spring-8.0.4.v20111024.jar;C:\resources
>
> -classpath
> C:\lib\slf4j16\slf4j-api-1.6.3.jar;C:\lib\slf4j16\slf4j-log4j12-1.6.3.jar;C:\lib\apache\log4j\log4j-1.2.16.jar;C:\lib\jetty-ajp-8.0.4.v20111024.jar;C:\lib\jetty-all-8.0.4.v20111024-javadoc.jar;C:\lib\jetty-annotations-8.0.4.v20111024.jar;C:\lib\jetty-client-8.0.4.v20111024.jar;C:\lib\jetty-continuation-8.0.4.v20111024.jar;C:\lib\jetty-deploy-8.0.4.v20111024.jar;C:\lib\jetty-http-8.0.4.v20111024.jar;C:\lib\jetty-io-8.0.4.v20111024.jar;C:\lib\jetty-jmx-8.0.4.v20111024.jar;C:\lib\jetty-jndi-8.0.4.v20111024.jar;C:\lib\jetty-overlay-deployer-8.0.4.v20111024.jar;C:\lib\jetty-plus-8.0.4.v20111024.jar;C:\lib\jetty-policy-8.0.4.v20111024.jar;C:\lib\jetty-rewrite-8.0.4.v20111024.jar;C:\lib\jetty-security-8.0.4.v20111024.jar;C:\lib\jetty-server-8.0.4.v20111024.jar;C:\lib\jetty-servlet-8.0.4.v20111024.jar;C:\lib\jetty-servlets-8.0.4.v20111024.jar;C:\lib\jetty-util-8.0.4.v20111024.jar;C:\lib\jetty-webapp-8.0.4.v20111024.jar;C:\lib\jetty-websocket-8.0.4.v20111024.jar;C:\lib\jetty-xml-8.0.4.v20111024.jar;C:\lib\servlet-api-3.0.jar;C:\lib\annotations\asm-3.1.jar;C:\lib\annotations\asm-commons-3.1.jar;C:\lib\annotations\asm-tree-3.1.jar;C:\lib\annotations\geronimo-annotation_1.0_spec-1.1.1.jar;C:\lib\annotations\javax.annotation_1.1.0.v201105051105.jar;C:\lib\annotations\org.objectweb.asm_3.3.1.v201101071600.jar;C:\lib\jdbc\derby\derby-10.6.1.0.jar;C:\lib\jdbc\derby\derbytools-10.6.1.0.jar;C:\lib\jndi\javax.activation_1.1.0.v201105071233.jar;C:\lib\jndi\javax.mail.glassfish_1.4.1.v201005082020.jar;C:\lib\jta\javax.transaction_1.1.1.v201004190952.jar;C:\lib\jta\atomikos\atomikos-util-3.7.0.jar;C:\lib\jta\atomikos\transactions-3.7.0.jar;C:\lib\jta\atomikos\transactions-api-3.7.0.jar;C:\lib\jta\atomikos\transactions-jdbc-3.7.0.jar;C:\lib\jta\atomikos\transactions-jta-3.7.0.jar;C:\lib\monitor\jetty-monitor-8.0.4.v20111024.jar;C:\lib\jsp\com.sun.el_2.2.0.v201105051105.jar;C:\lib\jsp\javax.el_2.2.0.v201105051105.jar;C:\lib\jsp\javax.servlet.jsp.jstl_1.2.0.v201004190952.jar;C:\lib\jsp\javax.servlet.jsp_2.2.0.v201103241009.jar;C:\lib\jsp\org.apache.jasper.glassfish_2.2.2.v201108011116.jar;C:\lib\jsp\org.apache.taglibs.standard.glassfish_1.2.0.v201004190952.jar;C:\lib\setuid\jetty-setuid-java-8.0.4.v20111024.jar;C:\lib\setuid\jna-3.2.2.jar;C:\lib\spring\jetty-spring-8.0.4.v20111024.jar;C:\start.jar
>
> org.eclipse.jetty.start.Main
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email