Defining two data sources in jetty (jetty-env.xml)
datasource, java, jetty
Solution
I haven't had a chance to test it, but it looks to me like your problem is that you're missing an `<Arg />` for the scope.
Your DS should be:
<New id="ds" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/mybd1</Arg>
<Arg>
<New class="com.mchange.v2.c3p0.ComboPooledDataSource">
etc.
That first "Arg" is the scope, and without it, the rest of your arguments are out of position, and are probably causing your issue.
Problem
I'm trying to define two data sources in my web application, using the `jetty-env.xml` file. It works ok with just one data source, however I get this exception when the second data source is added: ``` java.lang.IllegalStateException: Nothing to bind for name javax.sql.DataSource/default ``` Here's my configuration: jetty-env.xml ``` <Configure class="org.eclipse.jetty.webapp.WebAppContext"> <New id="ds" class="org.eclipse.jetty.plus.jndi.Resource"> <Arg>jdbc/mybd1</Arg> <Arg> <New class="com.mchange.v2.c3p0.ComboPooledDataSource"> <Set name="driverClass">com.microsoft.sqlserver.jdbc.SQLServerDriver</Set> <Set name="jdbcUrl">jdbc:jtds:sqlserver://url:1433/mybd1</Set> <Set name="user">xx</Set> <Set name="password">yy</Set> </New> </Arg> </New> <New id="ds2" class="org.eclipse.jetty.plus.jndi.Resource" > <Arg>jdbc/mybd2</Arg> <Arg> <New class="com.mchange.v2.c3p0.ComboPooledDataSource"> <Set name="driverClass">com.microsoft.sqlserver.jdbc.SQLServerDriver</Set> <Set name="jdbcUrl">jdbc:jtds:sqlserver://url:1433/mybd2</Set> <Set name="user">xx</Set> <Set name="password">yy</Set> </New> </Arg> </New> </Configure> ``` web.xml ``` <resource-ref> <res-ref-name>jdbc/mybd1</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> <resource-ref> <res-ref-name>jdbc/mybd2</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> ``` hibernate.cfg.xml (there is another hibernate.cfb.xml to configure the second data source) ``` <session-factory> <property name="connection.datasource">jdbc/mybd1</property> <!-- ... --> ``` Any clue?