• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class path issue?

 
sidd jain
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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.
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds more like a missing import problem.
 
sidd jain
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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?
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • 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?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks a lot for your help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic