INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

problelm in using Junit with WSAD

problelm in using Junit with WSAD

(OP)
I am trying to test data access objects in our project in WSAD5.0 using Junit. DAOs are in my J2EE application.
First of all I was getting the error of intial context as I was trying to access DAOs from client outside the container. But I resolved the error by putting jar file ns.jar which contains jndi.properties file in my project classpath.
jndi.properties file contains following parameters
java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory
java.naming.factory.url.pkgs=com.ibm.ws.naming
java.naming.provider.url=iiop://10.234.48.250:2809

Now when i run the Junit test class i get the following error.


Unable to read required resource: implfactory.properties
java.lang.NullPointerException
    at java.io.Reader.<init>(Reader.java(Inlined Compiled Code))
    at java.io.InputStreamReader.<init>(InputStreamReader.java(Inlined Compiled Code))
    at java.io.InputStreamReader.<init>(InputStreamReader.java(Inlined Compiled Code))
    at java.util.Properties.load(Properties.java(Compiled Code))
    at com.ibm.ws.util.ImplFactory$1.run(ImplFactory.java:38)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.ibm.ws.util.ImplFactory.<clinit>(ImplFactory.java:33)
    at com.ibm.ejs.jts.jts.CurrentFactory.<clinit>(CurrentFactory.java:56)
    at com.ibm.ejs.jts.jts.ClientInterceptor.initializeControlSet(ClientInterceptor.java:544)
    at com.ibm.ejs.jts.jts.ClientInterceptor.send_request(ClientInterceptor.java:239)
    at com.ibm.rmi.pi.InterceptorManager.iterateSendRequest(InterceptorManager.java:385)
    at com.ibm.rmi.iiop.ClientRequestImpl.<init>(ClientRequestImpl.java:122)
    at com.ibm.rmi.iiop.GIOPImpl.createRequest(GIOPImpl.java:142)
    at com.ibm.rmi.iiop.GIOPImpl.createRequest(GIOPImpl.java:101)
    at com.ibm.CORBA.iiop.ClientDelegate._createRequest(ClientDelegate.java:2411)
    at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1276)
    at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1175)
    at com.ibm.CORBA.iiop.ClientDelegate.request(ClientDelegate.java:1928)
    at org.omg.CORBA.portable.ObjectImpl._request(ObjectImpl.java:245)
    at com.ibm.WsnBootstrap._WsnNameServiceStub.getProperties(_WsnNameServiceStub.java:37)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1090)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:676)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:604)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:478)
    at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:102)
    at com.ibm.ws.naming.util.WsnInitCtx.<init>(WsnInitCtx.java:82)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContext(WsnInitCtxFactory.java:324)
    at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:112)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
    at javax.naming.InitialContext.init(InitialContext.java:231)
    at javax.naming.InitialContext.<init>(InitialContext.java:187)
    at com.nm.ccf.BizComponents.dab.ChangeTransactionDAB.isChangeTransactionPresent(ChangeTransactionDAB.java:325)
    at com.nm.ccf.BizComponents.dab.ChangeTransactionDABTest.testIsChangeTransactionPresent(ChangeTransactionDABTest.java:108)
    at java.lang.reflect.Method.invoke(Native Method)
    at junit.framework.TestCase.runTest(TestCase.java:166)
    at junit.framework.TestCase.runBare(TestCase.java:140)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:131)
    at junit.framework.TestSuite.runTest(TestSuite.java:173)
    at junit.framework.TestSuite.run(TestSuite.java:168)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:329)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:218)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:151)
Exception: A communication failure occurred while attempting to obtain an initial context using the provider url: "iiop://10.234.48.250:2809". Make sure that the host and port information is correct and that the server identified by the provider url is a running name server.  If no port number is specified, the default port number 2809 is used. Other possible causes include the network environment or workstation network configuration.

########################################################

Any solution for this

REgards
Praful

RE: problelm in using Junit with WSAD

Connecting to the websphere stuff is a little problematic.

I have seen this issue before, basically it is looking for the implfactory.properties file in you classpath. You have two options to resolve, eitheradd the implfactory.jar file located in %wsad_install_dir%/wstools/eclipse/plugins/com.ibm.websphere.v51_5.1.0 (or something like that) or copy the implfactory.properties file from that jar into your classpath.

As a side note, you will have further issues running here - I don't remember them all but be prepared for a battle. These are issues regardless of whether you are running a junit or a stand-alone java app.

RE: problelm in using Junit with WSAD

The easiest way to add j2ee.jar to your build path.

good luck!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close