You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Arnoud, Geoffroy" <ge...@capgemini.com> on 2013/06/26 17:44:07 UTC

CXF based applet fetching the applet jar several times

Hello

We are developing an applet making web services calls to a server.
We used cxf and from Eclipse, evrything works fine.

Once deployed, the jar is fetched several times from the server to fetch CXF resources, but it seems to me that all the resources are present in the applet jar file.
I remotely debuged the applet and saw calls orignitaed by a getResourceAsStream for resrouces that I can see in the jar.

Here is the Applet pom.xml (we use the shade plugin and cxf 2.6.x)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <parent>
    <groupId>com.capgemini.project</groupId>
    <version>0.0.1-SNAPSHOT</version>
    <artifactId>project</artifactId>
    <relativePath>..</relativePath>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <artifactId>projet-artifact</artifactId>
  <name>project-name</name>


    <dependency>
      <groupId>au.com.vinae</groupId>
      <artifactId>jstutablet</artifactId>
    </dependency>

    <dependency>
      <groupId>com.sun.jna</groupId>
      <artifactId>jna</artifactId>
    </dependency>


    <!-- CXF deps -->
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxws</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-http</artifactId>
    </dependency>



  </dependencies>
  <build>



    <plugins>

      <!-- Excludes POM from Jar -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.3.1</version>
        <configuration>
          <archive>
            <addMavenDescriptor>false</addMavenDescriptor>
          </archive>
        </configuration>
      </plugin>



      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>1.4</version>
        <executions>
          <execution>
            <id>signed</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>

              <filters>

              </filters>
              <minimizeJar>false</minimizeJar>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>com.capgemini.m6.diapason.wacom.WacomApplet</mainClass>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                  <resource>META-INF/cxf/bus-extensions.txt</resource>
                </transformer>

                <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
                  <projectName>Apache CXF</projectName>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                  <resource>META-INF/spring.handlers</resource>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                  <resource>META-INF/services/com.sun.tools.xjc.Plugin</resource>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                  <resource>META-INF/spring.schemas</resource>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                  <resource>META-INF/cxf/cxf.extension</resource>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
                  <resource>META-INF/extensions.xml</resource>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
                  <resource>META-INF/cxf/extensions.xml</resource>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
                  <resource>META-INF/bus-extensions.xml</resource>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
                  <resource>META-INF/cxf/bus-extensions.xml</resource>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
                  <resource>META-INF/wsdl.plugin.xml</resource>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
                  <resource>META-INF/tools.service.validator.xml</resource>
                </transformer>
                <transformer implementation="org.apache.cxf.maven.PluginTransformer">
                  <resource>META-INF/tools-plugin.xml</resource>
                </transformer>
                <transformer implementation="org.apache.cxf.maven.CXFAllTransformer" />

              </transformers>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>full</shadedClassifierName>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-buildtools</artifactId>
            <version>2.2.12</version>
            <type>jar</type>
            <scope>compile</scope>
          </dependency>
        </dependencies>
      </plugin>


  </build>
</project>



What am I missing ?

Regards

Geoff.

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

RE: CXF based applet fetching the applet jar several times

Posted by "Arnoud, Geoffroy" <ge...@capgemini.com>.
Hello

I've tested the hack, it's not better. I've tested with Java 1.6u45 and java 1.7. 

As stated before, in 1.7, I don't have class loading slow down - when not doing shading.
Shading is a bit slower.

In 1.6/no shade it's slow (certainly jaxb) and with shade it's worse.

If someone knows how to have the same response time with sading and not shading, it would be nice to tell me.

Best regards

Geoff.

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.


Re: CXF based applet fetching the applet jar several times

Posted by Daniel Kulp <dk...@apache.org>.
Can you try adding a file to your war/bundle:

/META-INF/cxf/org.apache.cxf.JDKBugHacks.defaultUsesCaches

that just contains a single line:
true

And see if that helps.   We have to do a few things to try and prevent the class loader from being locked.  JAXB is one of them that does strange things.  Adding that file turns off one of the hacks we use that may have an impact on this.

Dan


On Jun 27, 2013, at 8:23 AM, "Arnoud, Geoffroy" <ge...@capgemini.com> wrote:

> Hi again,
> 
> Using java plugin 1.7 doesn't show the strange bejaviour on jaxb-impl.
> 
> It remains the issue of shading correctly the jar files.
> 
> Regards
> 
> Geoff.
> 
> This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


RE: CXF based applet fetching the applet jar several times

Posted by "Arnoud, Geoffroy" <ge...@capgemini.com>.
Hi again,

Using java plugin 1.7 doesn't show the strange bejaviour on jaxb-impl.

It remains the issue of shading correctly the jar files.

Regards

Geoff.

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.


RE: CXF based applet fetching the applet jar several times

Posted by "Arnoud, Geoffroy" <ge...@capgemini.com>.
Hello

I went on investigating.

I stopped shading my applet, and put all explicit deps in archive tag, it's better but not perfect.

Actually I have an issue with jaxb-impl.jar (2.1.13), that is fetched and fecthed again and again. Manually putting it in the lib/ext directory of my java plugin shows good perf, but is not a solution.

Does anyone know why the applet class loader has this behaviour with jaxb-impl?

Regards

Geoff.
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.