title: Why can't Tomcat/JSP see these classes?
body: <p>I'm trying to write a web app using JSP and Java on a Tomcat 7.0.14, and part of it involves connecting with a MySQL server using <a href="http://www.hibernate.org/" rel="nofollow">Hibernate</a>.</p>
  
  <p>Here's a basic view of my directory structure:</p>
  
  <pre><code>apache-tomcat-7.0.14
  |- webapps
     |- ROOT
       |- WEB-INF
       |   |- classes
       |   |   |- some-package-path
       |   |      \- foo.java
       |   |      \- foo.class
       |   |- lib
       |      \- hibernate3.jar
       \- file_giving_issues.jsp
  </code></pre>
  
  <p>Now, "file_giving_issues.jsp", as you might have guessed, is the file giving me issues. It can't see the classes contained in the various hibernate jar files. I used the following statement:</p>
  
  <pre><code>&lt;%@ page import="org.hibernate.Session" %&gt;
  </code></pre>
  
  <p>Here, Tomcat tells me,</p>
  
  <pre><code>Only a type can be imported. org.hibernate.Session resolves to a package.
  </code></pre>
  
  <p>This, by the way, is not true; Session is definitely a type, not a package, and it's in that <code>hibernate3.jar</code>. More specifically, it exists here:</p>
  
  <pre><code>WEB-INF/lib/hibernate3.jar/org/hibernate/Session.class
  </code></pre>
  
  <p>But I figured I'd play ball and just import everything from org.hibernate, like so:</p>
  
  <pre><code>&lt;%@ page import="org.hibernate.*" %&gt;
  </code></pre>
  
  <p>Even more bafflingly, Tomcat now tells me,</p>
  
  <pre><code>Session cannot be resolved to a type.
  </code></pre>
  
  <p>So, I'm at a bit of a loss. I'm not sure if it's a problem with the way Tomcat is configured, or with my class directory structures, or if I don't understans the way JARs work, or what. From what I understand, the JAR files in WEB-INF/lib should always be on Tomcat's Classpath, and those files in WEB-INF/classes/some-package-path work fine, so I'm lost.</p>
  
  <p>Any help would be appreciated.</p>