Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to print out the line of code causing the bug

Reply
Thread Tools

How to print out the line of code causing the bug

 
 
laredotornado
Guest
Posts: n/a
 
      12-09-2008
Hi,

Using Java 1.5. When I run my JUnit test that calls a remote EJB, a
RemoteException is returned. Although it prints out the method that
failed, it doesn't print the line number ...

[junit] Error: EJB Object Pool exception:
java.rmi.RemoteException: EJB Exception: ; nested exception is:
[junit] java.lang.NullPointerException
[junit] at
com.myco.safariview.cedarpoint.delegates.CPDelegat e.deleteSubscriber
(Unknown Source)
[junit] at DeleteAddSubscriberTest.testDeleteSubscriber(Unkno wn
Source)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e
Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
[junit] at java.lang.reflect.Method.invoke(Method.java:585)
[junit] at junit.framework.TestCase.runTest(TestCase.java:168 )
[junit] at junit.framework.TestCase.runBare(TestCase.java:134 )

What do I need to do when building the remote EJB so that I can get a
line number instead of "Unknown Source"? Below is the ant task (1.6)
I use to generate the EJB. Let me know what other info I should
provide.

Thanks, - Dave

<target name="generate-admin-ejb" depends="check-ejbgen">
<delete dir="${deployment}/META-INF"/>
<mkdir dir="${deployment}/META-INF"/>
<ejbgen
source="1.5"
outputDir="${src}"
sourcepath="${src}"
descriptorDir="${deployment}/META-INF"
exitOnError="true"
verbose="true"
>

<classpath refid="project.class.path"/>
<fileset dir="${src}" includes="**/*AdminBean.java" />
</ejbgen>

<replace dir="${src}" token="$" value="." >
<include name="**/*Query.java"/>
</replace>
<java classname="com.bea.wls.ejbgen.EJBGen" fork="true"
failonerror="true" dir="${src}">
<classpath>
<pathelement path="${java.class.path}"/>
<pathelement location="${ejbgen-jar-path}"/>
</classpath>
<arg value="${src}/com/myco/safariview/cedarpoint/ejb/sb/
CPAdminBean.java"/>
<arg value="-exitOnError"/>
<arg value="-verbose"/>
<arg value="-wls81"/>
</java>
<move todir="${deployment}/META-INF">
<fileset dir="${src}" includes="*ejb-jar.xml"/>
</move>
<delete>
<fileset dir="${src}" includes="*.xml"/>
</delete>
</target>
 
Reply With Quote
 
 
 
 
Sigfried
Guest
Posts: n/a
 
      12-09-2008
laredotornado a écrit :
> Hi,
>
> Using Java 1.5. When I run my JUnit test that calls a remote EJB, a
> RemoteException is returned. Although it prints out the method that
> failed, it doesn't print the line number ...
>
> [junit] Error: EJB Object Pool exception:
> java.rmi.RemoteException: EJB Exception: ; nested exception is:
> [junit] java.lang.NullPointerException
> [junit] at
> com.myco.safariview.cedarpoint.delegates.CPDelegat e.deleteSubscriber
> (Unknown Source)
> [junit] at DeleteAddSubscriberTest.testDeleteSubscriber(Unkno wn
> Source)
> [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e
> Method)
> [junit] at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
> [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> [junit] at java.lang.reflect.Method.invoke(Method.java:585)
> [junit] at junit.framework.TestCase.runTest(TestCase.java:168 )
> [junit] at junit.framework.TestCase.runBare(TestCase.java:134 )
>
> What do I need to do when building the remote EJB so that I can get a
> line number instead of "Unknown Source"? Below is the ant task (1.6)
> I use to generate the EJB. Let me know what other info I should
> provide.
>
> Thanks, - Dave
>
> <target name="generate-admin-ejb" depends="check-ejbgen">
> <delete dir="${deployment}/META-INF"/>
> <mkdir dir="${deployment}/META-INF"/>
> <ejbgen
> source="1.5"
> outputDir="${src}"
> sourcepath="${src}"
> descriptorDir="${deployment}/META-INF"
> exitOnError="true"
> verbose="true"
> >


There must be an attribute like for javac (debug="true") in ejbgen.

> <classpath refid="project.class.path"/>
> <fileset dir="${src}" includes="**/*AdminBean.java" />
> </ejbgen>
>
> <replace dir="${src}" token="$" value="." >
> <include name="**/*Query.java"/>
> </replace>
> <java classname="com.bea.wls.ejbgen.EJBGen" fork="true"
> failonerror="true" dir="${src}">
> <classpath>
> <pathelement path="${java.class.path}"/>
> <pathelement location="${ejbgen-jar-path}"/>
> </classpath>
> <arg value="${src}/com/myco/safariview/cedarpoint/ejb/sb/
> CPAdminBean.java"/>
> <arg value="-exitOnError"/>
> <arg value="-verbose"/>
> <arg value="-wls81"/>
> </java>
> <move todir="${deployment}/META-INF">
> <fileset dir="${src}" includes="*ejb-jar.xml"/>
> </move>
> <delete>
> <fileset dir="${src}" includes="*.xml"/>
> </delete>
> </target>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
print a vs print '%s' % a vs print '%f' a David Cournapeau Python 0 12-30-2008 03:19 AM
Problem - I want to print Current Output of Pdf file and should print once.I get print dialog box but it is not working keto Java 0 05-30-2007 11:27 AM
*bug* *bug* *bug* David Raleigh Arnold Firefox 12 04-02-2007 03:13 AM
Unlarging the print to print using PDF file to print Bun Mui Computer Support 3 09-13-2004 03:15 AM



Advertisments