title: JNLP: tools.jar not in the classpath
body: <p>it's me again. And today, I'm facing kind of a weird problem. Either I didn't understand something correctly or I'm simply missing the forrest in front of the trees.</p>
  <p>Following scenario:</p>
  <ul>
  <li>I'm using JavaFX, bundled in JDK 1.7</li>
  <li>I need both client runtimes: Desktop (jar) and Applet (jnlp inside the browser)</li>
  <li>I have a maven project set up for the project</li>
  <li>I have a parent pom and different sub modules</li>
  <li>I need my client to communicate with a web service, that for I'v chosen <a href="http://cxf.apache.org/" rel="nofollow noreferrer">CXF</a> as framework (I need to be able to switch web services on runtime) for connecting to the web service</li>
  <li>The 'connect to the web service stuff' is an own maven sub module called wsConnector</li>
  </ul>
  <p>Here is some more environment information and my pom snippets:</p>
  <pre><code>mvn -version
  Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
  Maven home: C:\Program Files (x86)\Apache\maven-3.0.4\bin\..
  Java version: 1.7.0_07, vendor: Oracle Corporation
  Java home: C:\Program Files\Java\jdk1.7.0_07\jre
  Default locale: de_DE, platform encoding: Cp1252
  OS name: &quot;windows 7&quot;, version: &quot;6.1&quot;, arch: &quot;amd64&quot;, family: &quot;windows&quot;
  </code></pre>
  <p>For being able to compile the wsConnector sub module, again which takes care about all the web service connection stuff, I need to integrate the tools.jar from the JDK as CXF needs that.</p>
  <p>relevant properties from the parent pom.xml:</p>
  <pre><code>&lt;properties&gt;
      &lt;maven.compiler.source&gt;1.7&lt;/maven.compiler.source&gt;
      ...
  &lt;/properties&gt;
          
  </code></pre>
  <p>sub module pom.xml:
  </p>
  <pre><code>&lt;properties&gt;
      &lt;cxf.version&gt;2.6.2&lt;/cxf.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          ... // some other sub modules
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-rt-frontend-jaxws&lt;/artifactId&gt;
          &lt;version&gt;${cxf.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-rt-transports-http&lt;/artifactId&gt;
          &lt;version&gt;${cxf.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-rt-transports-http-jetty&lt;/artifactId&gt;
          &lt;version&gt;${cxf.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.oracle&lt;/groupId&gt;
          &lt;artifactId&gt;tools&lt;/artifactId&gt;
          &lt;version&gt;${maven.compiler.source}]&lt;/version&gt;
          &lt;scope&gt;system&lt;/scope&gt;
          &lt;systemPath&gt;${java.home}/../lib/tools.jar&lt;/systemPath&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  <p>If I run <code>mvn clean package</code>, everything works fine and dandy. In the deploy directory of my client app (where the jar, generated HTML and jnlp file is also), I find the <code>tools.jar</code>, too.</p>
  <p>If I have a look in the JNLP file, I find the entry:</p>
  <pre><code>&lt;jar href=&quot;tools.jar&quot; size=&quot;15226565&quot; download=&quot;eager&quot; /&gt;
  </code></pre>
  <p>Now my problem is: if I run the client with <code>java -jar client.jar</code>, everything works. But if I call the HTML / JNLP file, i get a <code>ClassNotFoundException</code>, pointing out that tools.jar is not on the classpath.
  Therefore, it doesn't care if I open the applet from a server or localhost.</p>
  <p>Here is the stacktrace:</p>
  <pre><code>java.lang.IllegalStateException: Unable to create schema compiler
   at org.apache.cxf.common.jaxb.JAXBUtils.createSchemaCompilerWithDefaultAllocator(JAXBUtils.java:694)
   at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:303)
   at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:270)
   at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:263)
   at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:198)
   at com.multiguide.ws.WebServiceConnector.setWsdlUrl(WebServiceConnector.java:45)
   at com.multiguide.ws.WebServiceConnector.setWsdlUrl(WebServiceConnector.java:31)
   at com.multiguide.view.administration.WebServiceInformationPanel.connect(WebServiceInformationPanel.java:130)
   at com.multiguide.view.administration.WebServiceInformationPanel.refresh(WebServiceInformationPanel.java:70)
   at com.multiguide.view.administration.WebServiceInformationPanel.&lt;init&gt;(WebServiceInformationPanel.java:45)
   at com.multiguide.view.administration.WebServiceInformationPanel$$FastClassByGuice$$da5f387e.newInstance(&lt;generated&gt;)
   at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
   at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:60)
   at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
   at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
   at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
   at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
   at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)
   at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
   at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
   at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
   at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
   at com.google.inject.Scopes$1$1.get(Scopes.java:65)
   at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
   at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
   at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
   at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)
   at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
   at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
   at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
   at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
   at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)
   at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
   at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
   at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
   at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
   at com.google.inject.Scopes$1$1.get(Scopes.java:65)
   at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
   at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)
   at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
   at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)
  
  ... 9 more
  Caused by: javax.xml.bind.JAXBException - with linked exception:
  
  java.lang.ClassNotFoundException: com/sun/tools/internal/xjc/api/XJC
   at org.apache.cxf.common.jaxb.JAXBUtils.createSchemaCompiler(JAXBUtils.java:679)
   at org.apache.cxf.common.jaxb.JAXBUtils.createSchemaCompilerWithDefaultAllocator(JAXBUtils.java:686)
  
  ... 49 more
  Caused by:
  
  java.lang.ClassNotFoundException: com/sun/tools/internal/xjc/api/XJC
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Unknown Source)
   at org.apache.cxf.common.jaxb.JAXBUtils.createSchemaCompiler(JAXBUtils.java:672)
  
  ... 50 more
  </code></pre>
  <p>Is it a class loading issue as I'm using guice? Without this exception, the app is working like a charme. I can do all the web service stuff I need to do: connecting, switching URL, ... So I wouldn't expect that to be the reason.</p>
  <p>Note besides: I think it doesn't matter here right now, but as I'm using guice, of course my JNLP file has the</p>
  <pre><code>&lt;security&gt;
    &lt;/all-permissions&gt;
  &lt;/security&gt;
  </code></pre>
  <p>flag.</p>
  <p>Has anyone of you experiences with that? Maybe I really just miss a thing, but any help (as always ;) ) is highly appreciated :)</p>