This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Jsp Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Jsp Error" Watch "Jsp Error" New topic
Author

Jsp Error

Asim Aryabhatta
Greenhorn

Joined: Dec 16, 2011
Posts: 1
Hello All,

I am getting the below error while trying to run the jsp file?




The Error I am getting is:

java.io.UTFDataFormatException: PWC6260: Invalid byte 1 of 1-byte UTF-8 sequence.
at org.apache.jasper.xmlparser.UTF8Reader.invalidByte(UTF8Reader.java:646)
at org.apache.jasper.xmlparser.UTF8Reader.read(UTF8Reader.java:521)
at org.apache.jasper.xmlparser.XMLEncodingDetector.load(XMLEncodingDetector.java:1065)
at org.apache.jasper.xmlparser.XMLEncodingDetector.skipString(XMLEncodingDetector.java:1016)
at org.apache.jasper.xmlparser.XMLEncodingDetector.scanXMLDecl(XMLEncodingDetector.java:1274)
at org.apache.jasper.xmlparser.XMLEncodingDetector.getEncoding(XMLEncodingDetector.java:160)
at org.apache.jasper.xmlparser.XMLEncodingDetector.getEncoding(XMLEncodingDetector.java:148)
at org.apache.jasper.compiler.ParserController.determineSyntaxAndEncoding(ParserController.java:381)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:215)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:161)
at org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:394)
at org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:431)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:574)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1652)
at org.apache.jasper.compiler.Parser.parse(Parser.java:185)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:145)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:212)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:625)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:619)


Please help...

Suraj Jadhav
Greenhorn

Joined: Mar 10, 2010
Posts: 25
I think instead of writing this code in JSP you can also make it as html file. But to resolve your error try removing line no 5 if there is not a requirement of specific encoding type(UTF-8). Also check your respective xml configuration file because from the exception it look like error is getting while parsing xml file.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Why on earth would you be trying to set the content type of an HTML page to "image/gif"?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
The actual error is caused because you are using <%@ include %> to include an image file.
Your computer happily does this, tries to parse the result as a JSP page, and understandably spits the dummy after finding binary crap in there.

If you want to serve a web page with an embedded image, use the html <img> tag to include the image rather than <%@ include %>
ie:


If you want to serve an image, use an ImageServlet rather than a JSP, as the text a JSP sends will just corrupt the binary data of the image.



Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

And only send the image data -- you can't mix HTML and image data as you are trying to do here. What's the intent of that?
 
 
subject: Jsp Error
 
Similar Threads
Trouble in retrieving data from the mysql database using JSTL
IllegalStateException when inserting session attribute into a table
how to send bean objct to another jsp
Tag Error
Exception when i am trying to dispatch the request to a Error Page