Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

problem when uploading avatar

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I got this stack trace when uploading an avatar. Is this a real bug or a problem with my installation?

Expression encoding is undefined on line 4, column 63 in default/forum_base.htm.
The problematic instruction:
----------
==> ${encoding} [on line 4, column 61 in default/forum_base.htm]
in include "default/forum_base.htm [on line 4, column 1 in exception.html]
----------

Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression encoding is undefined on line 4, column 63 in default/forum_base.htm.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
at freemarker.core.Expression.getStringValue(Expression.java:118)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:171)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:171)
at freemarker.core.Environment.include(Environment.java:1256)
at freemarker.core.Include.accept(Include.java:156)
at freemarker.core.Environment.visit(Environment.java:171)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:171)
at freemarker.core.Environment.process(Environment.java:156)
at freemarker.template.Template.process(Template.java:219)
at net.jforum.ForumException.><init>(ForumException.java:85)
at net.jforum.JForum.service(JForum.java:285)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:405)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:472)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:525)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1457)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:514)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1409)
at org.mortbay.http.HttpServer.service(HttpServer.java:889)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:829)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:998)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:846)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:345)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:530)
[originally posted on jforum.net by guyhillyer]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
with just this stacktrace I can't say exactly. Is that all you get when the error is trhown? The other parts of the forum works fine? Which OS are you using?

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am running JForum under Jetty 5 on Debian Woody, using Sun JDK 1.4.2.

The forum continues to operate normally otherwise.

BTW, would you have preferred that I posted this on JIRA instead of here?
I am seeing at least one other stack trace that I will report later on.


[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am running JForum under Jetty 5 on Debian Woody, using Sun JDK 1.4.2.



Well, do you have the X libraries installed, right? The directory "images" and "tmp" are writable by Tomcat's user?


BTW, would you have preferred that I posted this on JIRA instead of here?



No, here is fine for now. If we found it is a bug, then we register the issue

Rafael

[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
X is installed; I use Xvnc on virtual display :1 all the time. THere is no X server at :0.

I get the same result whether I specify java.awt.headless=true or not.

Yes the images and tmp dirs are world-writeable.

I am still trying to figure out how to turn on logging -- I had to fiddle it
to bring Jetty's and JForum's use of commons logging into harmony. I
will figure it out eventually.

I haven't had a chance to try to debug this yet, sorry.

-- Guy
[originally posted on jforum.net by guyhillyer]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the relevant stack trace. Line 215 in Jforum.java is where the encoding is set on the new ActionServletRequest.

java.lang.IllegalStateException: getReader() or getInputStream() called
at org.mortbay.jetty.servlet.ServletHttpRequest.setCharacterEncoding(ServletHttpRequest.java:630)
at javax.servlet.ServletRequestWrapper.setCharacterEncoding(ServletRequestWrapper.java:157)
at net.jforum.JForum.service(JForum.java:215)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:405)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:472)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:525)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1457)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:514)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1409)
at org.mortbay.http.HttpServer.service(HttpServer.java:889)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:829)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:998)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:846)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:345)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:530)

[originally posted on jforum.net by guyhillyer]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, it will help to fix the bug. It is registered at [url]http://www.jforum.net/jira/browse/JF-201[url]

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jetty must be enforcing the spec more strictly than some other containers.
Javadoc on ServletRequest.setCharacterEncoding says: "This method must
be called prior to reading request parameters or reading input using
getReader()."

If the request is an upload (multipart) then the ActionServletRequest
constructor calls upload.parseRequest(). This invokes getInputStream on
the request. Jetty's implementation of HttpServletRequest sets a state
variable just to detect this violation of protocol.

So, in the case of an upload request, new ActionServletRequest(req) returns
a request on which it's illegal to call setCharacterEncoding.

A simple solution would be to let the constructor set the encoding -- it could
be taken directly from the constructor's argument
(superRequest.getCharacterEncoding()). What do you think?

-- Guy

[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I removed the setCharacterEncoding() calls from JForum.java, and now I only set it when the request is not multipart. It should work. ( anyway, I'll have to install jetty here to test it ).

I'm having encoding problems when using multipart/form-data when the encoding is set to UTF-8.. it only works when some "specific" encoding is used, like ISO-8859-1 in my case.

I don't know anymore if this is some bug with commons-fileupload or what.. :?

Rafael
[originally posted on jforum.net by Rafael Steil]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic