Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Can't get env-entry value from web.xml


Try doing:
java -jar start.jar --list-options


On 29 September 2011 10:43, David Haynes <david.dhcinc@xxxxxxxxx> wrote:
Thanks for the response.

Well, I guess I am closer.
I changed the jetty-web.xml as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting/DTD Configure/EN" "">
<Configure id="wac" class="org.eclipse.jetty.webapp.WebAppContext">
    <Array id="plusConfig" type="java.lang.String">
        <Item></Item> <!-- add for JNDI -->
        <Item></Item>    <!-- add for JNDI -->

    <Set name="war"><SystemProperty name="jetty.home" default="."/>/directory</Set>
    <Set name="configurationClasses"><Ref id="plusConfig"/></Set>

The other part of the manual page is about how to set the OPTIONS on the java invocation but I am running this as an embedded service. So how do I do the equivalent of the OPTIONS=plus from inside a Java class?

The error message I am getting now is:
[2011-09-28 20:33:48,579][DEBUG]?:?(?:?): XML o.e.j.w.WebAppContext{/directory,file:/tmp/jetty-},./directory.setConfigurationClasses([Ljava.lang.String;@8f9a32)
[2011-09-28 20:33:48,579][ WARN]?:?(?:?): Config error at <Set name="configurationClasses"><Ref id="plusConfig"/></Set>
[2011-09-28 20:33:48,581][ WARN]?:?(?:?): Failed startup of context o.e.j.w.WebAppContext{/directory,file:/tmp/jetty-},./directory
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

I have tried the '/webapps/directory', '/webapp/directory' and '/directory' for the <Set name="war" with no difference.

On Wed, Sep 28, 2011 at 6:49 PM, Jan Bartel <janb@xxxxxxxxxxx> wrote:

You need to ensure you have the jars on the classpath that enable j2ee-style features for jetty and configure the webapp to use them also.



On 29 September 2011 03:23, David Haynes <david.dhcinc@xxxxxxxxx> wrote:
I am probably missing something trivial but I can't seem to find it.
I am running Jetty 8.0.1.v20110908 as an embedded server.
My jetty-web.xml file looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting/DTD Configure/EN" "">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
    <Set name="contextPath">/directory</Set>
    <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapp/directory</Set>

My web.xml has this env-entry in it:

When I try to read the value from my webapp, I get the following:
[2011-09-28 13:12:55,638][DEBUG]?:?(?:?): No entry for classloader: WebAppClassLoader=Directory Service@2f996f
[2011-09-28 13:12:55,638][DEBUG]?:?(?:?): Looking up name="env/database.fqn"
[2011-09-28 13:12:55,639][ WARN]?:?(?:?): /directory/api/ping
org.jboss.resteasy.spi.UnhandledException: javax.naming.NameNotFoundException; remaining name 'env/database.fqn'
    at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(
    at org.jboss.resteasy.core.SynchronousDispatcher.handleException(
    at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(

This is the start method:
public void startServer() throws Exception {
        Connector connector = new SelectChannelConnector();
        connector.setMaxIdleTime(10000);    // 10 seconds
        server = new Server();
        WebAppContext wac = new WebAppContext(warFilePath, contextPath);
        server.setConnectors(new Connector[] { connector });

Does anyone have any idea why its not working?
Any suggestions would be great at this point!


jetty-users mailing list

jetty-users mailing list

jetty-users mailing list

Back to the top