Link to home
Start Free TrialLog in
Avatar of sergiomn
sergiomn

asked on

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

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) {
System.out.println(ex);
}
}

public void jspDestroy() {
theObj = null;
}
%>
<html>
...
...

Any help will be really appreciated.

Thank you.
Avatar of Mick Barry
Mick Barry
Flag of Australia image

where are you importing MyClass.anyclass?

be worth clearing tomcats work directory and restart tomcat

Avatar of sergiomn
sergiomn

ASKER

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.
any other apps running on that instance of tomcat?
Anything unusual in the logs when the context starts up?

http://forums.sun.com/thread.jspa?threadID=5368651&tstart=0

is it the same problem ( & are you the same person as above post? evidently it states that it was fixed)
ASKER CERTIFIED SOLUTION
Avatar of sergiomn
sergiomn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial