• 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

Class path issue?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm new to tomcat and JSP programming. Anyway, I received a project and am trying to run it. As far as I know, all the required files are there but I guess java can't find them. All the project files are stored in the Tomcat webapps folder. When I open a file for example in IE, I get a bunch of errors similar to:



(the [***] are inserted to mask the actual file names)

So my issue is how do I get Tomcat to access the relevant java files so that it actually runs. I tried putting the file names in the Classpath, but I am assuming I did it wrong since ther error is still there. I know the code works because there is a copy of the project running on a server and it operates completely fine without any errors so clearly it is just the configuration here that is wrong.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds more like a missing import problem.
 
sidd jain
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps, but as I say it does work on the online version so the code itself does not have any problems. If there were missing imports I would think that it would not work online either.

Either way, I don't see how to solve that since the files are imported by the jsp file:


So, what should I do?
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the exact directory structure for the web app? Are the missing classes in packages? What do the imports really look like (put fake names if you want, but make them as close as possible to the real thing)? What versions of the Tomcat on the online version? The local Tomcat version?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean, the "online version"? Are you saying it can't find java.text.*, or whatever the "***" imports are?

If it can't find the "***" imports then the "***" imports aren't in /WEB-INF/lib. (Or in the container classpath, but if they're your own libs it's almost certain that they belong in /WEB-INF/lib.)
 
sidd jain
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using apache-tomcat-6.0.18. As previously mentioned, I received this directory of files that are operating fine on an online server. I am not sure what version the server was using.

I will now attempt to explain the file structure. The .jsp files are stored in the C:\apache-tomcat-6.0.18\webapps\ROOT\prob directory. The java files were originally stored in directories similar to C:\apache-tomcat-6.0.18\webapps\ROOT\prob\src\com\cool\next\trans\db . After reading your reponse I copied them to C:\apache-tomcat-6.0.18\webapps\ROOT\WEB-INF\lib\com\cool\next\trans\db . That did not solve the problem.

The import in the .jsp file is as so:

The are many .jsp files and many more files that are being imported but I think this one gives an example of the problem that seems to be the same along the different files.
The error seen in IE when viewing the JSP file is similar to this:

I'm quite confused as to what is causing this issue since I know that these .JSP files operate fine on the server. They are used on our intranet for internal customers strictly and therefore I am unable to share the exact code and my liberty in using the exact names is quite limited. But I will try to give you the most I can to help you get an understanding of my situation.
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sidd jain wrote:I am using apache-tomcat-6.0.18. As previously mentioned, I received this directory of files that are operating fine on an online server. I am not sure what version the server was using.

I will now attempt to explain the file structure. The .jsp files are stored in the C:\apache-tomcat-6.0.18\webapps\ROOT\prob directory. The java files were originally stored in directories similar to C:\apache-tomcat-6.0.18\webapps\ROOT\prob\src\com\cool\next\trans\db . After reading your reponse I copied them to C:\apache-tomcat-6.0.18\webapps\ROOT\WEB-INF\lib\com\cool\next\trans\db . That did not solve the problem.
[/code]


That should be:
C:\apache-tomcat-6.0.18\webapps\ROOT\WEB-INF\classes\com\cool\next\trans\db

Put packaged JAR files in WEB-INF/lib. Put loose classes in WEB-INF/classes.

And make sure it is the .class files that go there, not .java files.
 
sidd jain
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for your help
 
And then we all jump out and yell "surprise! we got you this tiny ad!"
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic