You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Thomas Achleitner <ta...@ftisoft.at> on 2002/12/06 15:58:07 UTC

ClassCastException loading DataSource

Hi!

I'm running into a ClassCastException loading jndi DataSources. I configured the resource in tomcats server.xml using the following entry (i do not mention web.xml because its working with oracle application server):
<Resource name="jdbc/OracleDS" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/OracleDS">
	<parameter><name>username</name><value>scott</value></parameter>
	<parameter><name>password</name><value>tiger</value></parameter>
	<parameter><name>driverClassName</name><value>oracle.jdbc.driver.OracleDriver</value></parameter>	<parameter><name>url</name><value>jdbc:oracle:thin:@dbdemo:1521:ORA</value></parameter>
</ResourceParams>

The Source for DataSource lookup is here:
initCtx = new InitialContext();
envCtx = (Context) initCtx.lookup("java:comp/env");
dataSource = (DataSource) envCtx.lookup("jdbc/OracleDS");
con = dataSource.getConnection();

During runtime i get a ClassCastException when looking up the DataSource from the jndi context:
java.lang.ClassCastException: tyrex.jdbc.xa.EnabledDataSource 

Do i have to specify the parameter factory in ResourceParams? If yes, which factory? Or is there something else wrong?

Thanks in advance!

Thomas Achleitner

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: bug in Tomcat 4 or .... what?

Posted by Mike W-M <mi...@ward-murphy.co.uk>.
>From the Servlet Spec (2.3)'s section on the getParameter() method:
<<
If the parameter data was sent in the request body, such as occurs with an
HTTP POST request, then reading the body directly via getInputStream() or
getReader() can interefere with the execution of this method.
>>
I believe there's other stuff in there too about not expecting everything to
work as normal if you go low-level messing around with the request.

Mike.

----- Original Message -----
From: "Ivan Venuti" <i....@caribel.pisa.it>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Tuesday, December 17, 2002 12:31 PM
Subject: bug in Tomcat 4 or .... what?


Hi,

I have a servlet that opens a DataInputStrem on the request (see below)

public void doPost(HttpServletRequest request, HttpServletResponse response)
   throws ServletException    {

 try{
   // Open the I/O streams
    DataInputStream in = new DataInputStream(request.getInputStream() );

After this pice of code I cant' access any more to the request parameters.
Infact this code:

request.getParameter("anyParameter")

retrieves ALWAYS null.
The strange thing is that this servlet was Ok for tomcat 3, but can't work
any more with Tomcat4.

Anyone can explain why opening a DataInputStream alters the
HttpServletRequest?

Thanks

-- Ivan Venuti --



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


bug in Tomcat 4 or .... what?

Posted by Ivan Venuti <i....@caribel.pisa.it>.
Hi,

I have a servlet that opens a DataInputStrem on the request (see below)

public void doPost(HttpServletRequest request, HttpServletResponse response)
   throws ServletException    {

 try{
   // Open the I/O streams
    DataInputStream in = new DataInputStream(request.getInputStream() );

After this pice of code I cant' access any more to the request parameters.
Infact this code:

request.getParameter("anyParameter")

retrieves ALWAYS null.
The strange thing is that this servlet was Ok for tomcat 3, but can't work
any more with Tomcat4.

Anyone can explain why opening a DataInputStream alters the
HttpServletRequest?

Thanks

-- Ivan Venuti --



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Sharing Session data between two instances?

Posted by Luiz Ricardo <lu...@itx.com.br>.
Hi,

take o look at:

http://www.onjava.com/lpt/a/2422
http://www2.theserverside.com/resources/article.jsp?l=Tomcat

Luiz Ricardo
----- Original Message -----
From: "Prashanth Pushpagiri" <pr...@yahoo.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Sunday, December 15, 2002 4:57 PM
Subject: Sharing Session data between two instances?


> Hi
>
> I am trying to setup tomcat 4.1.12 on two servers so
> that an incoming request can be handled by either one
> of the servers. What I would like to do is share
> session details between the two instances. Is this
> possible?
>
> Thanks
> Prashanth
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Sharing Session data between two instances?

Posted by Prashanth Pushpagiri <pr...@yahoo.com>.
Hi

I am trying to setup tomcat 4.1.12 on two servers so
that an incoming request can be handled by either one
of the servers. What I would like to do is share
session details between the two instances. Is this
possible?

Thanks
Prashanth

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>