Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Unable to compile class for JSP

Reply
Thread Tools

Unable to compile class for JSP

 
 
Vidhi Gupta
Guest
Posts: n/a
 
      02-03-2006
hello,

i'm using JSP on Tomcat 5.5.15 on WIN 2000 with jdk1.5.0.02 and Oracle
8i.i've the hierarchy of my project as : -
TOMCAT_HOME\webapps\testing\ConsLicResult.jsp
TOMCAT_HOME\webapps\testing\WEB-INF\classes\org\cris\prime\db\DBConnection.java
TOMCAT_HOME\webapps\testing\WEB-INF\classes\org\cris\prime\bl\ConsLicBl.java

whenever i'm compiling my ConsLicBl.java, it is generatind the
following errors as :

package org.cris.prime.db does not exist and cannot resolve symbol
class DBConnection

when i'm executing the ConsLicResult.jsp on localhost the following
error are coming :-

org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:
Only a type can be imported. org.cris.prime.bl.ConsLicBl resolves to a
package

An error occurred at line: 16 in the jsp file: /ConsLicResult.jsp
Generated servlet error:
ConsLicBl cannot be resolved to a type

An error occurred at line: 16 in the jsp file: /ConsLicResult.jsp
Generated servlet error:
ConsLicBl cannot be resolved to a type


org.apache.jasper.servlet.JspServletWrapper.handle JspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)


root cause

org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:
Only a type can be imported. org.cris.prime.bl.ConsLicBl resolves to a
package

An error occurred at line: 16 in the jsp file: /ConsLicResult.jsp
Generated servlet error:
ConsLicBl cannot be resolved to a type

An error occurred at line: 16 in the jsp file: /ConsLicResult.jsp
Generated servlet error:
ConsLicBl cannot be resolved to a type


org.apache.jasper.compiler.DefaultErrorHandler.jav acError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacEr ror(ErrorDispatcher.java:32
org.apache.jasper.compiler.JDTCompiler.generateCla ss(JDTCompiler.java:409)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:297)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:276)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:264)
org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)

i'm unable to understand why these problems are coming.
Note:- i'd imported DBConnection.java in ConsLicBl.java and
ConsLicBl.java in ConsLicResult.jsp.

Kindly help.
Thanks & Regards,

Vidhi

 
Reply With Quote
 
 
 
 
Arnaud B.
Guest
Posts: n/a
 
      02-03-2006
Hi,

>Only a type can be imported. org.cris.prime.bl.ConsLicBl resolves to a

package

Could you show us the import statements of your JSP ?
It looks like the problem could be there.

(as if you had declared "import org.cris.prime.bl.ConsLicBl.*; or something
like this)

Regards,

Arnaud

"Vidhi Gupta" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed) ups.com...
> hello,
>
> i'm using JSP on Tomcat 5.5.15 on WIN 2000 with jdk1.5.0.02 and Oracle
> 8i.i've the hierarchy of my project as : -
> TOMCAT_HOME\webapps\testing\ConsLicResult.jsp
>

TOMCAT_HOME\webapps\testing\WEB-INF\classes\org\cris\prime\db\DBConnection.j
ava
>

TOMCAT_HOME\webapps\testing\WEB-INF\classes\org\cris\prime\bl\ConsLicBl.java
>
> whenever i'm compiling my ConsLicBl.java, it is generatind the
> following errors as :
>
> package org.cris.prime.db does not exist and cannot resolve symbol
> class DBConnection
>
> when i'm executing the ConsLicResult.jsp on localhost the following
> error are coming :-
>
> org.apache.jasper.JasperException: Unable to compile class for JSP
>
> Generated servlet error:
> Only a type can be imported. org.cris.prime.bl.ConsLicBl resolves to a
> package
>
> An error occurred at line: 16 in the jsp file: /ConsLicResult.jsp
> Generated servlet error:
> ConsLicBl cannot be resolved to a type
>
> An error occurred at line: 16 in the jsp file: /ConsLicResult.jsp
> Generated servlet error:
> ConsLicBl cannot be resolved to a type
>
>
>

org.apache.jasper.servlet.JspServletWrapper.handle JspException(JspServletWra
pper.java:510)
>

org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:3
75)
> org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
> org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
> javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
>
>
> root cause
>
> org.apache.jasper.JasperException: Unable to compile class for JSP
>
> Generated servlet error:
> Only a type can be imported. org.cris.prime.bl.ConsLicBl resolves to a
> package
>
> An error occurred at line: 16 in the jsp file: /ConsLicResult.jsp
> Generated servlet error:
> ConsLicBl cannot be resolved to a type
>
> An error occurred at line: 16 in the jsp file: /ConsLicResult.jsp
> Generated servlet error:
> ConsLicBl cannot be resolved to a type
>
>
>

org.apache.jasper.compiler.DefaultErrorHandler.jav acError(DefaultErrorHandle
r.java:84)
>

org.apache.jasper.compiler.ErrorDispatcher.javacEr ror(ErrorDispatcher.java:3
2
> org.apache.jasper.compiler.JDTCompiler.generateCla ss(JDTCompiler.java:409)
> org.apache.jasper.compiler.Compiler.compile(Compil er.java:297)
> org.apache.jasper.compiler.Compiler.compile(Compil er.java:276)
> org.apache.jasper.compiler.Compiler.compile(Compil er.java:264)
>

org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:5
63)
>

org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:3
03)
> org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
> org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
> javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
>
> i'm unable to understand why these problems are coming.
> Note:- i'd imported DBConnection.java in ConsLicBl.java and
> ConsLicBl.java in ConsLicResult.jsp.
>
> Kindly help.
> Thanks & Regards,
>
> Vidhi
>



 
Reply With Quote
 
 
 
 
Vidhi Gupta
Guest
Posts: n/a
 
      02-08-2006
Hello Arnaud,

i'm sorry for the late reply.well here's the statement that i'd used in
my ConsLicResult.jsp :-

<%@ page import="org.cris.prime.bl.ConsLicBl"%>

i'd given the whole path as above,but then also it is unable to find
ConsLicBl.java.why?
should i send you my code of ConsLicResult.jsp,ConsLicBl.java and
DBConnection.java.
as i'd imported DBConnection.java in ConsLicBl.java and finally this
file in ConsLicResult.jsp.
i'd done everything to solve this problem.but nothing came out.My
directory structure is like :-

C:\Program Files\Apache Software Foundation\Tomcat
5.5\webapps\testing\ConsLic.jsp
C:\Program Files\Apache Software Foundation\Tomcat
5.5\webapps\testing\ConsLicResult.jsp
C:\Program Files\Apache Software Foundation\Tomcat
5.5\webapps\testing\WEB-INF\classes\org\cris\prime\bl\ConsLicBl.java
C:\Program Files\Apache Software Foundation\Tomcat
5.5\webapps\testing\WEB-INF\classes\org\cris\prime\db\DBConnection.java

Problem is coming in ConsLicResult.jsp as it is unable to resolve
ConsLicBl.java.

Kindly help.
Looking forward for your kind reply.
Thanks & regards,
Vidhi
Arnaud B. wrote:
> Hi,
>
> >Only a type can be imported. org.cris.prime.bl.ConsLicBl resolves to a

> package
>
> Could you show us the import statements of your JSP ?
> It looks like the problem could be there.
>
> (as if you had declared "import org.cris.prime.bl.ConsLicBl.*; or something
> like this)
>
> Regards,
>
> Arnaud
>
> "Vidhi Gupta" <(E-Mail Removed)> a écrit dans le message de
> news:(E-Mail Removed) ups.com...
> > hello,
> >
> > i'm using JSP on Tomcat 5.5.15 on WIN 2000 with jdk1.5.0.02 and Oracle
> > 8i.i've the hierarchy of my project as : -
> > TOMCAT_HOME\webapps\testing\ConsLicResult.jsp
> >

> TOMCAT_HOME\webapps\testing\WEB-INF\classes\org\cris\prime\db\DBConnection.j
> ava
> >

> TOMCAT_HOME\webapps\testing\WEB-INF\classes\org\cris\prime\bl\ConsLicBl.java
> >
> > whenever i'm compiling my ConsLicBl.java, it is generatind the
> > following errors as :
> >
> > package org.cris.prime.db does not exist and cannot resolve symbol
> > class DBConnection
> >
> > when i'm executing the ConsLicResult.jsp on localhost the following
> > error are coming :-
> >
> > org.apache.jasper.JasperException: Unable to compile class for JSP
> >
> > Generated servlet error:
> > Only a type can be imported. org.cris.prime.bl.ConsLicBl resolves to a
> > package
> >
> > An error occurred at line: 16 in the jsp file: /ConsLicResult.jsp
> > Generated servlet error:
> > ConsLicBl cannot be resolved to a type
> >
> > An error occurred at line: 16 in the jsp file: /ConsLicResult.jsp
> > Generated servlet error:
> > ConsLicBl cannot be resolved to a type
> >
> >
> >

> org.apache.jasper.servlet.JspServletWrapper.handle JspException(JspServletWra
> pper.java:510)
> >

> org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:3
> 75)
> > org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
> > org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
> > javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
> >
> >
> > root cause
> >
> > org.apache.jasper.JasperException: Unable to compile class for JSP
> >
> > Generated servlet error:
> > Only a type can be imported. org.cris.prime.bl.ConsLicBl resolves to a
> > package
> >
> > An error occurred at line: 16 in the jsp file: /ConsLicResult.jsp
> > Generated servlet error:
> > ConsLicBl cannot be resolved to a type
> >
> > An error occurred at line: 16 in the jsp file: /ConsLicResult.jsp
> > Generated servlet error:
> > ConsLicBl cannot be resolved to a type
> >
> >
> >

> org.apache.jasper.compiler.DefaultErrorHandler.jav acError(DefaultErrorHandle
> r.java:84)
> >

> org.apache.jasper.compiler.ErrorDispatcher.javacEr ror(ErrorDispatcher.java:3
> 2
> > org.apache.jasper.compiler.JDTCompiler.generateCla ss(JDTCompiler.java:409)
> > org.apache.jasper.compiler.Compiler.compile(Compil er.java:297)
> > org.apache.jasper.compiler.Compiler.compile(Compil er.java:276)
> > org.apache.jasper.compiler.Compiler.compile(Compil er.java:264)
> >

> org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:5
> 63)
> >

> org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:3
> 03)
> > org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
> > org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
> > javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
> >
> > i'm unable to understand why these problems are coming.
> > Note:- i'd imported DBConnection.java in ConsLicBl.java and
> > ConsLicBl.java in ConsLicResult.jsp.
> >
> > Kindly help.
> > Thanks & Regards,
> >
> > Vidhi
> >


 
Reply With Quote
 
steen
Guest
Posts: n/a
 
      02-08-2006

Vidhi Gupta wrote:
> C:\Program Files\Apache Software Foundation\Tomcat
> 5.5\webapps\testing\WEB-INF\classes\org\cris\prime\bl\ConsLicBl.java
> C:\Program Files\Apache Software Foundation\Tomcat
> 5.5\webapps\testing\WEB-INF\classes\org\cris\prime\db\DBConnection.java


Well, the thing which comes to mind, is that you have the .java files
in your WEB-INF/classes dir, try putting the .class files inthere
instead.

/Steen

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to compile class for JSP confusedsoul Java 0 10-03-2010 09:11 PM
unable to compile class for jsp punitha.kamal Software 0 04-21-2010 01:31 PM
Tomcat and JSP: Unable to compile class, cannot resolve to a type tfrawley@gci.net Java 2 10-30-2008 03:30 PM
Unable to compile class for JSP ramesh Java 3 11-07-2003 03:43 PM
JSP: org.apache.jasper.JasperException: Unable to compile class Tim Meals Java 0 09-05-2003 10:04 PM



Advertisments