0

I'm thinking to put some UTF-8 words into web.xml as env-entry-value, but somehow that will cause my war become not deployable to my server. A case of my setting that causes deployment failure look like below.

<env-entry>
    <description>Msg text</description>
    <env-entry-name>Msg_Text</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>兔子</env-entry-value>
  </env-entry>

error msgs

10:56:41,498 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-15) JBAS015877: Stopped deployment Test.war (runtime-name: Test.war) in 69ms
10:56:41,920 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015858: Undeployed "Test.war" (runtime-name: "Test.war")
10:56:41,920 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."Test.war".PARSE

Can anyone teach me how to do it?

======Update======

Tried that with semi-colon again, &#53F0;, then it got other error

    23:57:43,222 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) JBAS014612: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"Test.war\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"Test.war\".PARSE: JBAS018733: Failed to process phase PARSE of deployment \"Test.war\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018014: Failed to parse XML descriptor \"/C:/Windows/System32/content/Test.war/WEB-INF/web.xml\" at [58,24]
    Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'F' (code 70); expected a decimal number.
 at [row,col {unknown-source}]: [58,24]"}}
23:57:44,144 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment Test.war (runtime-name: Test.war) in 915ms
23:57:44,144 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."Test.war".PARSE

If I fill it with normal ascii characters, it works good. Do I missed anything else on that?

Kaninchen
  • 455
  • 2
  • 7
  • 19

1 Answers1

0
  1. web.xml must contain <?xml version="1.0" encoding="UTF-8"?> or <?xml version="1.0"?>: any other encoding would corrupt Unicode text content.
  2. Edit web.xml in UTF-8; a programmer's editor like NotePad++ would do.
  3. For hexadecimal do not forget the x: &#x53F0;.
Joop Eggen
  • 107,315
  • 7
  • 83
  • 138