Malformed \uxxxx encoding with Java Web Start and apache.commons-logging

4.8k views Asked by At

I'm trying to migrate a Java applet to Java Web Start. Therefore, I call the applet with the following jnlp-file:

<?xml version="1.0"?>
<jnlp spec="1.0+" codebase="http://localhost:7001/codebase/">
    <information>
        <title>title</title>
        <vendor>vendor</vendor>
    </information>
    <resources>
        <java version="1.7"/>
        <jar href="myapplet.jar"/>
        <extension name="dependencies" href="Dependencies.jnlp"/>
    </resources>
    <applet-desc main-class="AppletMainClass" name="MyApplet"/>
</jnlp>

The dependencies file:

<?xml version="1.0"?>
<jnlp spec="1.0+" codebase="http://localhost:7001/codebase/">
    <information>
        <title>Dependencies</title>
        <vendor>vendor</vendor>
    </information>
    <resources>
        ...
        <jar href="commons-logging.jar"/>
        <jar href="log4j-1.2.11.jar"/>
    </resources>
    <component-desc/>
</jnlp>

When starting the applet, the apache-commons logger is to be initialized:

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public abstract class BaseApplet extends JApplet {
    private transient Log log = LogFactory.getLog(BaseApplet.class);
}

This fails with java.lang.IllegalArgumentException: Malformed \uxxxx encoding. However, when running the applet without a jnlp file, no exception occurs.

Searching the web so far only gave me the suggestion, that a character in the properties files might be incorrectly escaped, but I can find no such thing in my properties.

commons-logging.properties:

org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger

log4j.properties:

log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n

log4j.logger.httpclient.wire.header=DEBUG
log4j.logger.httpclient.wire.content=INFO
log4j.logger.org.apache.commons.httpclient=WARN

What else could be the cause for this exception?

2

There are 2 answers

0
Jakob On BEST ANSWER

Turns out that the commons-logging.properties was corrupted inside the jar (but not in my IDE), and that caused the malformed encoding exception.

0
Shivansh Narayan On

For me deleting everything from ~/.m2/repository and running maven solved the issue