Hi ,
I am using a third party web application with jetty 7.6 . That third party web
app needs a datasource so I need to configure datasource in context.xml , here
is its content :
<Configure id='wac' class="org.eclipse.jetty.webapp.WebAppContext">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Required minimal context configuration : -->
<!-- + contextPath -->
<!-- + war OR resourceBase -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Array id="plusConfig" type="java.lang.String">
<Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item>
<Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item>
<Item>org.eclipse.jetty.webapp.MetaInfConfiguration</Item>
<Item>org.eclipse.jetty.webapp.FragmentConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item> <!-- add for
JNDI -->
<Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item> <!-- add
for JNDI -->
<Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>
<Item>org.eclipse.jetty.webapp.TagLibConfiguration</Item>
</Array>
<Set name="contextPath">/frevvo</Set>
<Set name="war"><SystemProperty name="jetty.home"
default="."/>/RichForms</Set>
<Set name="configurationClasses"><Ref id="plusConfig"/></Set>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Optional context configuration -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home"
default="."/>/web/WEB-INF/webdefault.xml</Set>
<New id="myds" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg><Ref id="wac"/></Arg>
<Arg>jdbc/frevvoDS</Arg>
<Arg>
<New class="org.enhydra.jdbc.standard.StandardXADataSource">
<Set name="DriverName">org.hsqldb.jdbcDriver</Set>
<Set name="Url">jdbc:hsqldb:file:formsdb</Set>
<Set name="User">sa</Set>
<Set name="Password"></Set>
</New>
</Arg>
</New>
</Configure>
But when i run the server I get the error :
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(XmlConfiguration.java:761)
at
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:386)
at
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:338)
at
org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:291)
at
org.eclipse.jetty.deploy.ContextDeployer.createContext(ContextDeployer.java:456)
at
org.eclipse.jetty.deploy.ContextDeployer.deploy(ContextDeployer.java:349)
at
org.eclipse.jetty.deploy.ContextDeployer.access$000(ContextDeployer.java:77)
at
org.eclipse.jetty.deploy.ContextDeployer$ScannerListener.fileAdded(ContextDeployer.java:102)
at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:604)
at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:535)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:398)
at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:331)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at
org.eclipse.jetty.deploy.ContextDeployer.doStart(ContextDeployer.java:416)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at
org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:58)
at
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:53)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:91)
at org.eclipse.jetty.server.Server.doStart(Server.java:261)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at com.adeptia.indigo.WebRunner.boot(WebRunner.java:263)
at com.adeptia.indigo.WebRunner.main(WebRunner.java:100)
Caused by: javax.naming.InvalidNameException: A flat name can only have a
single component
at javax.naming.NameImpl.addAll(NameImpl.java:621)
at javax.naming.CompoundName.addAll(CompoundName.java:442)
at
org.eclipse.jetty.plus.jndi.NamingEntryUtil.makeNamingEntryName(NamingEntryUtil.java:155)
at org.eclipse.jetty.plus.jndi.NamingEntry.save(NamingEntry.java:184)
at org.eclipse.jetty.plus.jndi.Resource.<init>(Resource.java:33)
... 26 more
I have defined the resource in web.xml too
<resource-ref>
<description>frevvo DB Data Source</description>
<res-ref-name>jdbc/frevvoDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Can you tell me where I am doing wrong step and let me know if I have missed
any step.
Reproducible: Always
Steps to Reproduce:
1.Configure datasource in context.xml
2.Start the server.
I tried to contact jetty guys , they told me Try to not specify the scope by
removing the reference to wac:
Change:
<Arg><Ref id="wac"/></Arg>
To:
<Arg></Arg>
I tried this but this haven’t resolved the problem. I am getting the same error. Please help ASAP!!!!
Thanks
Sandeep