I have a maven web application in which I am using logback and JBoss EAP 6.1 as server. The problem is that when I deploy it on server, my logback.xml is ignored and logback's default configuration is used which prints on console instead of my log file. Logging works fine if I deploy my application on tomcat.
I have put logback.xml in src/main/resources.
Found similar question at - Logging Configuration in Logback + SL4J + JBoss EAP 6.0
and
Logback and Jboss 7 - don't work together?
but no use...
Forgot to share the solution earlier..here it is -
We need to add following lines in jboss-deployment-structure.xml
<exclusions>
<module name="org.apache.commons.logging" />
<module name="org.slf4j" />
<module name="org.slf4j.ext" />
<module name="org.slf4j.impl" />
<module name="org.apache.log4j" />
</exclusions>
So the entire file looks like -
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding
some dependencies -->
<exclusions>
<module name="org.apache.commons.logging" />
<module name="org.slf4j" />
<module name="org.slf4j.ext" />
<module name="org.slf4j.impl" />
<module name="org.apache.log4j" />
</exclusions>
</deployment>
</jboss-deployment-structure>
If you have a maven project, you can put this file at -
<project>/webapp/META-INF/jboss-deployment-structure.xml
Now logging will work fine.
First, thanks to #popeye
Climbing on to what #popeye has well defined, here are my 2 cents
Location of 'jboss-deployment-structure.xml' : src/main/webapp/WEB-INF/jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<!-- Hey Server please don't add these dependencies. I don't need them.
I have mine in my application dependencies -->
<exclusions>
<module name="org.apache.commons.logging" />
<module name="org.slf4j" />
<module name="org.slf4j.ext" />
<module name="org.slf4j.impl" />
<module name="org.apache.log4j" />
</exclusions>
<dependencies>
<module name="com.oracle" />
<module name="org.jboss.ironjacamar.jdbcadapters" slot="main" />
</dependencies>
</deployment>
</jboss-deployment-structure>
Now, logback.xml is in action. yo!
why is this needed - <module name="com.oracle" /> ?
This is the name of module of driver you mentioned in JBOSS standalone.xml
<subsystem xmlns="urn:jboss:domain:datasources:1.1">
<datasources>
<datasource><!-- your configurations --></datasource>
<drivers>
<driver name="ojdbc6-11.2.0.4" module="com.oracle">
<xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
Note that this is for JBOSS server to Database communication.
[Even if you have ojdbc6-11.2.0.4.jar in your project/lib you need this configuration ]
How did you come up with this name 'com.oracle'? Is that a standard ?
No . This is the struture of folder I created on server
Look at this SO post here - Xmlparserv2 error while application deployed in jboss, Installing Oracle ojdbc module in JBoss for Java web application 'How to create a Oracle module in JBOSS'
Also note not to confuse this one with the dependency that you might add in your project pom.xml.
ie: this one
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
<scope>provided</scope> <!-- to exclude from WEB-INF/lib -->
</dependency>
The above project dependency is needed for you to write the Java code, get it compiled,
and also during runtime, for your code to communicate to the driver.
why is this needed - <module name="org.jboss.ironjacamar.jdbcadapters" slot="main" /> ?
Otherwise you might get an error to get a jndi datasource set on JBoss in your Spring application.
So that's a dependency. Don't forget to add the jar as well in your pom.xml
<dependency>
<groupId>org.jboss.ironjacamar</groupId>
<artifactId>ironjacamar-jdbc</artifactId>
</dependency>
Related
I have two EAR (ear01-0.0.1-SNAPSHOT.ear, ear02-0.0.1-SNAPSHOT.ear) applications and both of them are useing a common library (common-0.0.1-SNAPSHOT.jar). I decided to move out that common part and add it as module to a Wildfly 14 but even with a deployment descritor I get exception during the EAR deployment:
java.lang.NoClassDefFoundError: Failed to link ki/wildfly_deps/ejbs01/EchoBean01
I used this CLI to add the new module:
module add --name=ki.wildfly_deps.common --resources=common-0.0.1-SNAPSHOT.jar
and the JAR now is in
$JBOSS_HOME/modules/ki/wildfly_deps/common/main
1. QUESTION
This JAR shouldn't be in folder
$JBOSS_HOME/modules/system/layers/base/ki/wildfly_deps/common/main
beside the other modules?
After adding the module, the module.xml look like this:
<?xml version='1.0' encoding='UTF-8'?>
<module xmlns="urn:jboss:module:1.1" name="ki.wildfly_deps.common">
<resources>
<resource-root path="common-0.0.1-SNAPSHOT.jar"/>
</resources>
</module>
The jboss-deployment-structure.xml from each EAR declares a dependency on the above common library:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<dependencies>
<module name="ki.wildfly_deps.common" />
</dependencies>
</deployment>
2. QUESTION
Should I specify the package what must be imported from the common module?
<jboss-deployment-structure
xmlns="urn:jboss:deployment-structure:1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<dependencies>
<module name="ki.wildfly_deps.common" //>
<imports>
<include path="META-INF**" />
<include path="ki.wildfly_deps.common**" />
</imports>
</module>
</dependencies>
</deployment>
I'm trying to install neo4j-jdbc-driver-3.3.1 as a module on Wildfly 11. I created the folders org/neo4j/driver/main and added the module.xml file as following:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.5" name="org.neo4j.driver">
<resources>
<resource-root path="neo4j-jdbc-driver-3.3.1.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="sun.jdk"/>
</dependencies>
</module>
I added the jar neo4j-jdbc-driver-3.3.1.jar in the same directory, but the module does not get deployed.
If I add the jar on the deployments folder it works, but I need the driver as a module.
I'm attempting to deploy the packager-01 EAR from https://github.com/dewthefifth/java-examples/tree/master/multi-ear-jms on Wildfly 8.2.1, and am receiving the following error because Wildfly is insisting on loading the hibernate-validator module out of $JBOSS_HOME/modules/org/hibernate/validator/main instead of the one located inside of my EAR.
Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor': Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.hibernate.validator.engine.ConfigurationImpl.getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider;
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:223)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
... 3 more
Note: this is a custom deployed module required by a different application deployed on the same app server. Prior to deploying the other application, which includes multiple custom hibernate modules, I was able to get the EAR to deploy.
I've attempted to exclude the validator module using the following jboss-deployment-structure (assembled out of basically adding every exclusion any google result even hinted at), but have had no luck. No matter what I do the validator being loaded is Hibernate Validator 4.2.0.Final while the validator I'm providing in my EAR is hibernate-validator-6.0.7.Final.jar.
<jboss-deployment-structure>
<!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->
<!-- This is the top level ear module, which contains all the classes in the EAR's lib folder -->
<deployment>
<exclude-subsystems>
<subsystem name="jaxrs" />
<subsystem name="resteasy" />
</exclude-subsystems>
<exclusions>
<!-- Exclude Jackson - I included my own -->
<module name="com.fasterxml.jackson.core.jackson-annotations" />
<module name="com.fasterxml.jackson.core.jackson-core" />
<module name="com.fasterxml.jackson.core.jackson-databind" />
<module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" />
<module name="org.jboss.resteasy.resteasy-jackson-provider" />
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
<module name="org.apache.xalan" />
<module name="org.apache.xerces" />
<module name="org.jboss.logging" />
<!-- Exclude Hibernate -->
<module name="org.hibernate" />
<!-- Exclude hibernate validation -->
<module name="org.jboss.resteasy.resteasy-validator-provider-11" />
<module name="org.hibernate.validator" />
<module name="javax.validation.api" />
<module name="javaee.api" />
<module name="javax.faces.api" />
</exclusions>
<!-- This allows you to define additional dependencies, it is the same as using the Dependencies: manifest attribute -->
<dependencies>
</dependencies>
</deployment>
If anybody knows which subsystem I need to exclude I'd greatly appreciate the help.
Note: I'm sharing my Wildfly 8.2.1, and even using my Wildfly 8.2.1 because those are constraints placed on me by my customer deployment site.
Update 1:
Thanks for the help so far.
I've reached the point that my new excludes list includes the following
false
<module name="org.jboss.resteasy.resteasy-jackson-provider" />
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
<module name="org.apache.xalan" />
<module name="org.apache.xerces" />
<module name="org.jboss.logging" />
<!-- Exclude Hibernate -->
<module name="org.hibernate" />
<module name="javax.persistence.api" />
<!-- Exclude hibernate validation -->
<module name="org.hibernate.validator" />
<module name="org.jboss.invocation" />
<module name="org.jboss.as.connector" />
<module name="org.jboss.as.ee" />
<module name="org.jboss.as.jpa" />
<module name="org.jboss.as.jpa.hibernate" />
<module name="javax.resource.api" />
<module name="org.jboss.as.ejb-client" />
<module name="org.jboss.as.weld" />
<module name="org.jboss.ironjacamar.impl" />
<module name="org.jboss.ironjacamar.jdbcadapters" />
<module name="org.jboss.resteasy.resteasy-jaxrs" />
<module name="org.jboss.resteasy.resteasy-validator-provider-11" />
<module name="javaee.api" />
<module name="javax.el.api" />
<module name="javax.enterprise.api" />
<module name="javax.faces.api" />
<module name="javax.persistence.api" />
<module name="javax.servlet.jsp.api" />
<module name="javax.validation.api" />
</exclusions>
<!-- This allows you to define additional dependencies, it is the same as using the Dependencies: manifest attribute -->
<dependencies>
</dependencies>
</deployment>
which I determined by turning TRACE level logging on for all JBOSS and basically adding exclusions the the first listed entry until I stopped seeing Hibernate 4.0.2 was being loaded. I haven't yet been able to run down exactly which of these were the real culperite, but we're getting somewhere.
I will add that the WAR no longer deploys, now because it's missing core jee libraries... (as you might expect). I'll update as I find time, hopefuly eventually producing the genuine (minimal) set of exclusions required for it to work.
I think you need to exclude it from all dependencies also. I'm working on 6.4EAP so it could change slightly for your version of jboss, but try it. So go to your modules jboss subdirectory and grep for org.hibernate.validator (grep -ir "org.hibernate.validator" .) if you are on linux.
That will show you result like:
./system/layers/base/org/hibernate/validator/main/module.xml:<module xmlns="urn:jboss:module:1.1" name="org.hibernate.validator">
./system/layers/base/org/jboss/as/jpa/hibernate/3/module.xml: <module name="org.hibernate.validator"/>
./system/layers/base/org/jboss/as/jpa/hibernate/4/module.xml: <module name="org.hibernate.validator"/>
./system/layers/base/org/jboss/as/jpa/main/module.xml: <module name="org.hibernate.validator"/>
./system/layers/base/org/jboss/as/ee/main/module.xml: <module name="org.hibernate.validator" optional="true"/>
./system/layers/base/org/jboss/as/connector/main/module.xml: <module name="org.hibernate.validator"/>
./system/layers/base/org/jboss/resteasy/resteasy-hibernatevalidator-provider/main/module.xml: <module name="org.hibernate.validator"/>
./system/layers/base/org/jboss/ironjacamar/impl/main/module.xml: <module name="org.hibernate.validator"/>
./system/layers/base/org/jboss/ironjacamar/jdbcadapters/main/module.xml: <module name="org.hibernate.validator"/>
Then you could know which modules you need and from which you need to exclude it. Here I'm posting my configuration...maybe it will help you
<deployment>
<exclusions>
<module name="org.apache.log4j"/>
<module name="org.apache.commons.logging"/>
<module name="org.slf4j"/>
<module name="org.jboss.logging"/>
<module name="org.hibernate"/>
<module name="org.hibernate.validator"/>
<module name="javaee.api"/>
<module name="javax.el.api"/>
<module name="javax.enterprise.api"/>
<module name="javax.faces.api"/>
<module name="javax.persistence.api"/>
<module name="javax.servlet.jsp.api"/>
<module name="javax.validation.api"/>
</exclusions>
<dependencies>
<module name="javax.annotation.api" export="true"/>
<module name="javax.ejb.api" export="true"/>
<module name="javax.interceptor.api" export="true"/>
<module name="org.jboss.modules" export="true"/>
<module name="javax.servlet.jsp.api" export="true">
<imports>
<include path="/**"/>
<exclude-set>
<path name="javax/el"/>
</exclude-set>
</imports>
</module>
<module name="javax.enterprise.api" export="true">
<imports>
<include path="/**"/>
<exclude-set>
<path name="javax/el"/>
</exclude-set>
</imports>
</module>
</dependencies>
</deployment>
<sub-deployment name="admin.war">
<exclusions>
<module name="javaee.api"/>
<module name="javax.el.api"/>
<module name="javax.enterprise.api"/>
<module name="javax.faces.api"/>
<module name="javax.persistence.api"/>
<module name="javax.servlet.jsp.api"/>
<module name="javax.validation.api"/>
<module name="org.apache.commons.logging"/>
<module name="org.apache.log4j"/>
<module name="org.jboss.logging"/>
<module name="org.hibernate"/>
<module name="org.hibernate.validator"/>
<module name="org.slf4j"/>
</exclusions>
<local-last value="true"/>
</sub-deployment>
for me worked when I removed javax/el
I ended up having some success with this on a different project/module which is available at https://github.com/dewthefifth/spring-boot-ear-skinny-war/tree/spring-boot-2.0-with-spring-legacy-with-wfcore-209-workaround.
Specifically the web0 project had luck removing the validator, but any attempt to remove it from the EAR fails.
The github link is focused on making the removal so that Spring 5+ can be used on JBOSS and Wildfly. It includes a README with detailed information on exactly which versions of Wildfly and JBOSS were tested, and a workaround for the versions of JBOSS that didn't work (it's not pretty).
I've configured JBOSS datasource with a new module:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.oracle.jdbc">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
in the folder %JBOSS_HOME%\modules\com\oracle\jdbc\main
I put in the "main" folder also the driver itself: ojdbc6.jar
Then i configure a datasource with driver:
<datasource jndi-name="java:/jdbc/MyPool" pool-name="MyPool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:oracle:thin:#my.server.com:1521:mydbname</connection-url>
<driver>oracle</driver>
<security>
<user-name>myusername</user-name>
<password>mypassword</password>
</security>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle.jdbc"><xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class></driver>
</drivers>
When I start the application server i receive the error:
New missing/unsatisfied dependencies:
service jboss.jdbc-driver.oracle (missing)
The configuration seems to be good to the documentation, may be there is problem with the version of JBOSS or Oracle Driver?
Thanks
I have a problem with using ActiveMQ in a Spring project.
I am trying to integrate the ActiveMQ maven plugin into my project to use it in integration tests.
Here my configuration:
<?xml version="1.0" encoding="UTF-8"?> <!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--> <!-- START SNIPPET: example --> <beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:cam ="http://camel.apache.org/schema/spring"
xmlns:jetty ="http://mortbay.com/schemas/jetty/1.0"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd
http://mortbay.com/schemas/jetty/1.0
http://jetty.mortbay.org/jetty.xsd"> <!-- this location for the schema doesn't work, I dont know exactly where the schema is located
xmlns:jetty ="http://mortbay.com/schemas/jetty/1.0"
http://mortbay.com/schemas/jetty/1.0
http://jetty.mortbay.org/jetty.xsd -->
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:///${activemq.base}/conf/credentials.properties</value>
</property>
</bean>
<amq:broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.base}/data">
<!-- Destination specific policies using destination names or wildcards -->
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry queue=">" memoryLimit="5mb"/>
<policyEntry topic=">" memoryLimit="5mb">
<!-- you can add other policies too such as these
<dispatchPolicy>
<strictOrderDispatchPolicy/>
</dispatchPolicy>
<subscriptionRecoveryPolicy>
<lastImageSubscriptionRecoveryPolicy/>
</subscriptionRecoveryPolicy>
-->
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<!-- Use the following to configure how ActiveMQ is exposed in JMX -->
<managementContext>
<managementContext createConnector="false"/>
</managementContext>
<!-- The store and forward broker networks ActiveMQ will listen to -->
<networkConnectors>
<!-- by default just auto discover the other brokers -->
<networkConnector name="default-nc" uri="multicast://default"/>
<!-- Example of a static configuration:
<networkConnector name="host1 and host2" uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
-->
</networkConnectors>
<persistenceAdapter>
<amqPersistenceAdapter syncOnWrite="false" directory="${activemq.base}/data" maxFileLength="20 mb"/>
</persistenceAdapter>
<!-- Use the following if you wish to configure the journal with JDBC -->
<!--
<persistenceAdapter>
<journaledJDBC dataDirectory="${activemq.base}/data" dataSource="#postgres-ds"/>
</persistenceAdapter>
-->
<!-- Or if you want to use pure JDBC without a journal -->
<!--
<persistenceAdapter>
<jdbcPersistenceAdapter dataSource="#postgres-ds"/>
</persistenceAdapter>
-->
<sslContext>
<sslContext keyStore="file:${activemq.base}/conf/broker.ks" keyStorePassword="password" trustStore="file:${activemq.base}/conf/broker.ts" trustStorePassword="password"/>
</sslContext>
<!-- The maximum about of space the broker will use before slowing down producers -->
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage limit="20 mb"/>
</memoryUsage>
<storeUsage>
<storeUsage limit="1 gb" name="foo"/>
</storeUsage>
<tempUsage>
<tempUsage limit="100 mb"/>
</tempUsage>
</systemUsage>
</systemUsage>
<!-- The transport connectors ActiveMQ will listen to -->
<transportConnectors>
<!--<transportConnector name="openwire" uri="tcp://localhost:61616" discoveryUri="multicast://default"/>-->
<!--<transportConnector name="default-nc" uri="multicast://default"/>-->
<transportConnector name="openwire" uri="tcp://localhost:61616" />
<transportConnector name="ssl" uri="ssl://localhost:61617"/>
<transportConnector name="stomp" uri="stomp://localhost:61613"/>
<transportConnector name="xmpp" uri="xmpp://localhost:61222"/>
</transportConnectors>
</amq:broker>
<!--
** Lets deploy some Enterprise Integration Patterns inside the ActiveMQ Message Broker
** For more details see
**
** http://activemq.apache.org/enterprise-integration-patterns.html
-->
<cam:camelContext id="camel">
<!-- You can use a <package> element for each root package to search for Java routes -->
<cam:package>org.foo.bar</cam:package>
<!-- You can use Spring XML syntax to define the routes here using the <route> element -->
<cam:route>
<cam:from uri="activemq:example.A"/>
<cam:to uri="activemq:example.B"/>
</cam:route>
</cam:camelContext>
<!--
** Lets configure some Camel endpoints
**
** http://activemq.apache.org/camel/components.html
-->
<!-- configure the camel activemq component to use the current broker -->
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" >
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="vm://localhost?create=false&waitForStart=10000" />
<property name="userName" value="${activemq.username}"/>
<property name="password" value="${activemq.password}"/>
</bean>
</property>
</bean>
<!-- Uncomment to create a command agent to respond to message based admin commands on the ActiveMQ.Agent topic -->
<!--
<commandAgent xmlns="http://activemq.apache.org/schema/core" brokerUrl="vm://localhost" username="${activemq.username}" password="${activemq.password}"/>
-->
<!-- An embedded servlet engine for serving up the Admin console -->
<jetty:jetty>
<connectors>
<nioConnector port="8161"/>
</connectors>
<handlers>
<webAppContext contextPath="/admin" resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true"/>
<webAppContext contextPath="/demo" resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true"/>
<webAppContext contextPath="/fileserver" resourceBase="${activemq.base}/webapps/fileserver" logUrlOnStart="true"/>
</handlers>
</jetty:jetty>
<!-- This xbean configuration file supports all the standard spring xml configuration options -->
</beans>
The problem I have is using the jetty Namespace.
The schema cannot be found and downloaded: http://jetty.mortbay.org/jetty.xsd
Here a link from Apache ActiveMQ:
http://activemq.apache.org/complex-single-broker-configuration-stomp-only.html
There is not specified any location for this schema.
The ActiveMQ starts without having the schema location but if I use a schema validator like in Eclipse it tells me that I have an error in the file and the schema location cannot be found.
Any idea where I can find the schema for the jetty element ?
I ran into this problem too and I lost a whole hour to find a solution.
Essentially the example in the documentation is outdated.
The dependencies required to enable jetty with activemq-maven-plugin are as follows:
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-xbean</artifactId>
<version>6.1.25</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all-server</artifactId>
<version>7.6.7.v20120910</version>
</dependency>
Following is the complete configuration of the activemq-maven-plugin:
<plugin>
<groupId>org.apache.activemq.tooling</groupId>
<artifactId>activemq-maven-plugin</artifactId>
<version>5.8.0</version>
<configuration>
<configUri>${configUri}</configUri>
<fork>false</fork>
<systemProperties>
<property>
<name>javax.net.ssl.keyStorePassword</name>
<value>password</value>
</property>
<property>
<name>org.apache.activemq.default.directory.prefix</name>
<value>./target/</value>
</property>
</systemProperties>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-spring</artifactId>
<version>5.8.0</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-xbean</artifactId>
<version>6.1.25</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all-server</artifactId>
<version>7.6.7.v20120910</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-leveldb-store</artifactId>
<version>5.8.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>start-activemq</id>
<goals>
<goal>run</goal>
</goals>
<phase>pre-integration-test</phase>
</execution>
</executions>
</plugin>
Then to enable jetty is enough to import the jetty configuration file into the activemq the configuration file.
The following snippet is taken from the file ${ACTIVEMQ_HOME}/conf/activemq.xml in the ActiveMQ latest release at the time of this writing (5.8.0):
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<!--
The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">
...
</broker>
<!--
Enable web consoles, REST and Ajax APIs and demos
Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
-->
<import resource="jetty.xml"/>
</beans>
Cheers,
Domenico