我尝试将我的webapp部署为tomcat服务。我关注此链接https://github.com/ddossot/mule-in-action/tree/mule-3/chapter07/web-application 以下是我的web.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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">
<display-name>salesforce</display-name>
<description>salesforce to ftp</description>
<context-param>
<param-name>org.mule.config</param-name>
<param-value>javatest.xml</param-value>
</context-param>
<listener>
<listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class>
</listener>
<servlet>
<servlet-name>muleServlet</servlet-name>
<servlet-class>org.mule.transport.servlet.MuleRESTReceiverServlet</servlet-class>
<!-- Responses from the servlet are of type HTML by default -->
<init-param>
<param-name>org.mule.servlet.default.content.type</param-name>
<param-value>text/html</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>muleServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>testindex.jsp</welcome-file>
</welcome-file-list>
</web-app>
以下是我的javatest.xml文件
<data-mapper:config name="CSV_To_List_Transaction_c" transformationGraphPath="csv_to_list_transaction_c.grf" doc:name="CSV_To_List_Transaction"/>
<sfdc:config name="Salesforce" username="username" password="pwd" doc:name="Salesforce" securityToken="token"/>
<flow name="javatestFlow1" doc:name="javatestFlow1">
<file:inbound-endpoint path="Custom" moveToDirectory="Backup" responseTimeout="10000" doc:name="File"/>
<data-mapper:transform config-ref="CSV_To_List_Transaction_c" doc:name="CSV To List<Transaction_c>"/>
<sfdc:create-bulk config-ref="Salesforce" type="Transaction__c" doc:name="Salesforce">
<sfdc:objects ref="#[payload]"/>
</sfdc:create-bulk>
<idempotent-message-filter idExpression="#[payload.state]" doc:name="Idempotent Message"/>
<custom-transformer class="com.org.Status" doc:name="Java"/>
<catch-exception-strategy doc:name="Catch Exception Strategy">
<logger level="INFO" doc:name="Logger" message="test..."/>
</catch-exception-strategy>
</flow>
<flow name="testforceFlow1" doc:name="testforceFlow1">
<servlet:inbound-endpoint path="/download" responseTimeout="10000" doc:name="Servlet"/>
<flow-ref name="javatestFlow1" doc:name="Flow Reference"/>
</flow>
当我部署此应用时,我收到了以下错误
WARN 2015-03-05 19:25:56,228 [main] org.eclipse.jetty: Error creating bean with name 'javatestFlow1': Cannot create inner bean '(inner bean)#e93ee6' of type [com.mulesoft.mule.module.datamapper.processors.DataMapperMessageProcessor] while setting bean property 'messageProcessors' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#e93ee6': Invocation of init method failed; nested exception is java.lang.RuntimeException: com.mulesoft.datamapper.exception.DataMapperRuntimeException: The data mapping graph csv_to_list_transaction_c.grf does not exists (org.mule.api.lifecycle.InitialisationException)
org.mule.api.config.ConfigurationException: Error creating bean with name 'javatestFlow1': Cannot create inner bean '(inner bean)#e93ee6' of type [com.mulesoft.mule.module.datamapper.processors.DataMapperMessageProcessor] while setting bean property 'messageProcessors' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#e93ee6': Invocation of init method failed; nested exception is java.lang.RuntimeException: com.mulesoft.datamapper.exception.DataMapperRuntimeException: The data mapping graph csv_to_list_transaction_c.grf does not exists (org.mule.api.lifecycle.InitialisationException)
我想在tomcat服务器上部署此应用作为服务, 我怎样才能解决这个错误?请帮忙
谢谢
答案 0 :(得分:1)
例外的重要部分是:
com.mulesoft.datamapper.exception.DataMapperRuntimeException
The data mapping graph csv_to_list_transaction_c.grf does not exists
要解决此问题,请确保在WAR文件中正确打包csv_to_list_transaction_c.grf
。它应该位于类路径的根部,即在WEB-INF/classes
下面。