How to print out the line of code causing the bug

Discussion in 'Java' started by laredotornado, Dec 9, 2008.

  1. 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.CPDelegate.deleteSubscriber
    (Unknown Source)
    [junit] at DeleteAddSubscriberTest.testDeleteSubscriber(Unknown
    Source)
    [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
    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>
    laredotornado, Dec 9, 2008
    #1
    1. Advertising

  2. laredotornado

    Sigfried Guest

    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.CPDelegate.deleteSubscriber
    > (Unknown Source)
    > [junit] at DeleteAddSubscriberTest.testDeleteSubscriber(Unknown
    > Source)
    > [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
    > 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>
    Sigfried, Dec 9, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. keto
    Replies:
    0
    Views:
    935
  2. David Cournapeau

    print a vs print '%s' % a vs print '%f' a

    David Cournapeau, Dec 30, 2008, in forum: Python
    Replies:
    0
    Views:
    348
    David Cournapeau
    Dec 30, 2008
  3. Colin Baker
    Replies:
    7
    Views:
    134
    Adrienne Boswell
    May 5, 2008
  4. Collin Moore

    find a print out a line

    Collin Moore, Oct 8, 2009, in forum: Ruby
    Replies:
    9
    Views:
    109
    7stud --
    Oct 12, 2009
  5. iMath
    Replies:
    2
    Views:
    152
    Peter Otten
    Dec 26, 2012
Loading...

Share This Page