Migrating from net.sf.ehcache-1.6.2 to ehcache 3.8.1 - ehcache

I am migrating from com.springsource.net.sf.ehcache-1.6.2.jar to
<!-- https://mvnrepository.com/artifact/org.ehcache/ehcache -->
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.8.1</version>
</dependency>
In particular, I need to migrate the following configuration setting:
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="86400"
timeToLiveSeconds="86400"
overflowToDisk="true" />
So far I have this:
<cache-template name="defaultCache">
<expiry>
<ttl>86400</ttl>
</expiry>
<resources>
<heap>10000</heap>
</resources>
</cache-template>
How do I migrate the eternal, timeToIdleSeconds, and overflowToDisk settings?

Related

Datanucleus + Maven: cannot find main class SchemaTool

I am trying to make a maven project using Datanucleus as a database abstraction. However, when i try to mvn datanucleus:schema-create, i get the following error:
[ERROR] --------------------
[ERROR] Standard error from the DataNucleus tool + org.datanucleus.store.schema.SchemaTool :
[ERROR] --------------------
[ERROR] Error: Could not find or load main class org.datanucleus.store.schema.SchemaTool
The relevant parts from the pom.xml file are:
<dependencies>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>4.0.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jdo</artifactId>
<version>4.0.4</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>4.0.4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.34</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<!-- <version>3.2</version> -->
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-maven-plugin</artifactId>
<version>4.0.0-release</version>
<configuration>
<api>JDO</api>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
And the persistence.xml file is in /src/main/resources/META-INF/persistence.xml, containing the following:
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<!-- JDO tutorial "unit" -->
<persistence-unit name="Tutorial">
<class>a.b.c.MyClass</class>
<exclude-unlisted-classes />
<properties>
<property name="javax.jdo.option.PersistenceUnitName" value="Tutorial" />
<property name="javax.jdo.option.ConnectionURL" value="jdbc:mysql://localhost/mydb" />
<property name="javax.jdo.option.ConnectionDriverName"
value="com.mysql.jdbc.Driver" />
<property name="javax.jdo.option.ConnectionUserName" value="myuser" />
<property name="javax.jdo.option.ConnectionPassword" value="mypass" />
<property name="datanucleus.schema.autoCreateAll" value="true" />
<property name="datanucleus.schema.validateTables" value="true" />
<property name="datanucleus.schema.validateConstraints"
value="true" />
<property name="javax.jdo.PersistenceManagerFactoryClass"
value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory" />
</properties>
</persistence-unit>
To my untrained eye it looks like everything is in place, yet it doesn't work.
Perhaps your <scope>runtime</scope> is causing the problem, because that jar contains this class. Whether it is or not you can easily enable Maven debug --debug on the command line and look at what is in the CLASSPATH for that operation.

maven build service liferay uncompilable code

im trying to build an example code with maven liferay:build-service from an service.xml
There is simple entity company.
After code generating i have uncompilable code. I have tried another versions of maven plugins, but it didnt help.
Thanx
My pom.xml
<?xml version="1.0"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.plugins</groupId>
<artifactId>intlib-env</artifactId>
<packaging>war</packaging>
<name>intlib-env Portlet</name>
<version>1.0.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>com.liferay.maven.plugins</groupId>
<artifactId>liferay-maven-plugin</artifactId>
<version>6.1.2</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>build-css</goal>
</goals>
</execution>
</executions>
<configuration>
<autoDeployDir>D:\portal\liferay\deploy</autoDeployDir>
<appServerDeployDir>D:\portal\liferay\tomcat7\webapps</appServerDeployDir>
<appServerLibGlobalDir>D:\portal\liferay\tomcat7\lib\ext</appServerLibGlobalDir>
<appServerPortalDir>D:\portal\liferay\tomcat7\webapps\ROOT</appServerPortalDir>
<liferayVersion>6.1.2</liferayVersion>
<pluginType>portlet</pluginType>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>6.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>util-bridges</artifactId>
<version>6.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>util-taglib</artifactId>
<version>6.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>util-java</artifactId>
<version>6.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>Liferay-v6.x-Runtime-Stub</id>
<properties>
<liferay.version>6.1.2</liferay.version>
<liferay.maven.plugin.version>6.1.30.1</liferay.maven.plugin.version>
<liferay.auto.deploy.dir>D:\portal\liferay\deploy</liferay.auto.deploy.dir>
<liferay.app.server.deploy.dir>D:\portal\liferay\tomcat7\webapps</liferay.app.server.deploy.dir>
<liferay.app.server.lib.global.dir>D:\portal\liferay\tomcat7\lib\ext</liferay.app.server.lib.global.dir>
<liferay.app.server.portal.dir>D:\portal\liferay\tomcat7\webapps\ROOT</liferay.app.server.portal.dir>
</properties>
</profile>
</profiles>
</project>
and here the service.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.0.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_0_0.dtd">
<service-builder package-path="cz.sysnet.intlib.eia">
<author>EB</author>
<namespace>EIA</namespace>
<entity name="Company" local-service="true" remote-service="false">
<column name="Id" type="long" primary="true" />
<column name="ICO" type="String" />
<column name="name" type="String" />
<column name="companyId" type="long" />
<column name="groupId" type="long" />
<order by="asc">
<order-column name="name" />
</order>
<finder name="G_N" return-type="Collection">
<finder-column name="groupId" />
<finder-column name="name" />
</finder>
<finder name="GroupId" return-type="Collection">
<finder-column name="groupId" />
</finder>
<finder name="CompanyId" return-type="Collection">
<finder-column name="companyId" />
</finder>
</entity>
</service-builder>
Here are few of the errors after successfully generation of the code.
Description Resource Path Location Type
The method update(Company, boolean) in the type BasePersistence<Company> is not applicable for the arguments (Company) CompanyLocalServiceBaseImpl.java /intlib-env2/src/main/java/cz/sysnet/intlib/eia/service/base line 80 Java Problem
The method update(Company, boolean) in the type BasePersistence<Company> is not applicable for the arguments (Company) CompanyLocalServiceBaseImpl.java /intlib-env2/src/main/java/cz/sysnet/intlib/eia/service/base line 276 Java Problem
The method update(Company, boolean) in the type BasePersistence<Company> is not applicable for the arguments (Company) CompanyUtil.java /intlib-env2/src/main/java/cz/sysnet/intlib/eia/service/persistence line 89 Java Problem
The method update(Company, boolean) in the type BasePersistence<Company> is not applicable for the arguments (Company, ServiceContext) CompanyUtil.java /intlib-env2/src/main/java/cz/sysnet/intlib/eia/service/persistence line 97 Java Problem
The method setModelClass(Class<Company>) is undefined for the type CompanyPersistenceImpl CompanyPersistenceImpl.java /intlib-env2/src/main/java/cz/sysnet/intlib/eia/service/persistence line 169 Java Problem
The method setExpandoBridgeAttributes(ExpandoBridge) of type CompanyModel must override or implement a supertype method CompanyModel.java /intlib-env2/src/main/java/cz/sysnet/intlib/eia/model line 146 Java Problem
The method setExpandoBridgeAttributes(BaseModel<?>) of type CompanyModel must override or implement a supertype method CompanyModel.java /intlib-env2/src/main/java/cz/sysnet/intlib/eia/model line 143 Java Problem
The method countWithDynamicQuery(DynamicQuery) in the type BasePersistence<Company> is not applicable for the arguments (DynamicQuery, Projection) CompanyLocalServiceBaseImpl.java /intlib-env2/src/main/java/cz/sysnet/intlib/eia/service/base line 210 Java Problem
Thanx.
Company is a type that Liferay also has. Most likely ServiceBuilder generates import for Liferay's Company class, clashing with your own. Unless you want to start over, you'd have some tasks to do to get rid of all of your company declarations from the generated content of service builder - hibernate files, spring configuration and others. Search for cz.sysnet.intlib.eia.Company in your project and remove those declarations (and the Company* classes in your project), rename your entity (e.g. to Kompany, choose any other value that you like) and rebuild the services.
ServiceBuilder has a few limitations like these, after all, it's a code generator and rarely used to introduce another entity with an already existing name. You might want to add this limitation to LPS-27710 and watch that issue. It probably doesn't have the highest priority unless there's a lot of activity on there
Thanx for the response,
i had to move from the newest version apache maven 3.2.2 to the 3.1.1 and cleaned the maven files in the project.
Now its working again.

Resolving transitive dependences in Ivy from the Maven repository

I'm using ant-ivy to resolve dependencies from the maven repository. And i'm using the same ant-ivy to publish new artifacts into that repository, so i'm generating .pom file in ant too.
The generated .pom file is very simple and looks like this(PROJECT_A):
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>COMPANY</groupId>
<artifactId>PROJECT_A</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
So it just has some dependencies in compile scope and some in test scope. Now my ivy.xml file for that project(and the source of that .pom above) looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="COMPANY" module="PROJECT_A" revision="1.0" />
<configurations defaultconf="default,sources" defaultconfmapping="sources->sources;%->default">
<conf name="test" visibility="private"/>
<conf name="default" description="list of dependencies"/>
<conf name="sources" description="source files for all dependencies" />
</configurations>
<publications>
<artifact type="jar" conf="default" />
<artifact type="sources" ext="jar" m:classifier="sources" conf="sources" />
<artifact type="pom" ext="pom" conf="default" />
</publications>
<dependencies>
<!-- General -->
<dependency org="commons-collections" name="commons-collections" rev="3.2.1" transitive="false"/>
<dependency org="commons-configuration" name="commons-configuration" rev="1.7" transitive="false"/>
<dependency org="commons-lang" name="commons-lang" rev="2.6" transitive="false"/>
<dependency org="log4j" name="log4j" rev="1.2.16" transitive="false"/>
<!-- dependencies for junit testing -->
<dependency org="junit" name="junit" rev="latest.release" conf="test" />
<dependency org="org.mockito" name="mockito-all" rev="latest.release" conf="test" /> <!-- it's useful by itself, plus it has hamcrest in it which junit needs -->
</dependencies>
</ivy-module>
Again, very simple - 3 configurations, the default has all the dependencies, test is for testing dependencies and sources to publish sources.
And it all works quite well, apart of one thing - i'm declaring my dependencies as not transitive in the PROJECT_A, then when i'm pushing the pom to the repository those dependencies are listed there in the scope compile. Therefore the other project(PROJECT_B) which will have PROJECT_A as a dependency, will have all the transitive dependencies of the PROJECT_A as well, and i don't want that at all i just want those which are explicitly declared in the ivy.xml of PROJECT_A.
I've tried playing with the scopes and mappings, but it seems i really don't understand what i'm doing there as it doesn't make any sense. I would like to modify that scheme somehow so that when i include the PROJECT_A as a dependency, it'll only include the actual dependencies of the PROJECT_A declared in the ivy.xml, so transitive flag will be taken into account.
One more thing, i'm creating that .pom file like that:
<ivy:makepom ivyfile="generated-ivy.xml" pomfile="${ant.project.name}.pom" templatefile="${template.pom}" artifactPackaging="jar">
<mapping conf="default" scope="compile" />
<mapping conf="test" scope="test" />
</ivy:makepom>
Mark the dependency as <optional> to make it non-transitive.
Dirty hack, but that's maven.

JBOSS 7.0 WebProfile configure Oracle 11g Driver

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

ActiveMQ maven plugin configuration

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

Resources