tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: Tomcat 5.5/Axis 1.4 java.lang.reflect.InvocationTargetException
Date Thu, 20 Jul 2006 11:58:09 GMT
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.

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.

--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
View raw message