aspose file tools*
The moose likes Testing and the fly likes JunitEE Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "JunitEE Problem" Watch "JunitEE Problem" New topic
Author

JunitEE Problem

Ramesh Kumar
Ranch Hand

Joined: Dec 28, 2004
Posts: 33
Hello,

I am using JunitEE for running unit test cases in RAD 7.5. I am getting null pointer exception.

This is the complete list of things I have done for execting the test case. Please correct me If I am doing anything wrong.

1. Created a dynamic project in RAD 7.5.
2. Copied the down loaded jars of JunitEE 1.11 (junitee.jar, junitee-anttask) and Junit4.5.jar in to WEB-INF/lib of the dynamic web project
3. Copied following content into web.xml of the dynamic web project
<servlet>
<servlet-name>JUnitEETestServlet</servlet-name>
<servlet-class>org.junitee.servlet.JUnitEEServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>JUnitEETestServlet</servlet-name>
<url-pattern>/TestServlet/*</url-pattern>
</servlet-mapping>
3. Created the package and Written a sample test case.
4. Created a file named testCase.txt under WEB-INF folder contating the entry com.emomed.enews.controllers.TestNewsController
5. Build and deployed on the server Websphere 7.0 server
6. Now I am running the JunitEE Servlet.

I used the same steps in previous versions it used to show me TestClasses and testCases in a Web Page when i run the JUnitEETestServlet. But now I am getting following error. Please help me I am in terribble need of this.

12/3/08 10:47:09:738 CST] 0000001a servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet JUnitEETestServlet in application TestProjectEAR. Exception created : java.lang.NullPointerException
at org.junitee.servlet.JUnitEEServlet.streamResource(JUnitEEServlet.java:251)
at org.junitee.servlet.JUnitEEServlet.doGet(JUnitEEServlet.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1443)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:790)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)

[12/3/08 10:47:09:785 CST] 0000001a LocalTranCoor E WLTC0017E: Resources rolled back due to setRollbackOnly() being called.
[12/3/08 10:47:09:785 CST] 0000001a webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[JUnitEETestServlet]: java.lang.NullPointerException
at org.junitee.servlet.JUnitEEServlet.streamResource(JUnitEEServlet.java:251)
at org.junitee.servlet.JUnitEEServlet.doGet(JUnitEEServlet.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1443)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:790)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)
[ December 03, 2008: Message edited by: Ramesh Kumar ]
Ganesh Choudhary
Greenhorn

Joined: Sep 11, 2009
Posts: 11
You will have to create the object of TestRunner Class in your servlet and then call the run method on this object. Then Pass the TestRunnerResult Object to create the object of OutputProducer class . Call render() method on this object of OutputProducer Class.

You can go through the sample code of JUnitEEServlet at :
[url]http://demo.spars.info/j/frameset.cgi?compo_id=345268&packagename=org.junitee.servlet&componame=org.junitee.servlet.JUnitEEServlet&mode=frameset&ref=5&start_class=0&location=1111111111111111111&CASE=0&MORPHO=1&LANG=1&q=jsp&hl=jsp&compo_id=345269
[/url]

Thanks.
george mikal
Greenhorn

Joined: Apr 24, 2010
Posts: 1
thanks for sharing here code..


350-030 and 350-040 guide as well for more help EX0-101 and 352-001

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JunitEE Problem