Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » The import cannot be resolved
The import cannot be resolved [message #498920] Thu, 19 November 2009 03:35 Go to next message
Eclipse UserFriend
Hi there,
I develope a jsp using eclipse, and try to call a jar file that I made.
The problem is that when I import the jar into the jsp page, I get an error says:
'The import myClass cannot be resolved'.
I included the jar in the Libraries in the build path. The class I'm trying to use in the jar is public.
I also read that running a 'clean' action (project -> clean) can solve it, and I did it. It didn't solve
my problem.
I still get The import cannot be resolved error.
I'll be glad to here any idea, I didn't find a solution yet Sad
Thanks.
Re: The import cannot be resolved [message #498945 is a reply to message #498920] Thu, 19 November 2009 05:16 Go to previous messageGo to next message
Eclipse UserFriend
Another thing:

Well, I even put my jar inside the lib in the web project, but it is still not working:
Actually, the jar contains some classes that some of them are recognizad in the "import",
but the class that I built and want to use is not recognized.
I don't know why, driving me crazy !
The both classes are public.
Thanks for any help
Re: The import cannot be resolved [message #499049 is a reply to message #498945] Thu, 19 November 2009 11:22 Go to previous messageGo to next message
Eclipse UserFriend
What is the fully-qualified name of the class? Did you define the class in a package, or are you using the "default" package? You'll generally have issues if you try to use the "default" package with web applications, although I can't be certain.
Re: The import cannot be resolved [message #499418 is a reply to message #499049] Sun, 22 November 2009 03:25 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
now the jsp recognizes the class. but...
when I run the jsp, I get an exception that I really don't know how to deal with.
please help... :

The server encountered an internal error () that prevented it from fulfilling this request.

exception
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: Hasp/hasp_demo
org.apache.jasper.servlet.JspServletWrapper.handleJspExcepti on(JspServletWrapper.java:541)
org.apache.jasper.servlet.JspServletWrapper.service(JspServl etWrapper.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl et.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java :266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause
javax.servlet.ServletException: java.lang.NoClassDefFoundError: Hasp/hasp_demo
org.apache.jasper.runtime.PageContextImpl.doHandlePageExcept ion(PageContextImpl.java:850)
org.apache.jasper.runtime.PageContextImpl.handlePageExceptio n(PageContextImpl.java:779)
org.apache.jsp.test_jsp._jspService(test_jsp.java:75)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.ja va:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServl etWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl et.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java :266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause
java.lang.NoClassDefFoundError: Hasp/hasp_demo
org.apache.jsp.test_jsp._jspService(test_jsp.java:65)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.ja va:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServl etWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl et.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java :266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

[Updated on: Sun, 22 November 2009 07:31] by Moderator

Re: The import cannot be resolved [message #499435 is a reply to message #499418] Sun, 22 November 2009 10:12 Go to previous message
Eclipse UserFriend
That means that class was available at compile time, but not at deployment time. That class needs to be deployed as "WEB-INF/classes/Hasp/hasp_demo.class" or WEB-INF/lib/<jar file containing Hasp/hasp_demo.class>". Is "hasp_demo.java" a source file in your project, or is the "Hasp" package something provided in a jar file that you're using?

It might be useful to do a "File"->"Export"->"WAR file", selecting your project. You can then inspect the resulting WAR file to see if or where that class was deployed to.
Previous Topic:VariableDeclarationFragment distinguish simple variable from array
Next Topic:Processing Instruction not closed
Goto Forum:
  


Current Time: Tue Nov 04 07:57:43 EST 2025

Powered by FUDForum. Page generated in 0.07004 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top