Deploying a camel project having no main method,web.xml - jms

My project consists of a spring xml(having the camel context, weblogic configuration parameters, jms related configurations) a pojo having the route for camel (whose reference we provide in spring) and an xsl.
My project has to listen on a queue, transform the message and publish it onto another queue. Everything works fine until i try to deploy it. How do i go about deploying it...i do not have a main java class...i tested my code by invoking Main of org.apache.camel.spring.Main.
I have to deploy it onto weblogic since my route consumes from weblogic queue seamlessly. How do i do it?.jar or .war or .ear? And how do i go about creating my .jar or .war or .ear? Remember i have only 3 files in my project structure and a few dependent jars

You will deploy it as a war file. I have not done this with Weblogic but the steps for Tomcat are listed below:
First make sure that all the needed jars are packaged in your war file.
Bootsrap Spring to your WAR file by adding the following to your web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
</web-app>
Add location of your Spring XML file by using the following:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/camel-context.xml</param-value>
</context-param>
Package the war with Maven i.e. run the command mvn package
Deploy the war file to the server.

Related

Deploying a RAP .war file in jetty

I created an hello-world RAP application following the eclipse tutorial. I have no problems starting it in eclipse.
Now i want to package it as a .war file with maven and deploy it inside a jetty server. That's the point where i'm already unsure if it is the right approach.
My .war file includes all RAP, equinox and maven plugins, a web.xml and a config.ini. I'm building it with Tycho but i'm open to other solutions.
config.ini:
#Product Runtime Configuration File
osgi.bundles=RapHello/BasicEntryPoint#start,\
org.eclipse.core.commands#start,\
org.eclipse.core.jobs#start,\
org.eclipse.equinox.common#start,\
org.eclipse.equinox.console#start,\
org.eclipse.equinox.ds#start,\
org.eclipse.equinox.http.registry#start,\
org.eclipse.equinox.servletbridge.extensionbundle,\
org.eclipse.equinox.http.servlet#start,\
org.eclipse.equinox.http.servletbridge#start,\
org.eclipse.equinox.registry#start,\
org.eclipse.equinox.servletbridge#start,\
org.eclipse.equinox.util#start,\
org.eclipse.osgi.services#start,\
org.eclipse.rap.jface#start,\
org.eclipse.rap.rwt#start,\
org.eclipse.rap.rwt.osgi#start,\
raphello.BasicEntryPoint#start
osgi.bundles.defaultStartLevel=4
web.xml (copied from another sample .war):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app id="WebApp">
<servlet id="bridge">
<servlet-name>equinoxbridgeservlet</servlet-name>
<display-name>Equinox Bridge Servlet</display-name>
<description>Equinox Bridge Servlet</description>
<servlet-class>org.eclipse.equinox.servletbridge.BridgeServlet</servlet-class>
<!-- Framework Controls could be useful for testing purpose, but
we disable it per default -->
<init-param>
<param-name>enableFrameworkControls</param-name>
<param-value>false</param-value>
</init-param>
<!-- Enable multi-language support for the extension registry -->
<!-- the OSGi console is useful for trouble shooting but will fill up your
appserver log quickly, so deactivate on production use. Uncomment
the -console parameter to enabled OSGi console access. -->
<init-param>
<param-name>commandline</param-name>
<param-value>-registryMultiLanguage <!-- -console --></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>equinoxbridgeservlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
When i deploy the file in my jetty server, i get no errors and it seems like the file gets picked up, but all i get are
HTTP ERROR 404
Problem accessing /hellorap. Reason:
ProxyServlet: /hellorap
i think i tried all possible paths. What i read so far is, that the path should be the file name of my .war but that doesn't work.
jetty start log:
INFO::main: Logging initialized #276ms to org.eclipse.jetty.util.log.StdErrLog
INFO:oejs.Server:main: jetty-9.4.10.v20180503; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 1.8.0_181-b13
INFO:oejw.StandardDescriptorProcessor:main: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
INFO:oejs.session:main: No SessionScavenger set, using defaults
INFO:oejs.session:main: node0 Scavenging every 600000ms
INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext#561b6512{/,file:///C:/Users/USR/AppData/Local/Temp/jetty-0.0.0.0-8081-raphello.war-_-any-511053963228532950.dir/webapp/,AVAILABLE}{webapps/raphello.war}
INFO:oejs.AbstractConnector:main: Started ServerConnector#2898ac89{HTTP/1.1,[http/1.1]}{0.0.0.0:8081}
INFO:oejs.Server:main: Started #4477ms
So the question is: What am i doing wrong? Is it even the right approach?
This answer doesn't seem to work so my error is propably at an earlier stage.

(Spring) class path resource exception java.io.FileNotFoundException

I have aded following code to my web.xml
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:com/neelamhotel/mavenwebproject5/configs/dao-context.xml
</param-value>
But I am getting error for the same as
IOException parsing XML document from class path resource [com/neelamhotel/mavenwebproject5/configs/dao-context.xml]; nested exception is java.io.FileNotFoundException: class path resource [com/neelamhotel/mavenwebproject5/configs/dao-context.xml] cannot be opened because it does not exist
Project Structure
Explorer View
I know dao-context.xml file is there. But then why it is giving an error ?
Updated Explorer view
Created WAR file view
In a Maven project, src/main/java is for Java source files. The other files are ignored by Maven.
Resources (i.e. non-Java files) that must be copied and be available in the classpath must go in src/main/resources.
Gradle uses the same conventions.

Exception running a simple websocket with Camel component on Jetty

I'm trying to run use Camel Websocket component on Jetty but cannot get rid of the following exception. I'm not sure if this a issue with Jetty running with Camel or issues with versions compatibility or something is missing in my code.
I've put the project on Github in case someone wants to give it a try.
https://github.com/soumyasd/jettycamelwebsocket
Following are the steps to run the application.
Update your Twitter credentials in this class src/main/java/demo/websocket/
$mvn clean install
$mvn jetty:run
Point your web browser (I used Google Chrome) to http://localhost:8080/index.html
java.lang.NullPointerException
at org.eclipse.jetty.websocket.WebSocketFactory.upgrade(WebSocketFactory.java:236)[jetty-websocket-8.1.9.v20130131.jar:8.1.9.v20130131]
at org.eclipse.jetty.websocket.WebSocketFactory.acceptWebSocket(WebSocketFactory.java:382)[jetty-websocket-8.1.9.v20130131.jar:8.1.9.v20130131]
at org.eclipse.jetty.websocket.WebSocketServlet.service(WebSocketServlet.java:104)[jetty-websocket-7.6.8.v20121106.jar:7.6.8.v20121106]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)[javax.servlet-3.0.0.v201112011016.jar:]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598)[jetty-servlet-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486)[jetty-servlet-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)[jetty-server-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)[jetty-servlet-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)[jetty-server-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)[jetty-server-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)[jetty-server-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.server.Server.handle(Server.java:350)[jetty-server-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)[jetty-server-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)[jetty-server-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)[jetty-server-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630)[jetty-http-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)[jetty-http-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)[jetty-server-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606)[jetty-io-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)[jetty-io-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)[jetty-util-8.1.3.v20120416.jar:8.1.9.v20130131]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)[jetty-util-8.1.3.v20120416.jar:8.1.9.v20130131]
at java.lang.Thread.run(Thread.java:680)[:1.6.0_45]
Here is my main Camel route.
package demo.websocket;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.twitter.TwitterComponent;
import org.apache.camel.component.websocket.WebsocketComponent;
public class TwitterStreamRoute extends RouteBuilder{
//put your twitter keys here to test
public final String CONSUMER_KEY = "";
public final String CONSUMER_SECRET = "";
public final String ACCESS_TOKEN = "";
public final String ACCESS_TOKEN_SECRET = "";
#Override
public void configure() throws Exception {
TwitterComponent tc = getContext().getComponent("twitter", TwitterComponent.class);
tc.setAccessToken(ACCESS_TOKEN);
tc.setAccessTokenSecret(ACCESS_TOKEN_SECRET);
tc.setConsumerKey(CONSUMER_KEY);
tc.setConsumerSecret(CONSUMER_SECRET);
fromF("twitter://streaming/filter?type=polling&delay=%s&keywords=%s", "5", "pittsburgh")
.process(new Processor() {
#Override
public void process(Exchange exchange) throws Exception {
String res = exchange.getIn().getBody().toString();
exchange.getOut().setBody(res);
}
})
.to("websocket://0.0.0.0:9292/camel-tweet?sendToAll=true");
}
}
The Camel config looks like the following:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- Here we define Camel, notice the namespace it uses -->
<camelContext xmlns="http://camel.apache.org/schema/spring" trace="true">
<routeBuilder ref="twitter-route-id" ></routeBuilder>
</camelContext>
<bean id="twitter-route-id" class="demo.websocket.TwitterStreamRoute" />
</beans>
My web.xml looks like
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<!-- your web.xml content here -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:camel-config.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<display-name>Archetype Created Web Application</display-name>
</web-app>
~
I'm using the following versions in my pom.xml. The full pom.xml is here.
<properties>
<spring.version>3.2.2.RELEASE</spring.version>
<camel.version>2.11.0</camel.version>
<jetty.version>8.1.3.v20120416</jetty.version>
</properties>
UPDATE (6-May-2013, 3:04 PM EST)
I updated the pom.xml to use Jetty 7.6.x release as suggested by Claus Ibsen.
But I'm still getting the same error. Also in this case the stackstrace have the same version numbers for WebSocketFactory and WebSocketServlet.
java.lang.NullPointerException
at org.eclipse.jetty.websocket.WebSocketFactory.upgrade(WebSocketFactory.java:236)[jetty-websocket-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.websocket.WebSocketFactory.acceptWebSocket(WebSocketFactory.java:382)[jetty-websocket-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.websocket.WebSocketServlet.service(WebSocketServlet.java:104)[jetty-websocket-7.6.8.v20121106.jar:7.6.8.v20121106]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)[javax.servlet-2.5.0.v201103041518.jar:]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:652)[jetty-servlet-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:447)[jetty-servlet-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1038)[jetty-server-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:374)[jetty-servlet-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:972)[jetty-server-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)[jetty-server-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[jetty-server-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.server.Server.handle(Server.java:363)[jetty-server-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)[jetty-server-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:920)[jetty-server-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:982)[jetty-server-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)[jetty-http-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)[jetty-http-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)[jetty-server-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)[jetty-io-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)[jetty-io-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)[jetty-util-7.6.8.v20121106.jar:7.6.8.v20121106]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)[jetty-util-7.6.8.v20121106.jar:7.6.8.v20121106]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_32]
UPDATE 2 (6-May-2013 4:06 PM EST)
As suggested by #JoakimErdfelt in the comments the Google Chrome file with request response information is here.
I don't think I've figured out the exact reason behind this error. However, I've a solution that works without major changes to the code.
I believe the problem is with the classloading for websocket related classes in Jetty and the Jetty-maven-plugin. Either my plugin in my pom.xml is not configured properly or I'm missing some entries. In any case, after trying this out for almost a day my alternative solution is as follows:
Instead of using the Jetty-maven-plugin to deploy the application I used Jetty Runner (http://wiki.eclipse.org/Jetty/Howto/Using_Jetty_Runner) to deploy the application. NOTE: Please download the version that is matches your jetty.version in your pom.xml.
For example:
$java -jar jetty-runner-7.6.8.v20121106.jar target/jettycamelwebsocket.war
After this I was able to access the websocket from my index.html without any issues.
Now if someone could explain why this doesn't work (or what's missing) from the Jetty-maven-plugin it would be really useful.
Here are a few references that I found useful. Although they are dated some of them gave me a hint that there maybe something wrong with the Jetty Maven Plugin, therefore pointing me the correct direction.
http://dev.eclipse.org/mhonarc/lists/jetty-users/msg00263.html
I faced the same exception couple of days back. The issue is null Connection object. At least for me the root cause was jetty settings. Make sure you have websocket enabled in your jetty start.ini file. Something like this -
OPTIONS=Server,jsp,resources,ext,plus,websocket
It should be enabled by default, but it wasn't in our case since somebody customized our start.ini and removed websocket support by mistake. After adding it back websocket worked like charm with Jetty 7.6.8.
The NPE on WebSocketFactory:236 is due to an attempt to upgrade without arriving in via a real Jetty HTTP connection.
The most common causes for this:
Attempting to use Jetty WebSockets on a web container that isn't jetty. (such as tomcat or jboss)
Attempting to unit test your websocket (servlet) without using a real HTTP connection (such as via a mocking library)
Try use Jetty 7.6.x as thats the version we test and used for the Apache Camel 2.11 release.

Jboss6.1 ClassNotFound in WEB/lib for listener

I use jboss6.1. When I try to deploy a web app, it say class not found when try to load spring.
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
the error is
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationListener
I put the spring in WEB/lib. Is that wrong? Or should be something else?
Thanks for the kind replies. What confuses me is I put the spring jars in my webapp's WEB/lib folder. Isn't that enough?
Following are the web.xml and the jars. ( I put all I grabbed in the dist folder of spring3.1)
But I wonder maybe is because I use jboss and there's something special in it? I google some post class loader but don't understand.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="CMDB_WS_HOST" version="3.0">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>99999999</session-timeout>
</session-config>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/beans.xml</param-value>
</context-param>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>com.inspur.cmdb.system.StartupListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
spring jars in web/lib
org.springframework.aop-3.1.0.M2.jar
org.springframework.asm-3.1.0.M2.jar
org.springframework.aspects-3.1.0.M2.jar
org.springframework.beans-3.1.0.M2.jar
org.springframework.context.support-3.1.0.M2.jar
org.springframework.context-3.1.0.M2.jar
org.springframework.core-3.1.0.M2.jar
org.springframework.expression-3.1.0.M2.jar
org.springframework.instrument.tomcat-3.1.0.M2.jar
org.springframework.instrument-3.1.0.M2.jar
org.springframework.jdbc-3.1.0.M2.jar
org.springframework.jms-3.1.0.M2.jar
org.springframework.orm-3.1.0.M2.jar
org.springframework.oxm-3.1.0.M2.jar
org.springframework.test-3.1.0.M2.jar
org.springframework.transaction-3.1.0.M2.jar
org.springframework.web.portlet-3.1.0.M2.jar
org.springframework.web.servlet-3.1.0.M2.jar
org.springframework.web.struts-3.1.0.M2.jar
org.springframework.web-3.1.0.M2.jar
Make sure your server classpath has included the Spring jar library. In Spring 3 its, spring-web.jar
check whether you have these jars in WEB/lib
commons-logging-1.1.1.jar
jstl-1.2.jar
spring-asm-3.0.3.RELEASE.jar
spring-beans-3.0.3.RELEASE.jar
spring-context-3.0.3.RELEASE.jar
spring-core-3.0.3.RELEASE.jar
spring-expression-3.0.3.RELEASE.jar
spring-web-3.0.3.RELEASE.jar
spring-webmvc-3.0.3.RELEASE.jar
It is ok with JBoss 7.It is classloading effect.
Config : /WEB-INF/jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-web PUBLIC
"-//JBoss//DTD Web Application 4.2//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
<jboss-web>
<class-loading java2ClassLoadingCompliance="false">
<loader-repository>
myapp:loader=anyUniqueName
<loader-repository-config>java2ParentDelegation=false</loader-repository-config>
</loader-repository>
</class-loading>
</jboss-web>
Otherwise
I reference here.
I have not tried with JBoss 6 yet. But, I hope, the following configuration will be helpful for JBoss 6.
NOTE:
On JBoss 6.0, to avoid the container loading the classes before the application actually starts, one needs to add a WEB-INF/jboss-scanning.xml file to the application archive - with the following content:
Config : /WEB-INF/jboss-scanning.xml
<scanning xmlns="urn:jboss:scanning:1.0"/>

How to deploy MessageBus in Liferay?

Written in Liferay Documentation 6.1 on using Message Bus,
Configuration of Message Bus is done using the following files:
WEB-INF/src/META-INF/messaging-spring.xml - Specifies your destinations, listeners, and their mappings to each other
WEB-INF/web.xml - Holds a listing of deployment descriptors for your plugin. Be sure to add messaging-spring.xml to your list of Spring configurations in this file.
How does messaging-spring.xml listed in web.xml?
I tried this
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
<context-param><param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/META-INF/messaging-spring.xml</param-value> </context-param>
</web-app>
but tomcat logged
org.apache.catalina.core.standardcontext start severe error listenerstart
And when i removed
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
tomcat logged
Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost]. has not been started
just want to try the Message Bus, and i cant invoke the listener when a send a message using
Message message = new Message();
message.put("slogan", "Procurement");
MessageBusUtil.sendMessage("inkwell/slogan", message);
I'm developing in Liferay 6.0.5 Thanks for the help

Resources