Rick,

On 4/15/24 10:04, Rick Noel wrote:
Hello,

I am using Tomcat 10 with java 17.

I am getting itermitant jsp compile errors below.

Some times the page compiles correctly but sometimes the page hits result in 
below errors............

java.lang.reflect.InvocationTargetException
         at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
         at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
         at java.base/java.lang.reflect.Method.invoke(Method.java:568)
         at com.radiovoodoo.display.EvalExpr.evalIdentifier(EvalExpr.java:317)
         at com.radiovoodoo.display.EvalExpr.eval(EvalExpr.java:57)

What is RadioVoodoo?

Is there more of the stack trace?

I found this explanation for possible cause..........
Normally "java.lang.reflect.InvocationTargetException" occurs when java 
compiler finds 2 different classes with same name in 2 different packages.
When you are importing both classes at a time and when you are trying to create object of 
that class it throws "java.lang.reflect.InvocationTargetException" exception .
The solution is that when you are creating the object of the class use package 
name also along with class name so that compiler knows what class it has to use.

This is unlikely to be the explanation. I've never seen InvocationTargetException under the conditions described. The compiler should never allow you to import two classes with the same "simple" (without package) name, because it's impossible for it to then tell which one you mean in a given expression.

I looked at my code in the jsp and the code in question could be mistaking for 
two different classes.
My code is meant to use  java.util.Timezone but my code also has a  
com.radiovoodoo.customer.Timezone class

What do your imports look like?

So I thought ah ah will specifical declare the class the I want, so I changed
From
private TimeZone customerTimeZone;
to
private java.util.TimeZone customerTimeZone;

so that the compiler will not think to use com.radiovoodoo.customer.Timezone 
but instead always use java.util.TimeZone
But this had no effect.

What do your imports look like?

I still get intermittent java.lang.reflect.InvocationTargetException
Could this be a possible bug in   the class tomcat 10 uses to compile jsp   ->  
        org.apache.jasper.servlet.JspServlet

It's possible, but not very likely. We have a pretty good set of unit tests, plus we aren't getting any reports from others that the compiler is failing in this way.

Is there a different JspServlet class I could use to test that theory out?

I'm curious as to why RadioVoodoo is being invoked during compilation. Or is this happening during JSP execution, post-compile? A more complete stack trace would reveal that.

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to