tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luis Rivera" <luiggii...@gmail.com>
Subject Re: Tomcat 5.5/Axis 1.4 java.lang.reflect.InvocationTargetException
Date Fri, 21 Jul 2006 01:31:42 GMT
   Hi,

Well, I managed to hook the logger into the catalina and webapps directories
and have two different streams of output. Only activating the DEBUG level I
managed to get something useful. I also used FileMon to find out which files
were not found and even after getting rid of those errors (by placing the
correct class files in the right places), the same error is thrown at the
client.

Now, this is the full stack trace at the Server when the CompanyInfo class
is accessed by the class in the shared/classes directory:

27782 [http-8095-Processor25] DEBUG org.apache.axis.enterprise  - Mapping
Exception to AxisFault^M
java.lang.reflect.InvocationTargetException^M
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)^M
        at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)^M
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)^M
        at java.lang.reflect.Method.invoke(Method.java:585)^M
        at org.apache.axis.providers.java.RPCProvider.invokeMethod(
RPCProvider.java:397)^M
        at org.apache.axis.providers.java.RPCProvider.processMessage(
RPCProvider.java:186)^M
        at org.apache.axis.providers.java.JavaProvider.invoke(
JavaProvider.java:323)^M
        at org.apache.axis.strategies.InvocationStrategy.visit(
InvocationStrategy.java:32)^M
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)^M
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)^M
        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java
:454)^M
        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)^M
        at org.apache.axis.transport.http.AxisServlet.doPost(
AxisServlet.java:699)^M
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)^M
        at org.apache.axis.transport.http.AxisServletBase.service(
AxisServletBase.java:327)^M
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)^M
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:252)^M
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:173)^M
        at org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:213)^M
        at org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:178)^M
        at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:126)^M
        at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:105)^M
        at org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:107)^M
        at org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.java:148)^M
        at org.apache.coyote.http11.Http11Processor.process(
Http11Processor.java:869)^M
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
(Http11BaseProtocol.java:664)^M
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
PoolTcpEndpoint.java:527)^M
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)^M
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
ThreadPool.java:684)^M
        at java.lang.Thread.run(Thread.java:595)^M
Caused by: java.lang.LinkageError: Class soap/xsd/CompanyInfo violates
loader constraints^M
        at java.lang.ClassLoader.defineClass1(Native Method)^M
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)^M
        at java.security.SecureClassLoader.defineClass(
SecureClassLoader.java:124)^M
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)^M
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)^M
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)^M
        at java.security.AccessController.doPrivileged(Native Method)^M
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)^M
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)^M
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)^M
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)^M
        at vsa.jniCRLimpl.nada(jniCRLimpl.java:100)^M
        at soap.wsdl.CRLImpl.getCompany(CRLImpl.java:94)^M
        at soap.wsdl.CRLSkeleton.getCompany(Unknown Source)^M
        ... 30 more^M

As you will see, it seems to be a problem in the catalina.policy file, or
whichever file is setting the policy for what each classloader is allowed to
use. Does anybody have a working example or has any idea of what could be
added or modified in the policy file to make this work.

    Thanks in advance,
    --Luis R.

On 7/20/06, Luis Rivera <luiggiilca@gmail.com> wrote:
>
>
>    Hi David and tomcat users/devs,
>
> First of all, thanks for the reply, I really appreicate it. Here are my
> comments to your comments, hopefully you could find out something I did
> miss.
>
> On 7/20/06, David Smith <dns4@cornell.edu> wrote:
> >
> > Q1) As long as I do not referece the classes, which I believe means the
> > classes are not loaded, then there is not problem. When they are
> > accessed,
> > then it fails. The classes are in both common, shared and webapps, where
> >
> > else I am supposed to place them?
> >
> > First, read the classloader howto on the tomcat website
> > (http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
> > ).  Then
> > pick ONE and eliminate the others.  If the classes are used only on one
> > webapp or access other classes within the webapp itself, place them in
> > WEB-INF/lib or WEB-INF/classes.  Move up to shared or common only if the
> >
> > classes are used by several webapps or the engine itself.  Placing
> > pooled database connection drivers in common/lib is a perfect example of
> > classes accessed by the tomcat engine and the webapp.
>
>
> I had read that page  before, more than once. The reason I am splitting
> the classes in two locations is because I need to use the JNI, which
> requires the classes to be in the shared pool. Here is where the problem
> lies, because everythinig works if I constrain my application to
> webapps/axisWEB-INF/classes and webapps/axis/WEB-INF/lib.
>
> The problem comes at run time, when the classes in the shared/classes
> directory access the parameters, which are classes generated from the WSDL
> file. I tried copying the classes to the shared/classes directory, I also
> copied axis.jar to the shared/lib directory and no change. There is
> something in Tomcat obviously tryiing to access something when
> deserializing/serializing and is not finding it.
>
> Any ideas of what it can be and how I could find out?
>
> Q2) How do I turn on Logging at the debug level in Tomcat, or any kind of
> > meaningful logging to figure out what is happening?
> >
> > See the tomcat website for your version of tomcat.
>
>
> The Tomcat website wasn't exactly helpful on this. I found another website
> with  the exact example I needed to activate  logging for catalina. But
> still there are no errors reported, only the DEBUG and INFO levels throw
> something out. I still need to activate logging in the webapps classloader
> to see if I can figure out something else.
>
>
>     Thanks in advance,
>     --Luis R.
>
> --David
> >
> > Luis Rivera wrote:
> >
> > >   Hi Barry and Tomcat/users/devs,
> > >
> > > I am hoping an axis/tomcat/dev/user will have a good advise. I am sure
> > > more
> > > than one user has needed to use axis/tomcat and a JNI interface, so I
> > am
> > > sure this has been done. I need classes in the shared context and
> > > classes in
> > > the webapps context, which cause serialization/desearialization
> > problems
> > > when making calls among classes between the two contexts.
> > >
> > > I write the questions here, in case a reader don't want to go through
> > the
> > > whole explanation below them.
> > >
> > > Q1) As long as I do not referece the classes, which I believe means
> > the
> > > classes are not loaded, then there is not problem. When they are
> > > accessed,
> > > then it fails. The classes are in both common, shared and webapps,
> > where
> > > else I am supposed to place them?
> > >
> > > Q2) How do I turn on Logging at the debug level in Tomcat, or any kind
> > of
> > > meaningful logging to figure out what is happening?
> > >
> > > Q3) Is there a way to enable remote debugging using Eclipse? ... I
> > > read that
> > > it is possible, but is there any configuration in Tomcat I need to
> > change
> > > and does it include setting a port for it?
> > >
> > > I found the log that has the stdout, which was showing a couple of
> > > exceptions, which I solved by placing the appropriate jar files in the
> > > right
> > > place. However, the problem didn't go away, there is something in the
> > > Tomcat
> > > servlet or axis (I don't know) that is handling an exception in the
> > > server
> > > side, because I have a try {} catch () {} where the problem ocurrs and
> > I
> > > don't catch anything, but the exception is returned to the client. Now
> > > not
> > > even an exception is thrown to the stdout or staderr files.
> > >
> > > The problems comes when in the shared/classes files I access the
> > > parameters
> > > that use the classes generated by the WSDL2java tool. Those classes
> > > are in
> > > both
> > >
> > > TOMCAT_HOME/shared/classes
> > >
> > > and
> > >
> > > TOMCAT_HOME/webapps/axis/WEB-INF/classes
> > >
> > > I also dropped the axis jar files in
> > >
> > > TOMCAT_HOME/shared/lib
> > > TOMCAT_HOME/webapp/WEB-INF/lib
> > > TOMCAT_HOME/webapp/axis/WEB-INF/lib
> > >
> > > but I still have a problem. At this point it would be nice to at
> > > leasts see
> > > the DEBUG output from Tomcat, but I am not sure how to do that or if
> > > it is
> > > something related to axis. To make this more explicit, this example
> > > works:
> > >
> > > class CRLStub
> > >
> > > ...
> > >
> > > public void getCompay(CompanyHolder company, StringHolder result)
> > > throws java.rmi.RemoteException
> > > {
> > >     company.value = new soap.xsd.CompanyInfo();
> > >     company.value.setCompany("Something");
> > >
> > >     result.value = "ok";
> > > }
> > >
> > > Now, if I try to do the following, there is no error, but obviously,
> > the
> > > result is not the same
> > >
> > > class CRLStub
> > >
> > > ...
> > >
> > > public void getCompay(CompanyInfoHolder company, StringHolder result)
> > > throws java.rmi.RemoteException
> > > {
> > >     jnInSharedContext.getCompany (company, result);
> > > }
> > >
> > > class JNIcrlInSharedContext
> > >
> > >   ...
> > >
> > > public void getCompany(CompanyInfoHolder company, StringHolder result)
> > > {
> > >    /// No problem as long as I don't access neither company or result
> > > }
> > >
> > > But if I do this, then I receive the
> > > java.lang.reflect.InvocationTargetException at the client side, even
> > if I
> > > try to catch the exception with a try {} catch () {} pair.
> > >
> > > public void getCompany(CompanyInfoHolder company, StringHolder result)
> > > {
> > >     company.value = new soap.xsd.CompanyInfo();
> > > }
> > > I would appreciate any kind of hint,
> > > Thanks in advance,
> > > --Luis R.
> > >
> > > On 7/18/06, Propes, Barry L <barry.l.propes@citigroup.com> wrote:
> > >
> > >>
> > >> none of the logs mention it?
> > >> I realize Tomcat does seem a bit bereft of info in the logs sometime.
> > >> Would it have been a case where it printed to the system console
> > >> instead?
> > >> Mine does that sometimes, instead of (or in addition to) the log(s)
> > >> and I
> > >> troubleshoot it that way.
> > >>
> > >> -----Original Message-----
> > >> From: Luis Rivera [mailto:luiggiilca@gmail.com]
> > >> Sent: Tuesday, July 18, 2006 5:00 PM
> > >> To: Tomcat Users List
> > >> Subject: Re: Tomcat 5.5/Axis 1.4
> > >> java.lang.reflect.InvocationTargetException
> > >>
> > >>
> > >>     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 <shankarunni@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
> > >> >
> > >> >
> > >>
> > >
> >
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message