JNDI configuration of datastores in Websphere

View: New views
19 Messages — Rating Filter:   Alert me  

JNDI configuration of datastores in Websphere

by Kris Geusebroek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi,

 

I have successfully deployed geoserver with the oracle-ng plugin into websphere and managed to create a jdbc datasource which can be successfully pinged in Websphere also.

 

I’m struggling though to get it to work with my geoserver config.

 

Here’s what I have now:

-          A resource-ref section in the web.xml (following the example on the geoserver website)

<resource-ref>

  <description>Oracle datastore test</description>

         <res-ref-name>jdbc/test</res-ref-name>

         <res-type>javax.sql.DataSource</res-type>

         <res-auth>Container</res-auth>

       </resource-ref>

-          A configured JDBC Provider with a classpath set to ojdbc14.jar of my oracle client installation directory with an implementation classname: oracle.jdbc.pool.OracleConnectionPoolDataSource

-          A datasource configuration

o   Name: testJNDI

o   JNDI Name: jdbc/testJNDI

o   Use this datasource in CMP checked

o   Oracle 10g data store helper

o   Component-managed authentication alias selected

o   And an url like: jdbc:oracle:thin:@(DESCRIPTION= etc)

-          Bound the resource ref to the concrete datasource definition on installing the geoserver war file with the default method for authentication (many-to-one) with the samemanaged authentication as above selected.

-          And in geoserver catalog.xml

<datastore namespace=”testJNDI” enabled=”true” id=”jndi_test_ds”>

       <connectionParams>

                       <parameter value=”http://www.test.nl/JNDI” name=”namespace”/>

                       <parameter value=”jdbc/test” name=”jndiReferenceName”/>

                       <parameter value=”Oracle” name=”dbtype”/>

                       <parameter value=”USERNAME” name=”schema”/>

       </connectionParams>

</datastore>

 

After deploying this I cannot see my datastore in the list when I choose to add a new featureType so I configured a featureType manually but when accessing this featureType I get the following error:

 

Java.io.IOException: Schema ‘http://www.test.nl/JNDITABLENAME’ does not exist.

At org.geotools.data.store.ContentDataStoe.ensureEntry(ContentDataStore.java:555)

Etc.

 

What am I doing wrong here?

 

Cheers Kris

 


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by Andrea Aime-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kris Geusebroek ha scritto:
> Java.io.IOException: Schema ‘http://www.test.nl/JNDITABLENAME’ does not
> exist.
>
> At
> org.geotools.data.store.ContentDataStoe.ensureEntry(ContentDataStore.java:555)
>
> Etc.

Hmmm... difficult to say given just that exception, we may just try to
guess.
Oracle datastore for a number of Oracle specific silly reasons requires
the native connection to the database (a Oracle specific object), and
the connection pools are wrapping connections to perform their pooling
work.
Now, we have quite a set of "unwrappers" that can handle the most common
connection pools, including some WebSphere ones, but _it might_ be
there is no unwrapper for the connection pool shipping with that
specific version of WebSphere.

Don't you really have anything else in the logs?

Cheers
Andrea


--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by mcr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you can ping the datasource within your websphere admin consoloe, your
config is ok. (Provided that the scope of your DS is not pointing to another
server, I assume you are using a server called "server1").

1)
Try to use "java:comp/env/jdbc/test"  instead of jdbc/test in the geoserver
config. I think the logic to add "java:comp/env/" is not in 1.7.5, only on
trunk.

2)
Websphere has a default app called UTC. Within this app you can browse your
JNDI hierarchy. You can also try the full qualified JNDI path


Kris Geusebroek writes:

> Hi,
>
>  
>
> I have successfully deployed geoserver with the oracle-ng plugin into
> websphere and managed to create a jdbc datasource which can be
> successfully pinged in Websphere also.
>
>  
>
> I'm struggling though to get it to work with my geoserver config.
>
>  
>
> Here's what I have now:
>
> -          A resource-ref section in the web.xml (following the example
> on the geoserver website)
>
> <resource-ref>
>
>   <description>Oracle datastore test</description>
>
>          <res-ref-name>jdbc/test</res-ref-name>
>
>          <res-type>javax.sql.DataSource</res-type>
>
>          <res-auth>Container</res-auth>
>
>        </resource-ref>
>
> -          A configured JDBC Provider with a classpath set to
> ojdbc14.jar of my oracle client installation directory with an
> implementation classname:
> oracle.jdbc.pool.OracleConnectionPoolDataSource
>
> -          A datasource configuration
>
> o   Name: testJNDI
>
> o   JNDI Name: jdbc/testJNDI
>
> o   Use this datasource in CMP checked
>
> o   Oracle 10g data store helper
>
> o   Component-managed authentication alias selected
>
> o   And an url like: jdbc:oracle:thin:@(DESCRIPTION= etc)
>
> -          Bound the resource ref to the concrete datasource definition
> on installing the geoserver war file with the default method for
> authentication (many-to-one) with the samemanaged authentication as
> above selected.
>
> -          And in geoserver catalog.xml
>
> <datastore namespace="testJNDI" enabled="true" id="jndi_test_ds">
>
>        <connectionParams>
>
>                        <parameter value="http://www.test.nl/JNDI"
> name="namespace"/>
>
>                        <parameter value="jdbc/test"
> name="jndiReferenceName"/>
>
>                        <parameter value="Oracle" name="dbtype"/>
>
>                        <parameter value="USERNAME" name="schema"/>
>
>        </connectionParams>
>
> </datastore>
>
>  
>
> After deploying this I cannot see my datastore in the list when I choose
> to add a new featureType so I configured a featureType manually but when
> accessing this featureType I get the following error:
>
>  
>
> Java.io.IOException: Schema 'http://www.test.nl/JNDITABLENAME' does not
> exist.
>
> At
> org.geotools.data.store.ContentDataStoe.ensureEntry(ContentDataStore.jav
> a:555)
>
> Etc.
>
>  
>
> What am I doing wrong here?
>
>  
>
> Cheers Kris
>
>  
>
 


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by Ben Caradoc-Davies-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kris Geusebroek wrote:
> <parameter value=”jdbc/test” name=”jndiReferenceName”/>

Support for short JNDI reference names was only added seven days ago.
Unless you are using a very recent build, you will need to use:

     value=”java:comp/env/jdbc/test"

(Both forms are supported the latest builds.)

See the Jira issue::
http://jira.codehaus.org/browse/GEOT-2559

Kind regards,

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@...>
Software Engineer, CSIRO Exploration and Mining
Australian Resources Research Centre
26 Dick Perry Ave, Kensington WA 6151, Australia

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by Kris Geusebroek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Andrea,

No nothing else to see in the logs.
I'm now trying to make it work on my tomcat installation with postgis db
but I don't believe there is a jndi version of the postgis jdbc plugin
right?

Cheers Kris

-----Original Message-----
From: Andrea Aime [mailto:aaime@...]
Sent: Tuesday, July 07, 2009 4:44 PM
To: Kris Geusebroek
Cc: geoserver-users@...
Subject: Re: [Geoserver-users] JNDI configuration of datastores in
Websphere

Kris Geusebroek ha scritto:
> Java.io.IOException: Schema 'http://www.test.nl/JNDITABLENAME' does
not
> exist.
>
> At
>
org.geotools.data.store.ContentDataStoe.ensureEntry(ContentDataStore.jav
a:555)
>
> Etc.

Hmmm... difficult to say given just that exception, we may just try to
guess.
Oracle datastore for a number of Oracle specific silly reasons requires
the native connection to the database (a Oracle specific object), and
the connection pools are wrapping connections to perform their pooling
work.
Now, we have quite a set of "unwrappers" that can handle the most common
connection pools, including some WebSphere ones, but _it might_ be
there is no unwrapper for the connection pool shipping with that
specific version of WebSphere.

Don't you really have anything else in the logs?

Cheers
Andrea


--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by Andrea Aime-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kris Geusebroek ha scritto:
> Hi Andrea,
>
> No nothing else to see in the logs.
> I'm now trying to make it work on my tomcat installation with postgis db
> but I don't believe there is a jndi version of the postgis jdbc plugin
> right?

Not for 1.7.x, there is only one for GeoServer trunk (aka 2.0 series).
The JDNI tutorial (which you already saw, right?) was written for
Oracle:
http://gridlock.openplans.org/geoserver/1.7.x/doc/user/tutorials/tomcat-jndi/tomcat-jndi.html


Cheers
Andrea



--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by Kris Geusebroek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Yes i saw the tutorial for oracle, so I have to get some oracle db
running on my laptop to investigate further I guess.

Thanks

Kris

-----Original Message-----
From: Andrea Aime [mailto:aaime@...]
Sent: Wednesday, July 08, 2009 3:03 PM
To: Kris Geusebroek
Cc: geoserver-users@...
Subject: Re: [Geoserver-users] JNDI configuration of datastores in
Websphere

Kris Geusebroek ha scritto:
> Hi Andrea,
>
> No nothing else to see in the logs.
> I'm now trying to make it work on my tomcat installation with postgis
db
> but I don't believe there is a jndi version of the postgis jdbc plugin
> right?

Not for 1.7.x, there is only one for GeoServer trunk (aka 2.0 series).
The JDNI tutorial (which you already saw, right?) was written for
Oracle:
http://gridlock.openplans.org/geoserver/1.7.x/doc/user/tutorials/tomcat-
jndi/tomcat-jndi.html


Cheers
Andrea



--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by Kris Geusebroek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Found the solution!!

After trying to configure tomcat with the same oracle connection (which
didn't work also) I found out that removing the schema from the
datastore configuration did the trick.

Apparently giving the username is sufficient enough.

Cheers Kris

-----Original Message-----
From: Kris Geusebroek [mailto:kgeusebroek@...]
Sent: Wednesday, July 08, 2009 3:12 PM
To: Andrea Aime
Cc: geoserver-users@...
Subject: Re: [Geoserver-users] JNDI configuration of datastores in
Websphere

Hi,

Yes i saw the tutorial for oracle, so I have to get some oracle db
running on my laptop to investigate further I guess.

Thanks

Kris

-----Original Message-----
From: Andrea Aime [mailto:aaime@...]
Sent: Wednesday, July 08, 2009 3:03 PM
To: Kris Geusebroek
Cc: geoserver-users@...
Subject: Re: [Geoserver-users] JNDI configuration of datastores in
Websphere

Kris Geusebroek ha scritto:
> Hi Andrea,
>
> No nothing else to see in the logs.
> I'm now trying to make it work on my tomcat installation with postgis
db
> but I don't believe there is a jndi version of the postgis jdbc plugin
> right?

Not for 1.7.x, there is only one for GeoServer trunk (aka 2.0 series).
The JDNI tutorial (which you already saw, right?) was written for
Oracle:
http://gridlock.openplans.org/geoserver/1.7.x/doc/user/tutorials/tomcat-
jndi/tomcat-jndi.html


Cheers
Andrea



--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------
------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,

vendors submitting new applications to BlackBerry App World(TM) will
have
the opportunity to enter the BlackBerry Developer Challenge. See full
prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by Andrea Aime-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kris Geusebroek ha scritto:
> Found the solution!!
>
> After trying to configure tomcat with the same oracle connection (which
> didn't work also) I found out that removing the schema from the
> datastore configuration did the trick.
>
> Apparently giving the username is sufficient enough.

Hmmm... odd. The schema is used to filter up tables so that you don't
see the whole database.
In Oracle the schema is usually the same as the username, but uppercase

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by Kris Geusebroek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

Cheered too soon i think.
After removing the schema definition form the catalog.xml completely
(emptying the value was not enough)

It seems websphere is able to get the tables form the db but when
creating a feature type I get the error:

Could not obtain native oracle connection for class
com.ibm.ws.rsadapter.jdbc.WSJdbcConnection
Andrea mentioned the unwrappers that were needed.
Is this the case in my configuration?

I found someone reporting the use of

ds = (DataSource) ctx.lookup("java:comp/env/" + dataSource);

WSJdbcConnection conn = (WSJdbcConnection) ds.getConnection();
con = (OracleConnection)
WSJdbcUtil.getNativ-eConnection((WSJdbcC-onnection) conn);

to fix this but I don't know if that is used in geoserver code

Is there a configuration change I can make to fix this or do I need java
code?

Cheers Kris
-----Original Message-----
From: Kris Geusebroek [mailto:kgeusebroek@...]
Sent: Wednesday, July 08, 2009 4:23 PM
To: Andrea Aime
Cc: geoserver-users@...
Subject: Re: [Geoserver-users] JNDI configuration of datastores in
Websphere

Found the solution!!

After trying to configure tomcat with the same oracle connection (which
didn't work also) I found out that removing the schema from the
datastore configuration did the trick.

Apparently giving the username is sufficient enough.

Cheers Kris

-----Original Message-----
From: Kris Geusebroek [mailto:kgeusebroek@...]
Sent: Wednesday, July 08, 2009 3:12 PM
To: Andrea Aime
Cc: geoserver-users@...
Subject: Re: [Geoserver-users] JNDI configuration of datastores in
Websphere

Hi,

Yes i saw the tutorial for oracle, so I have to get some oracle db
running on my laptop to investigate further I guess.

Thanks

Kris

-----Original Message-----
From: Andrea Aime [mailto:aaime@...]
Sent: Wednesday, July 08, 2009 3:03 PM
To: Kris Geusebroek
Cc: geoserver-users@...
Subject: Re: [Geoserver-users] JNDI configuration of datastores in
Websphere

Kris Geusebroek ha scritto:
> Hi Andrea,
>
> No nothing else to see in the logs.
> I'm now trying to make it work on my tomcat installation with postgis
db
> but I don't believe there is a jndi version of the postgis jdbc plugin
> right?

Not for 1.7.x, there is only one for GeoServer trunk (aka 2.0 series).
The JDNI tutorial (which you already saw, right?) was written for
Oracle:
http://gridlock.openplans.org/geoserver/1.7.x/doc/user/tutorials/tomcat-
jndi/tomcat-jndi.html


Cheers
Andrea



--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------
------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,

vendors submitting new applications to BlackBerry App World(TM) will
have
the opportunity to enter the BlackBerry Developer Challenge. See full
prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

------------------------------------------------------------------------
------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,

vendors submitting new applications to BlackBerry App World(TM) will
have
the opportunity to enter the BlackBerry Developer Challenge. See full
prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by Andrea Aime-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kris Geusebroek ha scritto:

> Hi all,
>
> Cheered too soon i think.
> After removing the schema definition form the catalog.xml completely
> (emptying the value was not enough)
>
> It seems websphere is able to get the tables form the db but when
> creating a feature type I get the error:
>
> Could not obtain native oracle connection for class
> com.ibm.ws.rsadapter.jdbc.WSJdbcConnection
> Andrea mentioned the unwrappers that were needed.
> Is this the case in my configuration?

Yes. It seems we don't have an unwrapper for that connection pool,
or that the ones we have do not work for some reason.
Yet many operations related to geometries in Oracle do not work
unless you get your hands on the native connection.

> I found someone reporting the use of
>
> ds = (DataSource) ctx.lookup("java:comp/env/" + dataSource);
>
> WSJdbcConnection conn = (WSJdbcConnection) ds.getConnection();
> con = (OracleConnection)
> WSJdbcUtil.getNativ-eConnection((WSJdbcC-onnection) conn);
>
> to fix this but I don't know if that is used in geoserver code
>
> Is there a configuration change I can make to fix this or do I need java
> code?

It needs java code, and it's not trivial to integrate with GeoServer
since it depends on WebSphere specific jars (with the dependency
and redistribution issues that go along with them). Usually
reflection is used to be able and compile those without actually
having the pool specific classes in the classpath.

Actually GeoServer 1.7.5 should ship with all the Spring unwrappers,
and there is one dedicated to WebSphere, the javadocs inside
of it talk about WebSphere 5, but it seems the API calls are
the one you mentioned above (just harder to read because of
reflection):

---------------------------------------------------------------

private static final String JDBC_ADAPTER_CONNECTION_NAME_5 =
"com.ibm.ws.rsadapter.jdbc.WSJdbcConnection";

        private static final String JDBC_ADAPTER_UTIL_NAME_5 =
"com.ibm.ws.rsadapter.jdbc.WSJdbcUtil";


        private Class webSphere5ConnectionClass;

        private Method webSphere5NativeConnectionMethod;


        /**
         * This constructor retrieves WebSphere JDBC adapter classes,
         * so we can get the underlying vendor connection using reflection.
         */
        public WebSphereNativeJdbcExtractor() {
                try {
                        this.webSphere5ConnectionClass =
getClass().getClassLoader().loadClass(JDBC_ADAPTER_CONNECTION_NAME_5);
                        Class jdbcAdapterUtilClass =
getClass().getClassLoader().loadClass(JDBC_ADAPTER_UTIL_NAME_5);
                        this.webSphere5NativeConnectionMethod =
                                        jdbcAdapterUtilClass.getMethod("getNativeConnection", new Class[]
{this.webSphere5ConnectionClass});
                }
                catch (Exception ex) {
                        throw new IllegalStateException(
                                        "Could not initialize WebSphereNativeJdbcExtractor because
WebSphere API classes are not available: " + ex);
                }
        }

---------------------------------------------------------------

The spring unwrappers are actually the ones that make the Tomcat
JNDI example work, since Tomcat has its own modified version of
DBCP that only those can handle.

So... I don't know why they are not working in your case.
I'll add a jira to get better logging out of the Spring unwrappers,
at the moment they silently skip all of the unwrappers that do
fail to load.

A shot in the dark: are you sure GeoServer is allowed to see
the com.ibm.ws.rsadapter.jdbc.WSJdbcUtil class? Maybe some
classloader magic is needed?

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by Kris Geusebroek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Andrea,

I had a look in the classloader view of the websphere console and could not find this class.
So I think that's the cause.

I'm using websphere 6.1.
I did a bit of searching and I think the class must be available in rsadaptersspi.jar. Can you confirm that?
And is it possible to just add it to the websphere lib directory?

Cheers Kris

-----Original Message-----
From: Andrea Aime [mailto:aaime@...]
Sent: Friday, July 10, 2009 10:54 AM
To: Kris Geusebroek
Cc: geoserver-users@...
Subject: Re: [Geoserver-users] JNDI configuration of datastores in Websphere

Kris Geusebroek ha scritto:

> Hi all,
>
> Cheered too soon i think.
> After removing the schema definition form the catalog.xml completely
> (emptying the value was not enough)
>
> It seems websphere is able to get the tables form the db but when
> creating a feature type I get the error:
>
> Could not obtain native oracle connection for class
> com.ibm.ws.rsadapter.jdbc.WSJdbcConnection
> Andrea mentioned the unwrappers that were needed.
> Is this the case in my configuration?

Yes. It seems we don't have an unwrapper for that connection pool,
or that the ones we have do not work for some reason.
Yet many operations related to geometries in Oracle do not work
unless you get your hands on the native connection.

> I found someone reporting the use of
>
> ds = (DataSource) ctx.lookup("java:comp/env/" + dataSource);
>
> WSJdbcConnection conn = (WSJdbcConnection) ds.getConnection();
> con = (OracleConnection)
> WSJdbcUtil.getNativ-eConnection((WSJdbcC-onnection) conn);
>
> to fix this but I don't know if that is used in geoserver code
>
> Is there a configuration change I can make to fix this or do I need java
> code?

It needs java code, and it's not trivial to integrate with GeoServer
since it depends on WebSphere specific jars (with the dependency
and redistribution issues that go along with them). Usually
reflection is used to be able and compile those without actually
having the pool specific classes in the classpath.

Actually GeoServer 1.7.5 should ship with all the Spring unwrappers,
and there is one dedicated to WebSphere, the javadocs inside
of it talk about WebSphere 5, but it seems the API calls are
the one you mentioned above (just harder to read because of
reflection):

---------------------------------------------------------------

private static final String JDBC_ADAPTER_CONNECTION_NAME_5 =
"com.ibm.ws.rsadapter.jdbc.WSJdbcConnection";

        private static final String JDBC_ADAPTER_UTIL_NAME_5 =
"com.ibm.ws.rsadapter.jdbc.WSJdbcUtil";


        private Class webSphere5ConnectionClass;

        private Method webSphere5NativeConnectionMethod;


        /**
         * This constructor retrieves WebSphere JDBC adapter classes,
         * so we can get the underlying vendor connection using reflection.
         */
        public WebSphereNativeJdbcExtractor() {
                try {
                        this.webSphere5ConnectionClass =
getClass().getClassLoader().loadClass(JDBC_ADAPTER_CONNECTION_NAME_5);
                        Class jdbcAdapterUtilClass =
getClass().getClassLoader().loadClass(JDBC_ADAPTER_UTIL_NAME_5);
                        this.webSphere5NativeConnectionMethod =
                                        jdbcAdapterUtilClass.getMethod("getNativeConnection", new Class[]
{this.webSphere5ConnectionClass});
                }
                catch (Exception ex) {
                        throw new IllegalStateException(
                                        "Could not initialize WebSphereNativeJdbcExtractor because
WebSphere API classes are not available: " + ex);
                }
        }

---------------------------------------------------------------

The spring unwrappers are actually the ones that make the Tomcat
JNDI example work, since Tomcat has its own modified version of
DBCP that only those can handle.

So... I don't know why they are not working in your case.
I'll add a jira to get better logging out of the Spring unwrappers,
at the moment they silently skip all of the unwrappers that do
fail to load.

A shot in the dark: are you sure GeoServer is allowed to see
the com.ibm.ws.rsadapter.jdbc.WSJdbcUtil class? Maybe some
classloader magic is needed?

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by Andrea Aime-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kris Geusebroek ha scritto:
> Hi Andrea,
>
> I had a look in the classloader view of the websphere console and could not find this class.
> So I think that's the cause.
>
> I'm using websphere 6.1.
> I did a bit of searching and I think the class must be available in rsadaptersspi.jar. Can you confirm that?
> And is it possible to just add it to the websphere lib directory?

I have no idea in either case, never used WebSphere

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by mcr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Kris, since I think I  am the Websphere "expert" of the
geotools/geoserver developers, I could check your problem.

The bad luck is that I am on holidays and I can resume work in the 4.th week
of July. Perhaps it is possible in the 3rd week, I dont know at the moment.

If your problem is urgent, sorry I cannot help. If you can wait 2-3 weeks,
we will find a solution.

Christian


Kris Geusebroek writes:

> Hi Andrea,
>
> I had a look in the classloader view of the websphere console and could not find this class.
> So I think that's the cause.
>
> I'm using websphere 6.1.
> I did a bit of searching and I think the class must be available in rsadaptersspi.jar. Can you confirm that?
> And is it possible to just add it to the websphere lib directory?
>
> Cheers Kris
>
> -----Original Message-----
> From: Andrea Aime [mailto:aaime@...]
> Sent: Friday, July 10, 2009 10:54 AM
> To: Kris Geusebroek
> Cc: geoserver-users@...
> Subject: Re: [Geoserver-users] JNDI configuration of datastores in Websphere
>
> Kris Geusebroek ha scritto:
>> Hi all,
>>
>> Cheered too soon i think.
>> After removing the schema definition form the catalog.xml completely
>> (emptying the value was not enough)
>>
>> It seems websphere is able to get the tables form the db but when
>> creating a feature type I get the error:
>>
>> Could not obtain native oracle connection for class
>> com.ibm.ws.rsadapter.jdbc.WSJdbcConnection
>> Andrea mentioned the unwrappers that were needed.
>> Is this the case in my configuration?
>
> Yes. It seems we don't have an unwrapper for that connection pool,
> or that the ones we have do not work for some reason.
> Yet many operations related to geometries in Oracle do not work
> unless you get your hands on the native connection.
>
>> I found someone reporting the use of  
>>
>> ds = (DataSource) ctx.lookup("java:comp/env/" + dataSource);
>>
>> WSJdbcConnection conn = (WSJdbcConnection) ds.getConnection();
>> con = (OracleConnection)
>> WSJdbcUtil.getNativ-eConnection((WSJdbcC-onnection) conn);
>>
>> to fix this but I don't know if that is used in geoserver code
>>
>> Is there a configuration change I can make to fix this or do I need java
>> code?
>
> It needs java code, and it's not trivial to integrate with GeoServer
> since it depends on WebSphere specific jars (with the dependency
> and redistribution issues that go along with them). Usually
> reflection is used to be able and compile those without actually
> having the pool specific classes in the classpath.
>
> Actually GeoServer 1.7.5 should ship with all the Spring unwrappers,
> and there is one dedicated to WebSphere, the javadocs inside
> of it talk about WebSphere 5, but it seems the API calls are
> the one you mentioned above (just harder to read because of
> reflection):
>
> ---------------------------------------------------------------
>
> private static final String JDBC_ADAPTER_CONNECTION_NAME_5 =
> "com.ibm.ws.rsadapter.jdbc.WSJdbcConnection";
>
> private static final String JDBC_ADAPTER_UTIL_NAME_5 =
> "com.ibm.ws.rsadapter.jdbc.WSJdbcUtil";
>
>
> private Class webSphere5ConnectionClass;
>
> private Method webSphere5NativeConnectionMethod;
>
>
> /**
> * This constructor retrieves WebSphere JDBC adapter classes,
> * so we can get the underlying vendor connection using reflection.
> */
> public WebSphereNativeJdbcExtractor() {
> try {
> this.webSphere5ConnectionClass =
> getClass().getClassLoader().loadClass(JDBC_ADAPTER_CONNECTION_NAME_5);
> Class jdbcAdapterUtilClass =
> getClass().getClassLoader().loadClass(JDBC_ADAPTER_UTIL_NAME_5);
> this.webSphere5NativeConnectionMethod =
> jdbcAdapterUtilClass.getMethod("getNativeConnection", new Class[]
> {this.webSphere5ConnectionClass});
> }
> catch (Exception ex) {
> throw new IllegalStateException(
> "Could not initialize WebSphereNativeJdbcExtractor because
> WebSphere API classes are not available: " + ex);
> }
> }
>
> ---------------------------------------------------------------
>
> The spring unwrappers are actually the ones that make the Tomcat
> JNDI example work, since Tomcat has its own modified version of
> DBCP that only those can handle.
>
> So... I don't know why they are not working in your case.
> I'll add a jira to get better logging out of the Spring unwrappers,
> at the moment they silently skip all of the unwrappers that do
> fail to load.
>
> A shot in the dark: are you sure GeoServer is allowed to see
> the com.ibm.ws.rsadapter.jdbc.WSJdbcUtil class? Maybe some
> classloader magic is needed?
>
> Cheers
> Andrea
>
> --
> Andrea Aime
> OpenGeo - http://opengeo.org
> Expert service straight from the developers.
 


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: JNDI configuration of datastores in Websphere

by Kris Geusebroek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Problem Solved!!

Reason for this strange behaviour was not that the websphere specific classes were not found on the classpath eventually.
Problem was that in the SpringUnWrapper class all extractors were tried and the Jdbc4NativeJdbcExtractor was throwing a NoSuchMethodError (it tries to unwrap the connection using a jdk6 specific method called 'unwrap' on the connection class.)

This prevents the SpringUnwrapper class to try the other configured extractors.
So my dirty workaround solution for now is I changed the SpringUnwrapper class to catch a Throwable instead of the Exception so the unwrapper can continue it's work.

Cheers Kris

-----Original Message-----
From: Andrea Aime [mailto:aaime@...]
Sent: Friday, July 10, 2009 1:12 PM
To: Kris Geusebroek
Cc: Christian Müller; geoserver-users@...
Subject: Re: [Geoserver-users] JNDI configuration of datastores in Websphere

Kris Geusebroek ha scritto:
> Hi Andrea,
>
> I had a look in the classloader view of the websphere console and could not find this class.
> So I think that's the cause.
>
> I'm using websphere 6.1.
> I did a bit of searching and I think the class must be available in rsadaptersspi.jar. Can you confirm that?
> And is it possible to just add it to the websphere lib directory?

I have no idea in either case, never used WebSphere

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Problem posting a layer with Rest

by web-20 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all,

I want to post a new featuretype in geoserver using rest, I've already tryied to delete one with rest, it's ok.

So, with curl I've made a GET of a featuretype, just changed some attribute insinde and posted the new content with:

curl -u admin:geoserver -v -XPOST -T ViveLaVie.xml -H "Content-type: text/xml"

Ok, whatever the file I've posted, I receive this error:

2009-07-16 16:41:29,453 INFO [org.geoserver] - Loaded feature type 'ViveLaVie', enabled
2009-07-16 16:41:29,470 ERROR [geoserver.global] - Could not load feature type easySDIPublishNamespace:ViveLaVie
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
 at org.vfny.geoserver.global.FeatureTypeInfo.isCachingEnabled(FeatureTypeInfo.java:1677)
 at org.vfny.geoserver.global.FeatureTypeInfo.toDTO(FeatureTypeInfo.java:528)


IsCatchingEnabled fails because it tryies to convert a String to Boolean... In! my file,
i've defined this property this way:

<metadata>
    <kml.regionateAttribute>null</kml.regionateAttribute>
    <indexingEnabled>false</indexingEnabled>
    <cacheAgeMax></cacheAgeMax>
    <cachingEnabled>false</cachingEnabled>
    <gml.schemaSchema>_essai_sdi_plop4_Type</gml.schemaSchema>
    <gml.schemaBase>gml:AbstractFeatureType</gml.schemaBase>
    <kml.regionateStrategy>best_guess</kml.regionateStrategy>
    <dirName>easySDIPublishDatastore_HalloVelo</dirName>
    <kml.regionateFeatureLimit>15</kml.regionateFeatureLimit>
  </metadata>

 

When i remove the  <indexingEnabled>false</indexingEnabled> tag, it goes further and a next error appears for another Boolean...

Do someone has a clue why this error occurs?!


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: Problem posting a layer with Rest

by Justin Deoliveira-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, this is a known issue:

http://jira.codehaus.org/browse/GEOS-3148

On trunk this has been fixed however on 1.7.x it is still a problem.

Other devs:

We could backport the metadata map stuff back to 1.7.x Or alternatively
just replace code that does:

Boolean cachingEnabled = (Boolean) featureType.getMetadata().get(
"cachingEnabled" );

with:

Boolean cachingEnabled = Converters.convert(
featureType.getMetadata().get( "cachingEnabled" ), Boolean.class);

I could go either way... backporting the metadata map means mucking with
the catalog apis on 1.7.x which i am not crazy about, i think i prefer
the brute force approach. But could go either way.

Thoughts?

web wrote:

> Hello all,
>
> I want to post a new featuretype in geoserver using rest, I've already
> tryied to delete one with rest, it's ok.
>
> So, with curl I've made a GET of a featuretype, just changed some
> attribute insinde and posted the new content with:
>
> curl -u admin:geoserver -v -XPOST -T ViveLaVie.xml -H "Content-type:
> text/xml"
>
> Ok, whatever the file I've posted, I receive this error:
>
> 2009-07-16 16:41:29,453 INFO [org.geoserver] - Loaded feature type
> 'ViveLaVie', enabled
> 2009-07-16 16:41:29,470 ERROR [geoserver.global] - Could not load
> feature type easySDIPublishNamespace:ViveLaVie
> java.lang.ClassCastException: java.lang.String cannot be cast to
> java.lang.Boolean
>  at
> org.vfny.geoserver.global.FeatureTypeInfo.isCachingEnabled(FeatureTypeInfo.java:1677)
>  at
> org.vfny.geoserver.global.FeatureTypeInfo.toDTO(FeatureTypeInfo.java:528)
>
>
> IsCatchingEnabled fails because it tryies to convert a String to
> Boolean... In! my file,
> i've defined this property this way:
>
> <metadata>
>     <kml.regionateAttribute>null</kml.regionateAttribute>
>   *  <indexingEnabled>false</indexingEnabled>*
>     <cacheAgeMax></cacheAgeMax>
>     <cachingEnabled>false</cachingEnabled>
>     <gml.schemaSchema>_essai_sdi_plop4_Type</gml.schemaSchema>
>     <gml.schemaBase>gml:AbstractFeatureType</gml.schemaBase>
>     <kml.regionateStrategy>best_guess</kml.regionateStrategy>
>     <dirName>easySDIPublishDatastore_HalloVelo</dirName>
>     <kml.regionateFeatureLimit>15</kml.regionateFeatureLimit>
>   </metadata>
>
>  
>
> When i remove the * <indexingEnabled>false</indexingEnabled> *tag, it
> goes further and a next error appears for another Boolean...
>
> Do someone has a clue why this error occurs?!
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge  
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize  
> details at: http://p.sf.net/sfu/Challenge
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Geoserver-users mailing list
> Geoserver-users@...
> https://lists.sourceforge.net/lists/listinfo/geoserver-users


--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Parent Message unknown Re: Problem posting a layer with Rest

by web-20 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 


Ok, now I understand.
however in the 1.7.5 win binary release, this problem occurs. But when I launch the unit tests from the last version of the trunk, there is no problem...

I should take the code from the trunk and not the branch 1.7.x.

Another more important behaviour I've seen with release 1.7.5 is:

if I post a new featuretype (avoiding previous errors) all run fine :-)
directly after that, if I make a GET of the new created feature, all is ok. But if I make a GET for the list of all FeatureTypes, it fails with a runtime exception. If restart the server, all is ok, no more errors and I can see the new featuretype + list.

A workaround to fix this that works was to "apply + save" the config using the geoserver front-end DIRECTLY after POSting the new featuretype. This means the rest api doesn't save the config properly after creating a FeatureType.

Is it also a known issue?

Cheers, Rémy

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: Problem posting a layer with Rest

by Justin Deoliveira-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Remy,

web wrote:

>  
>
>
> ------------------------------------------------------------------------
>
> Subject:
> Re: [Geoserver-users] Problem posting a layer with Rest
> From:
> web <web@...>
> Date:
> Sat, 18 Jul 2009 01:14:20 +0200
> To:
> Justin Deoliveira <jdeolive@...>
>
> To:
> Justin Deoliveira <jdeolive@...>
>
>
> Ok, now I understand.
> however in the 1.7.5 win binary release, this problem occurs. But when I launch the unit tests from the last version of the trunk, there is no problem...
>
> I should take the code from the trunk and not the branch 1.7.x.

Well the restconfig code has not been ported to trunk yet:

http://jira.codehaus.org/browse/GEOS-3060

But i am about to commit it on trunk in the next day or so.
>
> Another more important behaviour I've seen with release 1.7.5 is:
>
> if I post a new featuretype (avoiding previous errors) all run fine :-)
> directly after that, if I make a GET of the new created feature, all is ok. But if I make a GET for the list of all FeatureTypes, it fails with a runtime exception. If restart the server, all is ok, no more errors and I can see the new featuretype + list.
>
> A workaround to fix this that works was to "apply + save" the config using the geoserver front-end DIRECTLY after POSting the new featuretype. This means the rest api doesn't save the config properly after creating a FeatureType..
>
> Is it also a known issue?

Hmmm... no, this is not a known issue. Would you be able to provide the
stack trace?

Thanks,

-Justin

>
> Cheers, Rémy
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge  
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize  
> details at: http://p.sf.net/sfu/Challenge
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Geoserver-users mailing list
> Geoserver-users@...
> https://lists.sourceforge.net/lists/listinfo/geoserver-users


--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

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