Hi Devs

Has anyone managed to get GeoServer 2.25.x and Eclipse working with Jetty
JNDI recently?  I am following
https://docs.geoserver.org/latest/en/developer/eclipse-guide/index.html#configuring-jndi-resources-in-jetty

and my jetty.xml file is set correctly with -Djetty.config.file:

<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "
> http://www.eclipse.org/jetty/configure_9_3.dtd";>
> <Configure>
>   <New id="jndiref" class="org.eclipse.jetty.plus.jndi.Resource">
>     <Arg><Ref refid="Server"/></Arg>
>     <Arg>jdbc/jndiref</Arg>
>     <Arg>
> <New class="org.postgresql.ds.PGSimpleDataSource">
>            <Set name="User">user</Set>
>            <Set name="Password">password</Set>
>            <Set name="DatabaseName">database</Set>
>            <Set name="ServerName">server</Set>
>            <Set name="PortNumber">5432</Set>
>         </New>
>     </Arg>
>   </New>
> </Configure>
>

Note that I am using org.postgresql.ds.PGSimpleDataSource

When I debug the Start.java "Loading Jetty config from file" I see that the
2 deprecated methods setServerName (singular) and setPortNumber (singular)
do not actually set their respective properties, and the object has
properties serverNames (plural) and portNumbers which remain unset (and
thus JNDI does not work).

It seems like these methods have been replaced by the plural versions (e.g.
setPortNumbers) ref:
https://jdbc.postgresql.org/documentation/publicapi/org/postgresql/ds/common/BaseDataSource.html#setPortNumber-int-

But that (plural) method does not exist and throws a NoSuchMethodException
in org.eclipse.jetty.xml.XmlConfiguration L 629 if I attempt to use

           <Set name="ServerName*s*">server</Set>
           <Set name="PortNumber*s*">5432</Set>
(note plurals) instead.

Can anyone send me updated instructions, please?

Secondly, the documentation says:

> Jetty does not mandate a reference-ref in GeoServer WEB-INF/web.xml, so
there is no need to modify that file.

however, I found that running jetty from maven did require me to add to the
web.xml:

<resource-ref>
>  <res-ref-name>jdbc/jndiref</res-ref-name>
>  <res-type>javax.sql.DataSource</res-type>
>  <res-auth>Container</res-auth>
> </resource-ref>


Can anyone confirm if this is necessary for Eclipse, and which file exactly
must be modified (i.e.where is web.xml)?

Thanks

Peter

Logs:

Nov 14, 2023 3:31:59 PM org.geoserver.web.Start main
INFO: Loading Jetty config from file:
./../../../../GEOSERVER_DATA_DIR/jetty.xml
15:31:59 WARN   [xml.XmlConfiguration] - Deprecated method public void
org.postgresql.ds.common.BaseDataSource.setServerName(java.lang.String) in
UNKNOWN-LOCATION
15:31:59 WARN   [xml.XmlConfiguration] - Deprecated method public void
org.postgresql.ds.common.BaseDataSource.setPortNumber(int) in
UNKNOWN-LOCATION
15:31:59 WARN   [xml.XmlConfiguration] - Deprecated method public void
org.postgresql.ds.common.BaseDataSource.setServerName(java.lang.String) in
UNKNOWN-LOCATION
15:31:59 WARN   [xml.XmlConfiguration] - Deprecated method public void
org.postgresql.ds.common.BaseDataSource.setPortNumber(int) in
UNKNOWN-LOCATION
Nov 14, 2023 3:31:59 PM org.geoserver.web.Start main
SEVERE: GeoServer starting
..

_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to