Error connecting to oracle 10g on websphere 6.1

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Error connecting to oracle 10g on websphere 6.1

paul8226
While trying to get oracle 10g connectivity on websphere 6.1 I'm getting the following error in the orbeon logs.

javax.naming.NameNotFoundException: Name jdbc not found in context "java:comp/env".

Some settings:

<property as="xs:anyURI"  name="oxf.fr.persistence.app.uri.*.*.*"   value="/fr/service/oracle"/> 
<property as="xs:anyURI " name="oxf.fr.persistence.service.oracle.datasource" value="AUDO"/>

Datasource jndi name is "jdbc/AUDO"
Reply | Threaded
Open this post in threaded view
|

Re: Error connecting to oracle 10g on websphere 6.1

paul8226
So I think I fixed the above problem but now I'm wondering if there is a way to specify to form builder the db schema to use.
Reply | Threaded
Open this post in threaded view
|

Re: Re: Error connecting to oracle 10g on websphere 6.1

Alessandro  Vernet
Administrator
Paul,

I am not sure to fully understand your question. You specify the
datasource to use through the
oxf.fr.persistence.service.oracle.datasource property, which you
quoted earlier. So if you specify "my-datasource" in that property,
Orbeon Forms will look for the datasource
"java:comp/env/jdbc/my-datasource" you configured in your application
server.

Alex

On Tue, Feb 9, 2010 at 12:09 PM, paul8226 <[hidden email]> wrote:

>
> So I think I fixed the above problem but now I'm wondering if there is a way
> to specify to form builder the db schema to use.
> --
> View this message in context: http://n4.nabble.com/Error-connecting-to-oracle-10g-on-websphere-6-1-tp1474624p1474952.html
> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Error connecting to oracle 10g on websphere 6.1

paul8226
The datasource problem was fixed when I defined the <resource-ref> in the web.xml.  The reason I didn't do that before was that on websphere 6.1 I had the datasource defined through the server console and another application on the same server instance was able to access it without having a the datasource defined on the web.xml.  Hopefully that makes sense.

The schema issue I worked around by having the dba write a trigger to automatically assign the DB user to the schema I wanted upon login.  Without the trigger the table names referenced by orbeon in its prepared statements were not being found even though they existed.

The issue I'm on now is orbeon is identifying the werbsphere server as tomcat 4 and assuming a certain prepared statement class is present(org.apache.commons.dbcp.DelegatingPreparedStatement), that I'm assuming is present in Tomcat but in websphere the class returned is (com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement).  I looked at the source for the class that causes the exception and it seems like I might just have to change a few lines to get it working with the websphere class or I'll have to change the behaviour of websphere.

2010-02-09 16:23:40,156 INFO  DatabaseContext  - Rolling back JDBC connection for datasource: jdbc/DMAUDO.
2010-02-09 16:23:40,171 ERROR ProcessorService  - Exception at line 368 of oxf:/apps/fr/persistence/oracle/crud.xpl
java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement incompatible with org.apache.commons.dbcp.DelegatingPreparedStatement
        at org.orbeon.oxf.processor.sql.delegates.SQLProcessorOracleTomcat4Delegate.getOraclePreparedStatement(SQLProcessorOracleTomcat4Delegate.java:43)
       
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Error connecting to oracle 10g on websphere 6.1

Erik Bruchez-3
Paul,

You can find the code that selects one of the database delegates in
SQLProcessorInterpreterContext.java. And if you find a better solution
than these delegates, please let me know ;)

-Erik

On Wed, Feb 10, 2010 at 7:44 AM, paul8226 <[hidden email]> wrote:

>
> The datasource problem was fixed when I defined the <resource-ref> in the
> web.xml.  The reason I didn't do that before was that on websphere 6.1 I had
> the datasource defined through the server console and another application on
> the same server instance was able to access it without having a the
> datasource defined on the web.xml.  Hopefully that makes sense.
>
> The schema issue I worked around by having the dba write a trigger to
> automatically assign the DB user to the schema I wanted upon login.  Without
> the trigger the table names referenced by orbeon in its prepared statements
> were not being found even though they existed.
>
> The issue I'm on now is orbeon is identifying the werbsphere server as
> tomcat 4 and assuming a certain prepared statement class is
> present(org.apache.commons.dbcp.DelegatingPreparedStatement), that I'm
> assuming is present in Tomcat but in websphere the class returned is
> (com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement).  I looked at the source
> for the class that causes the exception and it seems like I might just have
> to change a few lines to get it working with the websphere class or I'll
> have to change the behaviour of websphere.
>
> 2010-02-09 16:23:40,156 INFO  DatabaseContext  - Rolling back JDBC
> connection for datasource: jdbc/DMAUDO.
> 2010-02-09 16:23:40,171 ERROR ProcessorService  - Exception at line 368 of
> oxf:/apps/fr/persistence/oracle/crud.xpl
> java.lang.ClassCastException:
> com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement incompatible with
> org.apache.commons.dbcp.DelegatingPreparedStatement
>        at
> org.orbeon.oxf.processor.sql.delegates.SQLProcessorOracleTomcat4Delegate.getOraclePreparedStatement(SQLProcessorOracleTomcat4Delegate.java:43)
>
> --
> View this message in context: http://n4.nabble.com/Error-connecting-to-oracle-10g-on-websphere-6-1-tp1474624p1475968.html
> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Error connecting to oracle 10g on websphere 6.1

paul8226
Just to give you an update.  To get the underlying OracleConnection object I had to call WSJdbcUtil.getNativeConnection(Connection) in QueryInterpreter.end().  By default websphere was returning it's own Connection and PreparedStatement objects which caused a class cast exception.

The second issue I ran into was an invalid character error from oracle when clicking the publish button from the Form Builder(the Save button worked fine) for any form.  

ORA-19202: Error occurred in XML processing
LPX-00216: invalid character 244 (0xF4)
Error at line 808
ORA-06512: at "SYS.XMLTYPE", line 254

The reason was because our oracle database had its character set configured to "US7ASCII".  I modified Dom4jUtils.domToString(final Branch branch) to include the line

format.setEncoding("US-ASCII");

This fixed the problem but obviously you wouldn't want to include this in your code since this fix might cause other bugs.  If this fix doesn't cause other bugs, maybe there's a way to set this based on asking the DB what character set it's configured to or to provide this as a configurable property.
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Error connecting to oracle 10g on websphere 6.1

paul8226
Just to add WSJdbcUtil seems like a webpshere specific class and I haven't looked into how to make this code portable to other servers while still supporting websphere.
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Error connecting to oracle 10g on websphere 6.1

Alessandro  Vernet
Administrator
Paul,

You'll let us know if you find a way to make something that we can put
in the codebase.

Alex

On Fri, Feb 19, 2010 at 8:28 AM, paul8226 <[hidden email]> wrote:

>
> Just to add WSJdbcUtil seems like a webpshere specific class and I haven't
> looked into how to make this code portable to other servers while still
> supporting websphere.
> --
> View this message in context: http://n4.nabble.com/Error-connecting-to-oracle-10g-on-websphere-6-1-tp1474624p1561874.html
> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Error connecting to oracle 10g on websphere 6.1

MichaelC
This post was updated on .
In reply to this post by paul8226
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Error connecting to oracle 10g on websphere 6.1

paul8226
I wish i could help you more but I don't have access to that code that I wrote anymore. I vaguely remember placing it in the begining of the method where the connection was being retrieved.  That way the implementation of the Connection interface being passed around is not the websphere wrapper but the underlying oracle class. I do have to warn you that this approach had problems when running multiple apps on websphere that tried to share the db connection. The correct approach is to use a provided websphere method that passes method calls to the underlying oracle classes instead of retrieving the underlying oracle class and calling methods on it directly, which is what my solution was because of lack of time and my code only being a proof of concept.

Sent from my iPhone

On May 7, 2010, at 3:56 PM, "MichaelC [via Orbeon Forms (ops-users)]" <[hidden email]> wrote:

Hello,

I have had a very similar issue as you have had with receiving an Oracle connection in Websphere. I have followed your comments, but I am unsure as to where you placed "WSJdbcUtil.getNativeConnection(Connection)" in "QueryInterpreter.java". Also, were there any other code changes?

If you can help me pin point as close as possible with what changes you made to Orbeon's code I would greatly appreciate it.

Thanks.


View message @ http://orbeon-forms-ops-users.24843.n4.nabble.com/Error-connecting-to-oracle-10g-on-websphere-6-1-tp1474624p2135661.html
To unsubscribe from Re: Re: Re: Error connecting to oracle 10g on websphere 6.1, click here.