This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Access DataSource from Java client

 
Dirk Fiege
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi helpers and supporters,
I have a J2EE application running on Websphere (WSAD) and I have written
some JUnit testcase for this application. All this stuff was already running on WebLogic and now I have migrated it to WebSphere. Some of the JUnit testcases directly make a lookup on the DataSources without using an EJB in between. In WebLogic I was able to lookup the DataSources directly from the JUnit testcase, but in WebSphere (WSAD) I get a SecurityException when I try to do this. This happens even I disabled all security stuff in WSAD.
Why is it not possible to lookup a DataSource from a Java application directly (outside the container)?
Any idea how I can make it?
Thanks a lot

- Fide
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible but you need to use the Application Container (launch Client). This is all covered in detail in my book -- but the short answer is you need to package your JUnit tests into an Application Client project and put that in an EAR file. Then you can use Run... to set up an Application Client runner for your Tests, using the JUnit test runner as the main() class.
Kyle
 
Dirk Fiege
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks a lot for a quick answer!
I think I understood what you mean. I already started to setup
a new client project and to include a first JUnit testcase here.
So I should be able to assign the required references like EJB
and DataSource references to this client project later on, right?
Then I will try to start the different JUnit test classes from
Run.. and the different available main methods.
Let's see if I can manage this...
- fidi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic