org.apache.jasper.JasperException: Unable to compile class for JSP:
karthik chellappan
Ranch Hand
Joined: Jul 01, 2007
Posts: 31
posted
0
hi all,
i was trying my hands on Custom tags in JSP by doing a simple program when i encountered the following error :
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 9 in the jsp file: /tag.jsp
AdvisorTagHandler cannot be resolved to a type
6: <body>
7: <%@ taglib prefix="mine" uri="simple" %>
8: Advisor Page
An error occurred at line: 9 in the jsp file: /tag.jsp
AdvisorTagHandler cannot be resolved to a type
6: <body>
7: <%@ taglib prefix="mine" uri="simple" %>
8: Advisor Page
i do use intendations ,but for this above code i happened to copy-paste from a text editor in linux which actually took its default intendation pattern and i neglected to correct it ,so im really sorry for making things difficult for you ...
i did create a package named "foo" and placed my Handler class inside tat ...but still its giving me this error :
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 9 in the jsp file: /tag.jsp
AdvisorTagHandler cannot be resolved to a type
6: <body>
7: <%@ taglib prefix="mine" uri="simple" %>
8: Advisor Page
An error occurred at line: 9 in the jsp file: /tag.jsp
AdvisorTagHandler cannot be resolved to a type
6: <body>
7: <%@ taglib prefix="mine" uri="simple" %>
8: Advisor Page
Please repost the code, with proper indentation, and with your changes.
Otherwise, we can only guess.
karthik chellappan
Ranch Hand
Joined: Jul 01, 2007
Posts: 31
posted
0
Hi bear,
my Taghandler class is in foo package :
AdvisorTagHandler.java
tld file :
advice.tld
jsp file :
tag.jsp
ERROR:
org.apache.jasper.JasperException: /tag.jsp(10,0) Unable to load tag handler class "foo.AdvisorTagHandler" for tag "mine:advice"
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:198)
at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1335)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1579)
at org.apache.jasper.compiler.Parser.parse(Parser.java:130)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:245)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:176)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:317)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)
earlier i posted wrong error ,as i didnt change the <tag-class> value accordingly .now im getting this above error ...
The class file must also be in a folder named foo. You need to learn about Java packages before you can successfully deploy a web application.
karthik chellappan
Ranch Hand
Joined: Jul 01, 2007
Posts: 31
posted
0
but then eclipse is creating classes by default in ../build/classes/ and this 'class' folder is not visible in IDE and can be seen only when your navigating each folder from oustide eclipse ...
so how can i get my class file generated in foo package ?
i did tried copying the class file generated in ../build/classes/ to ../foo/ ,but it was showing the same error ...
It doesn't matter what Eclipse is doing, if it's not in the right location, it will not work.
karthik chellappan
Ranch Hand
Joined: Jul 01, 2007
Posts: 31
posted
0
hi bear
i tried changing the path where the class file has to be generated in the classpath file which was generated by eclipse...then refreshed the project,restarted the server and ran it ,but still its comming up with same error ...
can you please guide me how i can solve this ?
classpath file of eclipse looks like this :
i changed just one in this file ,it was earlier :
later i changed it into :
also,for some reasons ...eclipse sometimes was not creating class file in 'build/classes' folder earlier and this is what exactly happening now...no class file is being created in 'src/foo' folder or 'build/classes' folder ...
If you didn't do anything to change it, it's probably ok.
Eclipse tracks the source directories for a given project. Rather than having all of the source in one "src/" directory, there might be others, like "test/" and "generated/" or whatever. The list of these directories (and optionally their output directories) is configurable under the project's settings.
karthik chellappan
Ranch Hand
Joined: Jul 01, 2007
Posts: 31
posted
0
If you didn't do anything to change it, it's probably ok.
does that mean nothing is problem with configuration of source directories ?
i tried changing the configuration of src and output directories in project settings like this :
1.custom[project name]->right click->build path->configure build path->properties window pops up
2.In properties->selected 'source tab'->it was earlier custom/src in source folders on build path and custom/src in default output folder.
3.selected custom/src and clicked edit to add foo package also to source folder ,a edit window pops up but refuses to add foo to src saying :The folder 'custom/src/foo' already exists .
4.im left with no other option other than to add a new source folder which takes full path :custom/src/foo by clicking 'Add folder' and then delete this old src folder .
5.when i did the above step,in eclipse : 'Java resources:src' changed to 'Java resources:foo' and a default package was created under which java file was present.