JDK-4665105 : jwsdponj2ee: SAXParseException invalid encoding name Cp1252
  • Type: Bug
  • Component: xml
  • Sub-Component: org.xml.sax
  • Affected Version: jwsdp-1.0
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2002-04-09
  • Updated: 2012-04-25
  • Resolved: 2002-04-12
Description
I ran jwsdponj2ee.bat so that I could create a web service on the J2EE SDK 1.3.1.
The service deployed and ran with no errors.  However, several of the EARs
distributed with the J2EE Tutorial no longer work (ex.-- CartApp.ear).

When I tried to deploy one of these EARs on the J2EE SDK 1.3.1,  the deploytool
throws the following exception:

[Fatal Error] :1:40: Invalid encoding name "Cp1252".
org.xml.sax.SAXParseException: Invalid encoding name "Cp1252".
        at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:235)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.
java:201)
        at com.sun.enterprise.deployment.ApplicationArchivist.getApplicationName
(ApplicationArchivist.java:1722)
        at com.sun.enterprise.tools.deployment.main.Main.main(Main.java:155)
Deploy the application in WarehouseApp.ear on the server localhost saving the cl
ient jar as WarehouseAppClient.jar
Sender object Deploy Tool : Deploy null on localhost
Remote message: Contacted Server....
Remote message: Application null transferred.
Sender object Deploytool (Main) : RemoteException occurred in server thread; nes
ted exception is:
        java.rmi.RemoteException: Error saving/opening

Comments
EVALUATION This is bug in Xerces2.0.1 jaxp-ri-1_2_0-fcs-brach. I am investigating into it. ###@###.### 2002-04-10 Encoding name "Cp1252" is JAVA Encoding Name. In most of the cases JAVA Encoding names are different than IANA Encodings. The encoding names used in XML instance documents must be the IANA encoding names specified or one of the aliases for those names which IANA defines. http://www.w3.org/TR/2000/REC-xml-20001006#charencoding So to use JAVA encoding names, we have to explicitly set Xerces Feature "http://apache.org/xml/features/allow-java-encodings" to "true" so that JAVA Encoding names are allowed in XMLDecl and TextDecl lines. Look at http://xml.apache.org/xerces2-j/features.html for more detail. Hence, bug stands invalid. Please try by setting "http://apache.org/xml/features/allow-java-encodings" feature to true and let me know if you still face the problem.
11-06-2004

SUGGESTED FIX Create a j2sdpOFFj2ee script to roll back the changes made to the J2EE SDK by j2sdponj2ee.
11-06-2004

PUBLIC COMMENTS I've done some more testing with deploytool and have discovered why this problem has been so confusing. But first let me say that bug 4665105 is not a bug and the workaround is easy. Older versions of the GUI deploytool created XML files with the Cp1252 encoding. (We've had 9 releases, so I don't know which versions of the GUI deploytool generated the Cp1252 value.) The current (1.3.1) version of the GUI deploytool creates XML files with the UTF-8 encoding. The J2EE apps with the UTF-8 encoding deploy just fine after the jwsdponj2ee script is run. If I take an old J2EE app that has the Cp1252 encoding and try to deploy it with the *command-line* deploytool, I get the errors that led me to file this bug. Now here's the tricky part: If I take that same app, the one with the Cp1252 encoding, open it in the *GUI* deploytool and then deploy it, there are no errors. Why? Before it deploys the app's EAR file, the GUI deploytool changes the encoding from Cp1252 to UTF-8 and then saves this change in the EAR file. So, after the GUI deploytool saves the file, the problem goes away. I got faked out because the GUI and command-line deploytools behave differently. So, the problem is a corner case, since most people will use the GUI version of the deploytool. And the workaround is easy: just open the EAR in the GUI and then save it. ###@###.### 2002-04-12
12-04-2002

WORK AROUND Open the EAR file in the GUI deploytool and then save it. The tool will automatically change the encoding from Cp1252 to UTF-8. ###@###.### 2002-04-12
12-04-2002