I am trying to write a web application using JSP and Java on Tomcat 7.0.14, and part of it is connected to connecting to a MySQL server using Hibernate .
Here is the basic view of my directory structure:
apache-tomcat-7.0.14 |- webapps |- ROOT |- WEB-INF | |- classes | | |- some-package-path | | \- foo.java | | \- foo.class | |- lib | \- hibernate3.jar \- file_giving_issues.jsp
Now "file_giving_issues.jsp", as you might have guessed, is a file that gives me problems. It cannot see the classes contained in various jibernate jar files. I used the following instruction:
<%@ page import="org.hibernate.Session" %>
Here, Tomcat tells me
Only a type can be imported. org.hibernate.Session resolves to a package.
This, by the way, is not true; A session is definitely a type, not a package, and in it hibernate3.jar . More specifically, it exists here:
WEB-INF/lib/hibernate3.jar/org/hibernate/Session.class
But I decided that I would play the ball and just import everything from org.hibernate, for example:
<%@ page import="org.hibernate.*" %>
Even more incomprehensible, Tomcat now tells me
Session cannot be resolved to a type.
So, I lost a little. I'm not sure if this is a problem with setting up Tomcat or with my class directory structures, or if I donβt understand how JARs work or what. As far as I understand, JAR files in WEB-INF / lib should always be on the Tomcat Classpath, and these files in WEB-INF / classes / some-package-paths work fine, so I get lost.
Any help would be appreciated.