This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jsp Error

 
Asim Aryabhatta
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64606
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why on earth would you be trying to set the content type of an HTML page to "image/gif"?
 
Stefan Evans
Bartender
Pie
Posts: 1669
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64606
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic