• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

No compile time errors but method not found during run time

 
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Happy Thanksgiving everyone.

I am not sure if my question belongs here or not. But, since Maven is the build tool...

When I run mvn -e install on our web and server projects, I get no errors. However, when our Flex interface calls the web service to get resources, the first resource (a Map) is returned just fine. The second resource (a List<Map>) does not return. In the second case, I get an error on Tomcat. The log states:

"Caused by: java.lang.NoSuchMethodError: [package]FeedsController.getInputFeeds(Ljava/lang/String;)Ljava/util/List;
at [package].Dispatcher.getUserData(Dispatcher.java:101)"

I don't understand this as the method has been verified with my own eyes and via the compiler. I get no compile time errors and clearly the method that getUserData is calling, "FeedsController.getInputFeeds(String)", exists or else I would get compile time errors.

Does anyone have any ideas?

Best,
Al

 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that your app might be picking up the wrong class file. One way to verify this is to run with the -verbose:class JVM option. This option will print each class loaded and the JAR file, or directory, it came from.

By the way, i used this same mechanism to locate the cause of a "no such method" error when I know for certain that the method existed. Turns out someone had added a JAR file to the endorsed directory. But i have also seen the same issue when someone set the CLASSPATH env var.

Oh, and as far as location for this post, what is your web server? That will tell where this should go.
 
Al Johnston
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Peter!

The web server is Apache Tomcat 7. I see why you're asking now.

I went into catalina.bat and added the -verbose:classes to the JVM_Options section. That did the trick. Turns out that there is a legacy jar serving current users and we're deploying to the same server. Tomcat is ignoring the war where the latest jar files are and is loading classes form the legacy jar. Now if I can only get Tomcat to stop looking at this environmental variable and to start loading the classes from the new jar in the war, I should be golden. Thanks so much for the help!

Best,
Al

 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That makes this a Tomcat question, moving.

P.S. glad you were able to track down the cause of the problem.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Al Johnston wrote: Now if I can only get Tomcat to stop looking at this environmental variable and to start loading the classes from the new jar in the war, I should be golden. Thanks so much for the help!



Why not remove that legacy jar from the CLASSPATH?
 
Al Johnston
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to remove it from the classpath, but unfortunately it's not as simple as that. Posting a new question in RMI. In short, the legacy code has no web-server and was only talking to ColdFusion. It was just easy to deploy to the ext dir of Java (instead of setting the classpath due to who was managing it all). Now that I'm moving it out, I get access exceptions so I need to resolve that asap since until then either the production code is down or we can't test the new releases and get the production code replace. Thanks so much for the help though. At least now my test code in Tomcat is running.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Al Johnston wrote:It was just easy to deploy to the ext dir of Java (instead of setting the classpath due to who was managing it all)...



Which is why using the extensions directory is a bad idea. It's usually a quick fix for getting the classpath right, and as we all know, quick fixes usually don't make it into the documentation for future administrators to read. I've been burned by this more than once, and in both cases the sloppy quick fixer was me. That gives me a year's free membership in the Slow Learners Club, but it ain't gonna happen to me again.
 
reply
    Bookmark Topic Watch Topic
  • New Topic