aspose file tools
The moose likes Websphere and the fly likes problem grabbing DataSource Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Websphere
Reply Bookmark "problem grabbing DataSource" Watch "problem grabbing DataSource" New topic
Author

problem grabbing DataSource

Ryan Zezeski
Greenhorn

Joined: Mar 13, 2005
Posts: 29
ClassCastException: javax.naming.Reference

First off, I know what this problem is. Yes, the class trying to grab the DataSource is running on a different JVM (aka stand alone client). Yes, my classpath is set properly.

My question is if there is anyway to grab a DataSource object from WAS from a stand alone client.

Basically I have a Session bean that relies on a helper class for all it's logic. I then have jUnit tests that directly test this helper class (I do it this way so I can perform more specific low-level checking, rathering than performing tests using high level operations). The problem is the helper class uses a Data Access class that utilizes the App Server's JDBC DataSource (in production this class will reside in the Application's JVM so normally its fine). So when the Data Access class is being initialized (doing the JNDI lookup) it fails because it is getting back a javax.naming.Refernce rahter than a DataSource objct.

So, is it possible in WAS 5.1.x to directly grab a DataSource from a class running in a seperate JVM? My guess is no and it seems IBM also has documentation that says this is not possible:

http://publib.boulder.ibm.com/infocenter/wasinfo/v5r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/ucli_datasor.html


Anyways, I guess i'm looking for options or some kind of input. Another reason this bothers me is the same jUnit test runs absolutely fine against Weblogic8.1 . Why can't WAS be as forgiving as Weblogic?? It's always something with WAS.


Java has 99 problems but a pointer ain't one
Patrick Finnegan
Ranch Hand

Joined: Mar 05, 2002
Posts: 179
Good news: There is a work around.
Bad News: It's EJB.
Ryan Zezeski
Greenhorn

Joined: Mar 13, 2005
Posts: 29
Originally posted by Patrick Finnegan:
Good news: There is a work around.
Bad News: It's EJB.


That's what I thought :sigh::.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem grabbing DataSource
 
Similar Threads
HELP! Websphere ThreadMonitor Exception
Hot Deployment
StaleConnectionException
Best practices for deployment of common utility JAR
Standalone Java EJB client