You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Luis Rivera <lu...@gmail.com> on 2006/07/18 02:57:11 UTC

Tomcat 5.5/Axis 1.4 java.lang.reflect.InvocationTargetException

Hi Tomcat users,

I have a web service which will JNI to access the application, which
according to the documentation should be placed in the shared/classes
directory. I did so and I got a dreaded
java.lang.reflect.InvocationTargetException, which I believe is a class
loader problem. However, I have tried to solve this placing it in the
common/classes, server/classes and I get the same result.

I have searched the web for solutions, some people say that it is a
classpath problem, but nobody seems to let you know where exactly you set
this so that the correct class loader finds the class (assuming I am right
and it is a classloader problem).

Anyone here can help me? If have had a similar setup/problem and have a
solution at hand?

Thanks in advance,
--Luis R.

Re: Tomcat 5.5/Axis 1.4 java.lang.reflect.InvocationTargetException

Posted by Luis Rivera <lu...@gmail.com>.
    Hi Shankar,

Thanks a lot. I found my problem. It turned out not to be a Classloader
problem, but a NullPointer (THANKS TO TIM FOR THE HINT :) ) problem in the
server, which I had not found because I don't know how to debug my
application in Tomcat and there is no single log in the Tomcat directory
that can give me a clue of what's happening.

Anyway, the configuration worked as I had it initially:

1) Dropping the axis.jar in the WEB-INF/lib as you pointed out.

2) Stubs/Skeletons and all that had nothing to do with the JNI in
axis/WEB-INF/classes

3) The classes for the JNI interface/loading the jni library under
shared/classes

I think if I can find a way to debug our application in the server, we could
get better light on what is happening and solve problems a lot quicker :|.
It's like driving blind right now :|.

Anybody knows how to debug remotely axis/tomcat apps?

   --Luis R.

On 7/18/06, Shankar Unni <sh...@netscape.net> wrote:
>
> Luis Rivera wrote:
>
> > I have a web service which will JNI to access the application, which
> > according to the documentation should be placed in the shared/classes
> > directory. I did so and I got a dreaded
> > java.lang.reflect.InvocationTargetException, which I believe is a class
> > loader problem.
>
> You need to put the Axis jar in the WEB-INF/lib of your webapp. It
> wasn't clear in the original message whether you'd done it like this.
>
> That's because the common classloader is the *parent* of your webapp's
> classloader, and thus can't see any classes that are in your webapp. So
> you can't put the Axis library there.
>
> Note: only axis.jar itself really needs to go into the webapp's
> WEB-INF/lib. The rest of the Axis jars (saaj.jar, etc.) can go into
> common/lib, if you have many webapps in the same Tomcat instance that
> use Axis.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Tomcat 5.5/Axis 1.4 java.lang.reflect.InvocationTargetException

Posted by Shankar Unni <sh...@netscape.net>.
Luis Rivera wrote:

> I have a web service which will JNI to access the application, which
> according to the documentation should be placed in the shared/classes
> directory. I did so and I got a dreaded
> java.lang.reflect.InvocationTargetException, which I believe is a class
> loader problem. 

You need to put the Axis jar in the WEB-INF/lib of your webapp. It 
wasn't clear in the original message whether you'd done it like this.

That's because the common classloader is the *parent* of your webapp's 
classloader, and thus can't see any classes that are in your webapp. So 
you can't put the Axis library there.

Note: only axis.jar itself really needs to go into the webapp's 
WEB-INF/lib. The rest of the Axis jars (saaj.jar, etc.) can go into 
common/lib, if you have many webapps in the same Tomcat instance that 
use Axis.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Tomcat 5.5/Axis 1.4 java.lang.reflect.InvocationTargetException

Posted by Tim Lucia <ti...@yahoo.com>.
Is there a more complete trace in any log file?  This looks like the axis
error report that was snipped from the browser?  At this time I haven't got
anything more for you, unfortunately.

Tim

> -----Original Message-----
> From: Luis Rivera [mailto:luiggiilca@gmail.com]
> Sent: Monday, July 17, 2006 10:03 PM
> To: Tomcat Users List
> Cc: Tim Lucia
> Subject: Re: Tomcat 5.5/Axis 1.4
> java.lang.reflect.InvocationTargetException
> 
>    Thanks for the reply Tim,
> 
> Here is the stack trace, it does not look to me like it gives enough
> information. Of course I am just starting with Tomcat and have some blanks
> in my brain. I know is the classes are being found, either under commons
> or
> shared classes directory, because if I just delete the classes then what I
> get is a ClassNotFound exception, while if I place them under any of those
> directories, I get the following exception:
> 
> AxisFault
>  faultCode:
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
>  faultSubcode:
>  faultString: java.lang.reflect.InvocationTargetException
>  faultActor:
>  faultNode:
>  faultDetail:
>     {http://xml.apache.org/axis/}hostname:dellp101
> 
> java.lang.reflect.InvocationTargetException
>     at org.apache.axis.message.SOAPFaultBuilder.createFault(
> SOAPFaultBuilder.java:222)
>     at org.apache.axis.message.SOAPFaultBuilder.endElement(
> SOAPFaultBuilder.java:129)
>     at org.apache.axis.encoding.DeserializationContext.endElement(
> DeserializationContext.java:1087)
>     at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Un
> known
> Source)
>     at
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndEl
> ement(Unknown
> Source)
>     at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$Fra
> gmentContentDispatcher.dispatch(Unknown
> Source)
>     at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.sca
> nDocument(Unknown
> Source)
>     at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknow
> n
> Source)
>     at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknow
> n
> Source)
>     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
> Source)
>     at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
> Source)
>     at javax.xml.parsers.SAXParser.parse(Unknown Source)
>     at org.apache.axis.encoding.DeserializationContext.parse(
> DeserializationContext.java:227)
>     at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
>     at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
>     at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(
> MustUnderstandChecker.java:62)
>     at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>     at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
>     at org.apache.axis.client.Call.invoke(Call.java:2767)
>     at org.apache.axis.client.Call.invoke(Call.java:2443)
>     at org.apache.axis.client.Call.invoke(Call.java:2366)
>     at org.apache.axis.client.Call.invoke(Call.java:1812)
>     at soap.wsdl.CRLStub.getCompany(Unknown Source)
>     at client.gui.VSAApplet.setCompanyName(VSAApplet.java:94)
>     at client.gui.VSAApplet.init(VSAApplet.java:131)
>     at sun.applet.AppletPanel.run(Unknown Source)
>     at java.lang.Thread.run(Unknown Source)
> AxisFault
>  faultCode:
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
>  faultSubcode:
>  faultString: java.lang.reflect.InvocationTargetException
>  faultActor:
>  faultNode:
>  faultDetail:
>     {http://xml.apache.org/axis/}hostname:dellp101
> 
> java.lang.reflect.InvocationTargetException
>     at org.apache.axis.message.SOAPFaultBuilder.createFault(
> SOAPFaultBuilder.java:222)
>     at org.apache.axis.message.SOAPFaultBuilder.endElement(
> SOAPFaultBuilder.java:129)
>     at org.apache.axis.encoding.DeserializationContext.endElement(
> DeserializationContext.java:1087)
>     at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Un
> known
> Source)
>     at
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndEl
> ement(Unknown
> Source)
>     at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$Fra
> gmentContentDispatcher.dispatch(Unknown
> Source)
>     at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.sca
> nDocument(Unknown
> Source)
>     at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknow
> n
> Source)
>     at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknow
> n
> Source)
>     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
> Source)
>     at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
> Source)
>     at javax.xml.parsers.SAXParser.parse(Unknown Source)
>     at org.apache.axis.encoding.DeserializationContext.parse(
> DeserializationContext.java:227)
>     at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
>     at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
>     at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(
> MustUnderstandChecker.java:62)
>     at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>     at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
>     at org.apache.axis.client.Call.invoke(Call.java:2767)
>     at org.apache.axis.client.Call.invoke(Call.java:2443)
>     at org.apache.axis.client.Call.invoke(Call.java:2366)
>     at org.apache.axis.client.Call.invoke(Call.java:1812)
>     at soap.wsdl.CRLStub.getCompany(Unknown Source)
>     at client.gui.VSAApplet.setCompanyName(VSAApplet.java:94)
>     at client.gui.VSAApplet.init(VSAApplet.java:131)
>     at sun.applet.AppletPanel.run(Unknown Source)
>     at java.lang.Thread.run(Unknown Source)
> 
>   Again, thanks in advance,
>    --Luis R.
> 
> On 7/17/06, Tim Lucia <ti...@yahoo.com> wrote:
> >
> > Please post a full stack trace.  TargetInvocationException should have
> an
> > underlying cause associated with it, like NullPointerException or
> > ClassNotFoundException.
> >
> > Tim
> >
> >
> > > -----Original Message-----
> > > From: Luis Rivera [mailto:luiggiilca@gmail.com]
> > > Sent: Monday, July 17, 2006 8:57 PM
> > > To: users@tomcat.apache.org
> > > Subject: Tomcat 5.5/Axis 1.4
> java.lang.reflect.InvocationTargetException
> > >
> > > Hi Tomcat users,
> > >
> > > I have a web service which will JNI to access the application, which
> > > according to the documentation should be placed in the shared/classes
> > > directory. I did so and I got a dreaded
> > > java.lang.reflect.InvocationTargetException, which I believe is a
> class
> > > loader problem. However, I have tried to solve this placing it in the
> > > common/classes, server/classes and I get the same result.
> > >
> > > I have searched the web for solutions, some people say that it is a
> > > classpath problem, but nobody seems to let you know where exactly you
> > set
> > > this so that the correct class loader finds the class (assuming I am
> > right
> > > and it is a classloader problem).
> > >
> > > Anyone here can help me? If have had a similar setup/problem and have
> a
> > > solution at hand?
> > >
> > > Thanks in advance,
> > > --Luis R.
> >
> >


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 5.5/Axis 1.4 java.lang.reflect.InvocationTargetException

Posted by Luis Rivera <lu...@gmail.com>.
   Thanks for the reply Tim,

Here is the stack trace, it does not look to me like it gives enough
information. Of course I am just starting with Tomcat and have some blanks
in my brain. I know is the classes are being found, either under commons or
shared classes directory, because if I just delete the classes then what I
get is a ClassNotFound exception, while if I place them under any of those
directories, I get the following exception:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.lang.reflect.InvocationTargetException
 faultActor:
 faultNode:
 faultDetail:
    {http://xml.apache.org/axis/}hostname:dellp101

java.lang.reflect.InvocationTargetException
    at org.apache.axis.message.SOAPFaultBuilder.createFault(
SOAPFaultBuilder.java:222)
    at org.apache.axis.message.SOAPFaultBuilder.endElement(
SOAPFaultBuilder.java:129)
    at org.apache.axis.encoding.DeserializationContext.endElement(
DeserializationContext.java:1087)
    at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown
Source)
    at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
    at javax.xml.parsers.SAXParser.parse(Unknown Source)
    at org.apache.axis.encoding.DeserializationContext.parse(
DeserializationContext.java:227)
    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
    at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
    at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(
MustUnderstandChecker.java:62)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    at org.apache.axis.client.Call.invoke(Call.java:2767)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at soap.wsdl.CRLStub.getCompany(Unknown Source)
    at client.gui.VSAApplet.setCompanyName(VSAApplet.java:94)
    at client.gui.VSAApplet.init(VSAApplet.java:131)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.lang.reflect.InvocationTargetException
 faultActor:
 faultNode:
 faultDetail:
    {http://xml.apache.org/axis/}hostname:dellp101

java.lang.reflect.InvocationTargetException
    at org.apache.axis.message.SOAPFaultBuilder.createFault(
SOAPFaultBuilder.java:222)
    at org.apache.axis.message.SOAPFaultBuilder.endElement(
SOAPFaultBuilder.java:129)
    at org.apache.axis.encoding.DeserializationContext.endElement(
DeserializationContext.java:1087)
    at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown
Source)
    at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
    at javax.xml.parsers.SAXParser.parse(Unknown Source)
    at org.apache.axis.encoding.DeserializationContext.parse(
DeserializationContext.java:227)
    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
    at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
    at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(
MustUnderstandChecker.java:62)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    at org.apache.axis.client.Call.invoke(Call.java:2767)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at soap.wsdl.CRLStub.getCompany(Unknown Source)
    at client.gui.VSAApplet.setCompanyName(VSAApplet.java:94)
    at client.gui.VSAApplet.init(VSAApplet.java:131)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

  Again, thanks in advance,
   --Luis R.

On 7/17/06, Tim Lucia <ti...@yahoo.com> wrote:
>
> Please post a full stack trace.  TargetInvocationException should have an
> underlying cause associated with it, like NullPointerException or
> ClassNotFoundException.
>
> Tim
>
>
> > -----Original Message-----
> > From: Luis Rivera [mailto:luiggiilca@gmail.com]
> > Sent: Monday, July 17, 2006 8:57 PM
> > To: users@tomcat.apache.org
> > Subject: Tomcat 5.5/Axis 1.4 java.lang.reflect.InvocationTargetException
> >
> > Hi Tomcat users,
> >
> > I have a web service which will JNI to access the application, which
> > according to the documentation should be placed in the shared/classes
> > directory. I did so and I got a dreaded
> > java.lang.reflect.InvocationTargetException, which I believe is a class
> > loader problem. However, I have tried to solve this placing it in the
> > common/classes, server/classes and I get the same result.
> >
> > I have searched the web for solutions, some people say that it is a
> > classpath problem, but nobody seems to let you know where exactly you
> set
> > this so that the correct class loader finds the class (assuming I am
> right
> > and it is a classloader problem).
> >
> > Anyone here can help me? If have had a similar setup/problem and have a
> > solution at hand?
> >
> > Thanks in advance,
> > --Luis R.
>
>

Re: Tomcat 5.5/Axis 1.4 java.lang.reflect.InvocationTargetException

Posted by Luis Rivera <lu...@gmail.com>.
 Hi Tim,

I have not solved the problem, but managed to understand that the problem is
not where I drop the classes that will make the JNI calls. Dropping them
inthe share directory results in the
java.lang.reflect.InvocationTargetException at the Client side.

1) To be clear, the call to th e JNI wrapper (dropped in the share/classes
directoy) is something like this:

public void getCompany(CompanyHolder company, StringHolder result) {...}

Making this call from the Stub implementation (dropped in
axis/WEB-INF/classes directory) result in the mentioned exception. The
clases ComapnyHolder is visible to both classes, and tthey are in
axis/WEB-INF/classes and axis/WEB-INF/classes.

2) For the sake of testing, I created a new method without parameters

public Stirng getCompany();

and made the call just like in 1, and IT WORKED ... no Exception at the
client side.

3) So, the problem seems to me is not wher eI drop the implementation
classes, but the classes with all the types and hodlers generated with
wsdl2Java, and it doesn't seem to be the shared/classes directory, because
that classloader finds it correctly.

It seems that there is another classloader in the middle, between the one
for shared and the one for my WebApp that needs to know where to get these
classes from, but where? ... I tried common and server.... no luck !!!

Or is there anywhere else or something else I have not looked into?

  Thanks in advance,
  --Luis R.

On 7/17/06, Tim Lucia <ti...@yahoo.com> wrote:
>
> Please post a full stack trace.  TargetInvocationException should have an
> underlying cause associated with it, like NullPointerException or
> ClassNotFoundException.
>
> Tim
>
>
> > -----Original Message-----
> > From: Luis Rivera [mailto:luiggiilca@gmail.com]
> > Sent: Monday, July 17, 2006 8:57 PM
> > To: users@tomcat.apache.org
> > Subject: Tomcat 5.5/Axis 1.4 java.lang.reflect.InvocationTargetException
> >
> > Hi Tomcat users,
> >
> > I have a web service which will JNI to access the application, which
> > according to the documentation should be placed in the shared/classes
> > directory. I did so and I got a dreaded
> > java.lang.reflect.InvocationTargetException, which I believe is a class
> > loader problem. However, I have tried to solve this placing it in the
> > common/classes, server/classes and I get the same result.
> >
> > I have searched the web for solutions, some people say that it is a
> > classpath problem, but nobody seems to let you know where exactly you
> set
> > this so that the correct class loader finds the class (assuming I am
> right
> > and it is a classloader problem).
> >
> > Anyone here can help me? If have had a similar setup/problem and have a
> > solution at hand?
> >
> > Thanks in advance,
> > --Luis R.
>
>

RE: Tomcat 5.5/Axis 1.4 java.lang.reflect.InvocationTargetException

Posted by Tim Lucia <ti...@yahoo.com>.
Please post a full stack trace.  TargetInvocationException should have an
underlying cause associated with it, like NullPointerException or
ClassNotFoundException.

Tim


> -----Original Message-----
> From: Luis Rivera [mailto:luiggiilca@gmail.com]
> Sent: Monday, July 17, 2006 8:57 PM
> To: users@tomcat.apache.org
> Subject: Tomcat 5.5/Axis 1.4 java.lang.reflect.InvocationTargetException
> 
> Hi Tomcat users,
> 
> I have a web service which will JNI to access the application, which
> according to the documentation should be placed in the shared/classes
> directory. I did so and I got a dreaded
> java.lang.reflect.InvocationTargetException, which I believe is a class
> loader problem. However, I have tried to solve this placing it in the
> common/classes, server/classes and I get the same result.
> 
> I have searched the web for solutions, some people say that it is a
> classpath problem, but nobody seems to let you know where exactly you set
> this so that the correct class loader finds the class (assuming I am right
> and it is a classloader problem).
> 
> Anyone here can help me? If have had a similar setup/problem and have a
> solution at hand?
> 
> Thanks in advance,
> --Luis R.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org