This is the code that I'm using to run the jetty server and how do I add a
JNDI Data source MyH2DS to WebAppContext wac.

*JNDI DataSource:*
<New id="myds" class="org.mortbay.jetty.webapp.WebAppContext">
<Arg>jdbc/MyH2DS</Arg>
<Arg>
<New class="org.h2.jdbcx.JdbcConnectionPool">
<Set name="Url">jdbc:h2:/data/test</Set>
<Set name="User">sa</Set>
<Set name="Password"></Set>
</New>
</Arg>
</New>

*Jetty Server (Embedded) Code:*

Server server = new Server(8080);
WebAppContext wac = new WebAppContext();
File warPath = new
File("C:/Users/XCB638.DS/workspace/MyJSFProject/WebContent/WEB-INF");
wac.setWar(warPath.getAbsolutePath());
wac.setContextPath("/");
wac.setBaseResource(new ResourceCollection(new String[] { "./WebContent",
"build/classes" }));
server.setHandler(wac);
try
{
server.start();
server.join();
}
catch (Exception e)
{
e.printStackTrace();
}


Thanks & Regards,
*Ranjith*
MS-MIS, Univ Of Illinois at Chicago.





On Wed, Jun 5, 2013 at 10:48 AM, Ranjith Koduri <[email protected]>wrote:

> Hello,
> Is there a way to add JNDI DataSource to WebAppContext using Jetty API;
> without needing to create any context XML file?
>
>
> Thanks & Regards,
> *Ranjith*
> MS-MIS, Univ Of Illinois at Chicago.
>
>
>
>
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to