Only a type can be imported. MyClass.anyclass resolves to a package error

Posted on 2009-02-23
Last Modified: 2012-05-06
I have an app that uses JSP's, java libraries (API) with Tomcat and MySQL. The app works fine, however, since I migrate to a new server, I start getting this error.

"Only a type can be imported. MyClass.anyclass resolves to a package error"

The funny thing here is that JSP's that are located in the root directory (public_html) works fine, while all the other JSP's throw this exception:

If I move any JSP from "public_html/any_directory" to "public_html", then that very same JSP works fine.

The java libraries are located in a jar file, in WEB-INF/lib, and it's classpath is perfectly written.

As you may know, Tomcat compiles JSP's the first time they're executed, so I checked the code generated for both JSP's (public_html/my_jsp.jsp and public_html/someFolder/my_jsp.jsp), and they are exactly the same, however, only the one located in public_html works.

Evidently, there is a problem with tomcat's classpath, but I've been trying to fix this for many days, and still having the problem.

Altough, I know there's nothing wrong with the code of the JSP's, here it is, in case that helps. I'm sure that this error is caused by some Tomcat's configuration, however, I haven't been able to find it.

<%@ page import="Solutio.AdminRH.Entity.ICatalogosAdminDB" %>

private ICatalogosAdminDB theObj = null;
public void jspInit() {
try {
theObj = new ICatalogosAdminDB();
} catch (Exception ex) {

public void jspDestroy() {
theObj = null;

Any help will be really appreciated.

Thank you.
Question by:sergiomn
    LVL 92

    Expert Comment

    where are you importing MyClass.anyclass?

    LVL 92

    Expert Comment

    be worth clearing tomcats work directory and restart tomcat


    Author Comment

    at the begining of any JSP, in the code I paste, is the first line:

    <%@ page import="Solutio.AdminRH.Entity.ICatalogosAdminDB" %>

    I said "MyClass.anyclass" because it happens with any class, and any jsp of the app (except for those located in public_html, as mentioned.

    However, In this specific case, the error says:

    "Only a type can be imported. Solutio.AdminRH.Entity.IPruebaAdminDB resolves to a package"

    And yes, I've tried cleaning the work directory.

    Thank you, any help will be really appreciated.
    LVL 92

    Expert Comment

    any other apps running on that instance of tomcat?
    Anything unusual in the logs when the context starts up?

    LVL 19

    Expert Comment


    is it the same problem ( & are you the same person as above post? evidently it states that it was fixed)

    Accepted Solution

    Yes, it's the same, and somebody there helped me, so now it's fixed.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    After several days of searching and hunting for limited documentation, I wanted to share this guide to hopefully save someone the hassle of trying to figure this out on their own. I have tested this on Xendesktop 7.1 and PS 4.5 running simultaneous…
    In the modern office, employees tend to move around the workplace a lot more freely. Conferences, collaborative groups, flexible seating and working from home require a new level of mobility. Technology has not only changed the behavior and the expe…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now