i have a java web app with maven.
i'm using jetty to run it during development (by using maven jetty plugin)
i've my log4j.properties file placed under src/main/resources and it is copied under WEB-INF/classes when deployed as expected.
in my log4j.properties file i defined a filter variable and when deployed it is also filtered with the real value.
in log4j.properties under src/main/resources;
log4j.appender.FILE.File = ${config-gui.log-file}
in log4j.properties under WEB-INF/classes (after deployed with filtering);
log4j.appender.FILE.File = /tmp/mylogfile.log
my problem is; i'm getting following error when i run mvn jetty:run
log4j:ERROR setFile(null,true) call failed.<br />
java.io.FileNotFoundException: (No such file or directory)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:177)
at java.io.FileOutputStream.<init>(FileOutputStream.java:102)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:289)
at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:163)
at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:215)
at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:256)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:132)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:654)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:509)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:415)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:441)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:470)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:122)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:88)
at com.pribas.bucherplayerconfiggui.util.LoggerUtil.getLogger(LoggerUtil.java:10)
at com.pribas.bucherplayerconfiggui.Initialization.<clinit>(Initialization.java:22)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.mortbay.jetty.webapp.WebXmlConfiguration.newListenerInstance(WebXmlConfiguration.java:649)
at org.mortbay.jetty.webapp.WebXmlConfiguration.initListener(WebXmlConfiguration.java:630)
at org.mortbay.jetty.webapp.WebXmlConfiguration.initWebXmlElement(WebXmlConfiguration.java:367)
at org.mortbay.jetty.plus.webapp.AbstractConfiguration.initWebXmlElement(AbstractConfiguration.java:190)
at org.mortbay.jetty.webapp.WebXmlConfiguration.initialize(WebXmlConfiguration.java:289)
at org.mortbay.jetty.plus.webapp.AbstractConfiguration.initialize(AbstractConfiguration.java:133)
at org.mortbay.jetty.webapp.WebXmlConfiguration.configure(WebXmlConfiguration.java:222)
at org.mortbay.jetty.plus.webapp.AbstractConfiguration.configure(AbstractConfiguration.java:113)
at org.mortbay.jetty.webapp.WebXmlConfiguration.configureWebApp(WebXmlConfiguration.java:180)
at org.mortbay.jetty.plus.webapp.AbstractConfiguration.configureWebApp(AbstractConfiguration.java:96)
at org.mortbay.jetty.plus.webapp.Configuration.configureWebApp(Configuration.java:124)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1217)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:510)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:110)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.plugin.AbstractJettyRunMojo$1.filesChanged(AbstractJettyRunMojo.java:409)
at org.mortbay.util.Scanner.reportBulkChanges(Scanner.java:493)
at org.mortbay.util.Scanner.reportDifferences(Scanner.java:359)
at org.mortbay.util.Scanner.scan(Scanner.java:286)
at org.mortbay.util.Scanner$1.run(Scanner.java:246)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
i think this error is because of it sees log4j.properties file which is under src/main/resources (which has appender's file param is not acceptable) instead of under WEB-INF/classes one.
i want maven jetty plugin to ignore log4j.properties file which is under src/main/resources and sees the one under WEB-INF/classes.
how can i do this?
or if this error is not related the idea i have, how can i solve this?
thx in advance.
I think, you can hardly guarantee which of log4j.properties will be used on in your jar or in WEB-INF/classes. It depends on concrete classloader implementation (in Tomcat or Jetty) which can either see WEB-INF/classes/log4j.properties or WEB-INF/libs/yourlib.jar:/log4j.properties. So you need to filter here or there :)
Using maven profiles you can configure the <excludes> for your resources and use this profile for to build web application for Tomcat deployment.
Maybe better solution will be renaming /src/main/resources/log4j.properties to /src/main/resources/log4j-jetty.properties and then configure Log4j via jetty plugin to use that resource:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
...
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>log4j-jetty.properties</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
Related
I am tying to run my web application with maven jetty plugin. But after some time at startup, it gives the error:
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
2014-08-10 17:39:45.840:INFO:oejs.Server:main: jetty-9.2.2.v20140723
2014-08-10 17:40:54.961:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.m.p.JettyWebAppContext#1e2c8{/asd,file:/C:/dev/project/hope/target/asd-1.0/,STARTING}{C:\dev\project\hope\target\asd-1.0.war}
java.lang.Exception: Timeout scanning annotations
at org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:570)
at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:440)
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:471)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1329)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:497)
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:365)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
I am using spring mvc with annotations and I think there is a problem about it.
When I try to run it over eclipse jetty plugin, it starts succesfully, but with maven plugin, it gives the error.
Any ideas?
I've got the same error and to fix it, you should add to your start script (start.ini) the following:
-Dorg.eclipse.jetty.annotations.maxWait=120
120 is for two minutes of annotation scanning in case that you need a higher value, just set it to the propper one.
It is useless to scan all dependent jars, you can make the scanning pattern more restrictive to only match certain jars:
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.8.v20150217</version>
<configuration>
<webAppConfig>
<contextPath>/</contextPath>
<webInfIncludeJarPattern>.*/foo-[^/]*\.jar$|.*/classes/.*</webInfIncludeJarPattern>
</webAppConfig>
</configuration>
</plugin>
See webInfIncludeJarPattern doc for more details:
http://www.eclipse.org/jetty/documentation/9.4.x/jetty-maven-plugin.html#configuring-your-webapp
One more (in my opinion) convinient way is to set this property using a jetty.xml like so:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure>
<Call name="setProperty" class="java.lang.System">
<Arg>org.eclipse.jetty.annotations.maxWait</Arg>
<Arg>120</Arg>
</Call>
</Configure>
This way you can omit the commandline args
The most simple way is adding the system property in pom.xml
https://www.eclipse.org/jetty/documentation/9.4.x/jetty-maven-plugin.html#setting-system-properties
This message means scanning annotation took time more than its being configured thus timeout so this can be fixed either by increasing the timeout period (Dorg.eclipse.jetty.annotations.maxWait=120) or by deleting the tmp / webapp-tmp from target which reduces its scan time.
The property (-Dorg.eclipse.jetty.annotations.maxWait=120) can be added to start.ini so it works for all the webapps in your app base.
I get below error when i package (jar) and run my defaulthadoopjob.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/util/Tool
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.Tool
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 12 more
Could not find the main class: DefaultHadoopJobDriver. Program will exit.
Commands used to build Jar.
# jar -cvf dhj.jar
# hadoop -jar dhj.jar DefaultHadoopJobDriver
The above command gave me error "Failed to load Main-Class manifest attribute from dhj.jar"
rebuilt jar with manifest using below command
jar -cvfe dhj.jar DefaultHadoopJobDriver .
hadoop -jar dhj.jar DefaultHadoopJobDriver -- This returned the original error message that I reported above.
My Hadoop job has single class "DefaultHoopJobDrive" that extends Configures and implements Tool, and run method as only code for Job creation and inputpath,outpurpath set.
Aslo I.m using new API.
I'm running hadoop 1.2.1 and the Job works fine from eclipse.
This might be something to do with the classpath. Please help.
For executing that jar you don't have to give hadoop -jar. The command is like so:
hadoop jar <jar> [mainClass] args...
If this jar again gets the java.lang.ClassNotFoundException exception then can you use the:
hadoop classpath
command to see whether hadoop-core-1.2.1.jar is present in your hadoop installations classpath?
FYI, and if it's not present in this list you have to add this jar to the hadoop lib directory.
Try building your hadoop java code with all hadoop jars available in hadoop's lib folder.
In this case you are missing the hadoop util class which is present in the hadoop-core-*.jar
Classpath can be specified while building the code within the jar or you can externalise it using the following command
hadoop -cp <path_containing_hadoop_jars> -jar <jar_name>
In case anyone is using Maven and lands here: Dependency issues can be resolved by asking Maven to include any jars it requires within the parent project's jar itself. That way, Hadoop doesn't have to look elsewhere for dependencies -- it can find them right there itself. Here's how to do this:
1. Go to pom.xml
Add a section to your <project> tag, called <build>
Add the following to your <build></build> section:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.7.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<exclude>org.slf4j:slf4j-api</exclude>
<exclude>junit:junit</exclude>
<exclude>jmock:jmock</exclude>
<exclude>xml-apis:xml-apis</exclude>
<exclude>org.testng:testng</exclude>
<exclude>org.mortbay.jetty:jetty</exclude>
<exclude>org.mortbay.jetty:jetty-util</exclude>
<exclude>org.mortbay.jetty:servlet-api-2.5</exclude>
<exclude>tomcat:jasper-runtime</exclude>
<exclude>tomcat:jasper-compiler</exclude>
<exclude>org.apache.hadoop:hadoop-core</exclude>
<exclude>org.apache.mahout:mahout-math</exclude>
<exclude>commons-logging:commons-logging</exclude>
<exclude>org.mortbay.jetty:jsp-api-2.1</exclude>
<exclude>org.mortbay.jetty:jsp-2.1</exclude>
<exclude>org.eclipse.jdt:core</exclude>
<exclude>ant:ant</exclude>
<exclude>org.apache.hadoop:avro</exclude>
<exclude>jline:jline</exclude>
<exclude>log4j:log4j</exclude>
<exclude>org.yaml:snakeyaml</exclude>
<exclude>javax.ws.rs:jsr311-api</exclude>
<exclude>org.slf4j:jcl-over-slf4j</exclude>
<exclude>javax.servlet:servlet-api</exclude>
</excludes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/jruby.home</exclude>
<exclude>META-INF/license</exclude>
<exclude>META-INF/maven</exclude>
<exclude>META-INF/services</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
Now build your project again, and run with the normal hadoop java my.jar ... command. It shouldn't cry about dependencies now. Hope this helps!
I'm trying to deploy axis2 webservices in weblogic server using maven. The project has maven modules and one of that is a war that i have defined the axis servlet in. The wsdl was there, so i used wsdl2code plugin to generate the xmlbean and schema and put that in a jar module. Structure is as below.
--lv-ear (ear with dependency on war)
|
--lv-ws
|
--lv-ws-ccid (jar module with skeleton and xmlbeans)
|
--lv-ws-ecs (jar module with skeleton and xmlbeans)
|
--lv-ws-web (war module with dep on jar modules)
|
--WEB-INF
|
--conf/axis2.xml
--services/ccid/services.xml
I built and deployed the ear to weblogic domain. The war was deployed successfully as part of ear and services were deployed. I am able to access wsdl files. When I tried to call the service, i got the below ClassNotFoundException for a schema file.
Caused by: java.lang.ClassNotFoundException: schemaorg_apache_xmlbeans.system.s2104B1E6E09A2A85656B3E630BA151C1.TypeSystemHolder
I saw that the random string in that path differed fo me. So I tried to call again and got below NoClassDefFoundError, which persists even after I tried with different approaches.
java.lang.NoClassDefFoundError: Could not initialize class com.lv.ws.ccid.xmlbean.InputDocument
at com.lv.ws.ccid.xmlbean.InputDocument$Factory.parse(InputDocument.java:463)
at com.lv.ws.ccid.CcidMessageReceiverInOut.fromOM(CcidMessageReceiverInOut.java:332)
at com.lv.ws.ccid.CcidMessageReceiverInOut.invokeBusinessLogic(CcidMessageReceiverInOut.java:46)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:173)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:144)
I searched for this and found something that told to configure app server for axis2 based on http://axis.apache.org/axis2/java/core/docs/app_server.html . When I tried it I got below error.
weblogic.xml.stax.XmlStreamInputFactory can not be cast to javax.xml.stream.XmlInputFactory
After discarding that configuration, I did some other possible deployments by having the webservice skeleton and xmlbean files in an aar and put the aar inside WEB-INF/services. I also tried putting Class-Path entry in MANIFEST.MF in ear / war for the jar files, to no avail. Still I got the same NoClassDefFoundError. Can you please give me suggestions on fixing that?
Fixed it now. This was due to my lack of experience with Axis. Issue was that, I had the generated schema and xmlbean files moved to src folder and then just tried to use normal jar function and dependency to deploy.
Now, I removed them from src folder and use wsdl2code and axis2-aar plugins to generate the xmlbean and schema files dynamically and then package them in aar. Then I deployed the aar to webapp and it worked fine. I have listed the plugin configuration inside <build> below.
<plugins>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.5.4</version>
<executions>
<execution>
<id>ccid-ws</id>
<goals>
<goal>wsdl2code</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>com.lv.ws.ccid</packageName>
<wsdlFile>${basedir}/src/main/resources/META-INF/ccid.wsdl</wsdlFile>
<databindingName>xmlbeans</databindingName>
<syncMode>sync</syncMode>
<unpackClasses>true</unpackClasses>
<namespaceToPackages>https://mdm.com/portal/ws/services/ccid=com.lv.ws.ccid.xmlbean</namespaceToPackages>
<outputDirectory>${basedir}/target/generated-sources</outputDirectory> <generateServerSide>false</generateServerSide>
<generateServicesXml>true</generateServicesXml>
<skipWSDL>true</skipWSDL>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-aar-maven-plugin</artifactId>
<version>1.6.2</version>
<extensions>true</extensions>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>aar</goal>
</goals>
</execution>
</executions>
<configuration>
<aarName>ccid</aarName>
<includeDependencies>false</includeDependencies>
<outputDirectory>${project.build.directory}/aar</outputDirectory>
</configuration>
</plugin>
</plugins>
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.
Following scenario:
I'm using JavaFX, bundled in JDK 1.7
I need both client runtimes: Desktop (jar) and Applet (jnlp inside the browser)
I have a maven project set up for the project
I have a parent pom and different sub modules
I need my client to communicate with a web service, that for I'v chosen CXF as framework (I need to be able to switch web services on runtime) for connecting to the web service
The 'connect to the web service stuff' is an own maven sub module called wsConnector
Here is some more environment information and my pom snippets:
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: "windows 7", version: "6.1", arch: "amd64", family: "windows"
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.
relevant properties from the parent pom.xml:
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
...
</properties>
sub module pom.xml:
<properties>
<cxf.version>2.6.2</cxf.version>
</properties>
<dependencies>
<dependency>
... // some other sub modules
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>tools</artifactId>
<version>${maven.compiler.source}]</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
If I run mvn clean package, 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 tools.jar, too.
If I have a look in the JNLP file, I find the entry:
<jar href="tools.jar" size="15226565" download="eager" />
Now my problem is: if I run the client with java -jar client.jar, everything works. But if I call the HTML / JNLP file, i get a ClassNotFoundException, 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.
Here is the stacktrace:
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.<init>(WebServiceInformationPanel.java:45)
at com.multiguide.view.administration.WebServiceInformationPanel$$FastClassByGuice$$da5f387e.newInstance(<generated>)
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
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.
Note besides: I think it doesn't matter here right now, but as I'm using guice, of course my JNLP file has the
<security>
</all-permissions>
</security>
flag.
Has anyone of you experiences with that? Maybe I really just miss a thing, but any help (as always ;) ) is highly appreciated :)
finally I got the tools.jar in the classpath. I figured out it was missing in the manifest of my jar-file I'm delivering and which contains my client application.
As this is a JavaFX application, I needed to add the tools.jar dependency within the classpath tag of the configuration of the manifest file of the client sub module:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
...
<Class-Path>jfxrt.jar tools.jar</Class-Path>
</manifestEntries>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
After having tools.jar in the classpath, CXF tries to call the java compiler, see the error message:
org.apache.cxf.common.jaxb.JAXBUtils logGeneratedClassNames
INFO: Created classes: <list of my generated JAVA files from the wsdl file here>
[ERROR] IOException during exec() of compiler "javac". Check your path environment variable.
Okt 23, 2012 3:46:20 PM org.apache.cxf.endpoint.dynamic.DynamicClientFactory createClient
SEVERE: Could not compile java files for <url to wsdl file here>.
So this means for me that I would need to require having a JDK running and set up on a client machine. If I would serve the javac too (just a thought play don't blame me :) ), this would mean that I'd need to execute something on the client machine, which is a no-go for me.
That for, I will find an alternative solution for what I initially wanted (solution will be outsourcing the generate-ws-accessing-classes).
Though, for the initial question of how to integrate tools.jar in the classpath, what I've written above solved the problem for me.
I'm trying to deploy to a remote Tomcat7 with Cargo from Maven over https.
I've set up manager-script role and I've succeeded so far as to have been able to undeploy an app remotely.
What I have looks like this:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.1.2</version>
<configuration>
<container>
<containerId>tomcat7x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.remote.uri>https://xxx/manager/text</cargo.remote.uri>
<cargo.remote.username>${tomcat.username}</cargo.remote.username>
<cargo.remote.password>${tomcat.password}</cargo.remote.password>
</properties>
</configuration>
<deployer>
<type>remote</type>
<deployables>
<deployable>
<groupId>mycomp</groupId>
<artifactId>myartifact</artifactId>
<type>war</type>
<properties>
<context>/</context>
</properties>
</deployable>
</deployables>
</deployer>
</configuration>
</plugin>
Well, I know the credentials and everything is setup correctly, and I have used the new /text interface and I have been able to undeploy an existing app. But when trying to run deploy:
mvn cargo:deployer-deploy -e
I get an error with root cause:
Caused by: java.io.IOException: Error writing request body to server
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:2809)
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:2792)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.pipe(TomcatManager.java:605)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:501)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:569)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:273)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:256)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:240)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:101)
... 25 more
I get it quite immediately so it can't be a timeout.
Can the file be to large? It's a 60 MB war. I made sure my nginx allows bigger:
client_max_body_size 200M;
I also added multipart config to the text manager in the manager webapps web.xml like this:
servlet>
Manager
org.apache.catalina.manager.ManagerServlet
debug
2
<multipart-config>
<max-file-size>209715200</max-file-size>
<max-request-size>209715200</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>
http://nexnet.wordpress.com/2011/04/27/large-war-file-cannot-be-deployed-in-tomcat-7/
I love Maven in many ways, but the error reporting is really terrible. Any help highly appreciated.
I was bitten by this error recently, when I tried to cargo:deploy an artifact. Usually we stop, clean and start the webapps directory before deploying, but this time I noticed that one artifact was not removed.
After switching to cargo:redeploy the error was solved.
I ran into this same error message when deploying to a tomcat 8 server using the ant deploy task. The issue in my case was that I was running out of space on the server. Checking tomcat's manager log is what clued me in:
10-Jul-2014 10:15:38.065 INFO [http-nio-8080-exec-2] org.apache.catalina.core.ApplicationContext.log Manager: deploy: Deploying web application '/abc_beta'
10-Jul-2014 10:15:38.065 INFO [http-nio-8080-exec-2] org.apache.catalina.core.ApplicationContext.log Manager: Uploading WAR file to /usr/share/apache-tomcat-8.0.9/webapps/abc_beta.war
10-Jul-2014 10:15:57.962 SEVERE [http-nio-8080-exec-2] org.apache.catalina.core.ApplicationContext.log Manager: managerServlet.check[/abc_beta]
java.io.IOException: No space left on device
... stacktrace ...
I don't remember if or how I solved this, but as rascio has the same problem, I'll post a an idea. Maybe it's the wagon-extension for ssl that's needed:
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.2</version>
</extension>
</extensions>
Wild guess though. I think you didn't need it before Maven 3.0.
Another reason for this exception that we stumbled upon suddenly on monday, when deployment jobs on our Jenkins instance using the cargo plugin plugin stopped working. Not all of them, but some. The main difference was a a custom settings.xml in the jobs for a Nexus repository to download deployables from.
The successful deployment jobs had it configured like described in https://support.sonatype.com/entries/20943003-configure-maven-to-download-from-nexus, the failed ones were missing the repository and pluginRepository
I'm still not sure why the behavior changed at one point. Any tipps?