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

[david@vsa-ge libs]$ java -jar jetty-start.jar --list-modes OPTION=plus jetty-plus.xml jetty-web.xml
There are 27 OPTIONs available to use.
Each option is listed along with associated available classpath entries,  in the order that they would appear from that mode.
Note: If using multiple options (eg: 'Server,servlet,webapp,jms,jmx') then overlapping entries will not be repeated in the eventual classpath.

${jetty.home} = /home/david/workspaces/directory-service/test/libs

GLOBAL option (Prepended Entries)
-------------------------------------------------------------
Empty option, no classpath entries active.

GLOBAL option (Appended Entries) (*)
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [ajp]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [All] (Aggregate)
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [annotations]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [client]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [Client] (Aggregate)
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [default]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [deploy]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [ext]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [jmx]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [jndi]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [overlay]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [overlays]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [plus]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [policy]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [resources]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [rewrite]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [security]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [server]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [Server] (Aggregate)
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [servlet]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [servlets]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [setuid]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [webapp]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [websocket]
-------------------------------------------------------------
Empty option, no classpath entries active.

Option [xml]
-------------------------------------------------------------
Empty option, no classpath entries active.

Looks like a whole lot of nothing...

On Wed, Sep 28, 2011 at 8:48 PM, Jan Bartel <janb@xxxxxxxxxxx> wrote:
David,

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

Jan

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" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="wac" class="org.eclipse.jetty.webapp.WebAppContext">
    <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="war"><SystemProperty name="jetty.home" default="."/>/directory</Set>
    <Set name="configurationClasses"><Ref id="plusConfig"/></Set>
</Configure>

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-127.0.0.1-8099-directory.war-_directory-any-/webapp/},./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-127.0.0.1-8099-directory.war-_directory-any-/webapp/},./directory
java.lang.reflect.InvocationTargetException
    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:
David,

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.

See http://wiki.eclipse.org/Jetty/Feature/JNDI

Jan

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" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
    <Set name="contextPath">/directory</Set>
    <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapp/directory</Set>
</Configure>

My web.xml has this env-entry in it:
 <env-entry>
    <env-entry-name>database.fqn</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>192.168.215.35</env-entry-value>
 </env-entry>

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(SynchronousDispatcher.java:340)
    at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214)
    at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190)

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

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

-david-

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top