Activemq-camel: can not use <to uri="http://..."> - activemq

I want help to solve this problem, the following code is in bean.xml gives me error
<camelContext id="activeContext1" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="activemq:queue:ThermalMap"/>
<to uri="http://myhost:8161/Example?throwExceptionOnFailure=false"/>
</route>
</camelContext>
Error I get:
org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[http://myhost:8161/Example?throwExceptionOnFailure=false] <<< in route: Route[[From[activemq:queue:ThermalMap]] -> [To[htt://myhost... because of Failed to resolve endpoint: htt://myhost:8161/Example?throwExceptionOnFailure=false due to: Cannot auto create component: http
How can I solve this problem?
EDIT: I edit my application in eclipse. I have manually added all jar files in webcontent/WEB-INF/lib folder. Bean.xml is the one define my application. I used java to write my consumer() and processor() functions.

Perhaps you have not placed camel-http component in classpath. If you are using maven then put the dependency of camel-http component in your pom and it shall work.

Related

How do I change the default location for mule application log files?

I would like to change the log directory from MULE_HOME/logs to MULE_HOME/logs/apps. The only place I have found that refers to a file path is in MULE_HOME/conf/wrapper.conf. Editing the wrapper.logfile does allow me to relocate the mule_ee.log file, which seems to be the Mule application log, but I'd like to include Mule application logs there, too. If I create an application called FOO and deploy it to the runtime environment, it will create a file called MULE_HOME/logs/mule-app-FOO.log, but changing the location seems to be difficult short of completely messing things up writing custom log4j2 XML files.
If you have Mule version 3.6+, then it is recommended to use log4j2.xml instead of log4j.xml.... Using log4j2 you can change the path and get your application log ... a simple example would be :-
<RollingFile name="RollingFile" fileName="${env:MULE_HOME}/logs/${sys:CustomapplicationName}.log"
filePattern="${env:MULE_HOME}/logs/${sys:CustomapplicationName}-%d{yyyy-MM-dd}-%i.log"> <!-- CustomapplicationName is set at mule-app.properties or in VM argument in Run As Configure as -DCustomapplicationName=Log4j -->
<PatternLayout>
<pattern>%d{dd/MMM/yyyy HH:mm:ss,SSS}- %c{1}: %m%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="120 KB" />
</Policies>
<DefaultRolloverStrategy max="1" />
</RollingFile>
Just put this above code in your log4j2.xml in src/main/resource folder
Here in above you can see that, you have configured your path of your log files by mentioning here:-
<RollingFile name="RollingFile" fileName="${env:MULE_HOME}/logs/apps/${sys:CustomapplicationName}.log"
filePattern="${env:MULE_HOME}/logs/apps/${sys:CustomapplicationName}-%d{yyyy-MM-dd}-%i.log">
where ${sys:CustomapplicationName} is the System variable set in mule-app.properties as following :-
CustomapplicationName=yourApplicationName
Right way is to have log4j properties / xml file for FOO application and have that define the desired path for FOO application log. This way will ensure mule_ee.log is not messed up and at the same time other applications too will have their own log files which will be easy to manage and easy to introspect specific application log in case of errors / exceptions
Define location in log4j.properties file.

VelocityTools error - "java.util.MissingResourceException: Can't find bundle for base name WEB-INF.conf.resources.ss_messages, locale en_US"

I'm trying to integrate VelocityTools.ResourceTool to localize velocity template but whatever I use as the 'bundles' parameter I keep getting the following error:
java.util.MissingResourceException: Can't find bundle for base name
WEB-INF.conf.resources.ss_messages, locale en_US
I'm using VelocityTools v1.4. Here are my configurations:
Tool config /WEB-INF/conf/misc/velocity/toolbox.xml
<tool>
<key>test</key>
<scope>request</scope>
<class>org.apache.velocity.tools.generic.ResourceTool</class>
<parameter name="bundles" value="WEB-INF.conf.resources.ss_messages"/>
<parameter name="locale" value="en_US"/>
</tool>
Bundles:
\WEB-INF\conf\resources\ss_messages_bg_BG.properties
\WEB-INF\conf\resources\ss_messages_en_US.properties
The two files have simple content:
full.name=\u0421\u0442\ (for bg_BG.properties)
full.name=Joe Blow (for en_US.properties)
My Velocity template has this code:
HELLO $test.full.name
I tried different values for the name="bundles" above i.e., /WEB-INF/conf/resources/ss_messages and ./conf/resources/ss_messages (going to the root dir and then referencing the ss_messages bundle).
Also, I tried putting my ss_messages.properties bundle files in a resources folder in the root and use the value="resources" instead, but nothing seems to be working...still getting the same error message.
What am I doing wrong?! Is it that the toolbox.xml file is not in the root? I've been using successfully the toolbox.xml throughout my application up until now.
The resources should be on the classpath, and configured as such.
See the ResourceTool API docs.

Cannot find message resources under key org.apache.struts.action.MESSAGE in struts

I am getting the following error in the browser window :
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
I have included the resource file in the struts-config.xml using
And my resource file is stored as WEB-INF/classes/Application.properties file.
Well this is an old post, but my answer can help, I guess...
I personally wasted some time to make work a poject that had been developped under Tomcat 5.5 under Tomcat 7.
Note : You should name your ressource file : "ApplicationResources"...
There is several reasons why it wouldn't work, but the most common answer I found on the net was : put the line
<message-resources parameter="ApplicationResources" null="false" />
in your "struts-config.xml".
In my case, this line was already present, and this was the contrary : I had to remove it and replace at the "web.xml" file level by :
<context-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</context-param>
in the "servlet" tag.
I'm sorry that I don't have a valuable explanation for this, but my application behaves just fine now.
Does anyone has (an explanation) ?
This happened to me because I was converting my project to maven and my resources directory was not correct.
I had struts-config.xml like this:
<message-resources parameter="messages.appResources" null="false"/>
My pom.xml was like this:
<resource>
<directory>src/main/resources</directory>
</resource>
But my messages folder was in my project root. So I moved it to:
${project.basedir}/src/main/resources/messages
Make sur that you are using the same version of the DTD in the header of struts-config.xml:
I had this error when using two differents versions:
//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
and the Pb was solved once the correction made:
An XML might be missing...
In which context is your application running ? Tomcat ? JBoss ?
Try including xalan and xerces dependencies.
The following solved my problem:
In Struts Config, include:
(At the top)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
<message-resources
parameter="common.properties.Common" /> (or the path to your resources file)
This error seems to be caused by a lack of a path to message-resource in struts-config.xml
and the DOCTYPE definition at the top of the same.
you should put this line in your struts-config.xml
< message-resources parameter="ApplicationResources" null="false" key="ApplicationResources" />
In my case problem was fixed after delete all unnecessary attributes from message-resources element in struts-config.xml file. Just like following:
<message-resources parameter="ApplicationResources"/>

Axis2 embedded in my web app is not working

OKay I lost alsmost the whole day on this.
I have a webapp where I would like to add AXIS2 and start working.
I added AxisServlets in the web.xml file like -
<servlet>
<servlet-name>AxisServlet</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
I also added Services.xml file like
<service name="ReportViewerService">
<description>
This is a sample Web Service for illustrating Attachments API of Axis2
</description>
<parameter name="ServiceClass">myclass</parameter>
<operation name="getReport">
<actionMapping>urn:getReport</actionMapping>
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</operation>
</service>
The directory structure is as mentioned here
WEB-ING
| - conf
| |- axis2.xml
|-lib
| |- all libs
|-services
|-ReportViewerService
| - META-INF
|-services.xml
|- web.xml
The problem is - after all of these, the service endpoint will not come, I can not see the WSDL file http://localhost:8080/BOReportingServer/services/ReportViewerService?wsdl -- this gives an exception like -
Throwable occurred: javax.servlet.ServletException: File "/axis2-web/listSingleService.jsp" not found
Finally I am able to embed AXIS2 in my webapp.
It is as simple as mentioned in the tutorial , only thing is:
I never got the jars properly placed under WEB-INF/lib directory.
Once I started from the very beginning and removed all the unwanted jars and duplicate jars from the WEB-INF/lib directory, so started working.
I had this same symptom when trying to deploy an axis2 service with a packed (unexploded) .war file on a tomcat server.
"Throwable occurred: javax.servlet.ServletException: File "/axis2-web/listSingleService.jsp" not found"
The solution was to add the 'services.list' file to the /WEB-INF/services/ folder.
(There is also a modules.list file for the /WEB-INF/modules/ folder.)
These are just a text files listing out the service archive files in the folder.
/WEB-INF
|-modules
|-addressing-1.6.1.mar
|-...
|-modules.list
|-...
|-soapmonitor-1.6.1.mar
|-services
|-ReportViewerService.aar
|-services.list
In the .list files, contain just the names of the archive files, one entry per line.
Reference: http://axis.apache.org/axis2/java/core/docs/app_server.html
You also deployed axis2.war in your servlet container, right?
In order for Axis2 to work properly, you need to deploy it to a servlet container. A tutorial can be found here. You'll know you've done it properly when the Axis2 "Happy" page can be shown.
Once you've done that, you should be able to bundle up your service (in the structure you've described above in your question) into an .aar file and deploy it using the axis2 servlet.

Struts2 Version 2.0.x handling unknown actions

In struts2 version 2.1.x there is a new UnknownHandler that kicks in when a request arrives and the action name cannot be found.
The question is...what is the equivalent mechanism if one exists in 2.0.x versions?
I recently noticed from examining the log files that exceptions are thrown when the action name is not properly resolved and this is actually causing some problems. Is there an application wide setting for handling this?
Wildcard default or action default?
http://struts.apache.org/2.0.14/docs/action-configuration.html#ActionConfiguration-WildcardMethod
<action name="*">
<result>/{1}.jsp</result>
</action>
...
<package name="Hello" extends="action-default">
<default-action-ref name="UnderConstruction">
<action name="UnderConstruction">
<result>/UnderConstruction.jsp</result>
</action>
...