PDA

View Full Version : Tomcat pages are all white, log shows: java.io.UnsupportedEncodingException: cp932


kjkoster
14-03-2009, 21:24
Dear All,

Sometimes you realise that there is just no way that we can test our software for all eventualities. Here is an interesting one for those among you who run their Windows machines in the Japanese code pages (or perhaps other international code pages): the Tomcat Windows installer does not properly install Tomcat when Windows does not use the default code page.

This problem does not occur if you install Tomcat while the machine is running in the default code pages. Once installed, Tomcat runs fine regardless of code pages selected. You can also install Tomcat under the Japanese code pages by not using the Windows installer for Tomcat, but just unzipping the Tomcat zip.

From what I understand, this is something that installers for other applications also suffer from.

Symptoms: Tomcat installs and starts up just fine. However, Tomcat serves all white pages and there is are these exceptions in the logs:

Mar 6, 2009 5:12:59 AM org.apache.naming.NamingContext lookup
WARNING: Unexpected exception resolving reference
java.io.UnsupportedEncodingException: cp932
at sun.nio.cs.StreamDecoder.forInputStreamReader(Unkn own Source)
at java.io.InputStreamReader.<init>(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityS canner.createReader(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityS canner.setEncoding(Unknown Source)
* snip *
Mar 6, 2009 5:12:59 AM org.apache.catalina.mbeans.GlobalResourcesLifecycl eListener createMBeans
SEVERE: Exception processing Global JNDI Resources
javax.naming.NamingException: cp932
at org.apache.naming.NamingContext.lookup(NamingConte xt.java:805)
at org.apache.naming.NamingContext.lookup(NamingConte xt.java:140)
at org.apache.naming.NamingContextBindingsEnumeration .nextElementInternal(NamingContextBindingsEnumerat ion.java:113)
at org.apache.naming.NamingContextBindingsEnumeration .next(NamingContextBindingsEnumeration.java:71)
at org.apache.catalina.mbeans.GlobalResourcesLifecycl eListener.createMBeans(GlobalResourcesLifecycleLis tener.java:137)
* snip *
Mar 6, 2009 5:12:59 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Mar 6, 2009 5:12:59 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
Mar 6, 2009 5:12:59 AM org.apache.naming.NamingContext lookup
WARNING: Unexpected exception resolving reference
java.io.UnsupportedEncodingException: cp932
at sun.nio.cs.StreamDecoder.forInputStreamReader(Unkn own Source)
at java.io.InputStreamReader.<init>(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityS canner.createReader(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityS canner.setEncoding(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl.scanXMLDeclOrTextDecl(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumen tScannerImpl$XMLDeclDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumen tScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLPars er.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.Abstrac tSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserI mpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Dig ester.java:1663)
at org.apache.catalina.users.MemoryUserDatabase.open( MemoryUserDatabase.java:402)
at org.apache.catalina.users.MemoryUserDatabaseFactor y.getObjectInstance(MemoryUserDatabaseFactory.java :103)
at org.apache.naming.factory.ResourceFactory.getObjec tInstance(ResourceFactory.java:140)
at javax.naming.spi.NamingManager.getObjectInstance(U nknown Source)
at org.apache.naming.NamingContext.lookup(NamingConte xt.java:793)
* snip *
Mar 6, 2009 5:12:59 AM org.apache.catalina.realm.UserDatabaseRealm start
SEVERE: Exception looking up UserDatabase under key UserDatabase
javax.naming.NamingException: cp932
at org.apache.naming.NamingContext.lookup(NamingConte xt.java:805)
at org.apache.naming.NamingContext.lookup(NamingConte xt.java:153)
at org.apache.catalina.realm.UserDatabaseRealm.start( UserDatabaseRealm.java:253)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1037)
at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
at org.apache.catalina.core.StandardService.start(Sta ndardService.java:516)
at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalin a.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:413)
Mar 6, 2009 5:12:59 AM org.apache.catalina.startup.Catalina start
SEVERE: Catalina.start:
LifecycleException: No UserDatabase component found under key UserDatabase
at org.apache.catalina.realm.UserDatabaseRealm.start( UserDatabaseRealm.java:261)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1037)
at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
at org.apache.catalina.core.StandardService.start(Sta ndardService.java:516)
at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalin a.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:413)
Mar 6, 2009 5:12:59 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 48 ms

Kees Jan

bsgcic
09-04-2009, 06:20
I am also getting this error with the latest Tomcat 6.0.18.
I installed it on a Native Japanese Win2003 Server machine.
Have you found any resolutions, work-arounds or other to this problem that may work on a native Japanese OS in which the default code pages are Japanese?
Any suggestions?

kjkoster
09-04-2009, 09:08
Dear bsgcic,

Did you use the Windows installer to install Tomcat? If so, uninstall it and install it again by downloading and unzipping the core distribution instead of the Windows one.

It is the installer that breaks Tomcat, Tomcat itself is fine. :-)

Does this happen to the example pages too, or just to the ones in your own application?

Kees Jan

bsgcic
09-04-2009, 09:48
Dear Kees Jan,

Thank you kindly. I will try that.
It does happens to the initial http://localhost:8080/ Tomcat page and my own app pages. I have not tried the example pages because the initial one did not load.

kjkoster
09-04-2009, 09:50
Dear bsgcic,

The reason I ask is because some exceptions in JSP pages may cause white pages in the browser. The example pages can help distinguish that problem from the code page one.

Let us know how it went.

Kees Jan

bsgcic
09-04-2009, 22:55
Dear Kees Jan,

Ok, I see. I will post again with results. Am pulled into another project currently and thus will be a little while. Thank you again.

bsgcic
09-04-2009, 22:59
Dear Kees Jan,

Looks like it will be resolved in the next Tomcat release.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45852

kjkoster
11-04-2009, 21:46
Dear bsgcic,

Excellent news.

Kees Jan