小编use*_*140的帖子

SLF4J:类路径包含多个SLF4J绑定

我收到以下错误.似乎有多个日志框架绑定到sl4j.不知道如何解决这个问题.任何帮助是极大的赞赏.

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/admin/.m2/repository/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/admin/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Run Code Online (Sandbox Code Playgroud)

maven-2 slf4j

194
推荐指数
7
解决办法
28万
查看次数

在mule中实现REST API调用 - Jersey与Plain-Old-Mule-HTTP

我想确定是否使用 -

  1. 泽西(JAX-RS)具有基于HTTP的入站端点.

  2. 使用基于HTTP的入站端点,然后检查HTTP标头数据(如http.method,http.query.params,http.query.string等)以确定REST方法.即基于非泽西岛的自定义方法来实现REST.

方法#1的优点

  1. 标准:基于JAX-RS标准的方法,用于在Java中实现休息服务.

  2. 文档化很容易:生成文档非常简单,因为有许多工具使用JAX-RS注释生成文档.

方法#1的缺点

  1. 如果我们必须在Mule中使用Jersey,则Jersey方法充当有效载荷数据的传递.例-

    @POST
    @Produces(MediaType.APPLICATION_JSON)
    public String create(String jsonPayload) {
        logger.debug("Received and added data :" jasonPayload);
        return jsonPayload;
    
    Run Code Online (Sandbox Code Playgroud)

    在我们的用例中,我们必须将此数据传递到下一个流,它将其插入数据库或转发到其他Web服务.我们不想在此类中注入mule特定代码来从create方法中调用其他Mule流.我们别无选择,只能通过这种方法传递有效载荷并在骡子流中处理它.

  2. 在Jersey进程创建方法之后,它创建一个封装有效负载的Response对象.如果我们想对有效负载做一些事情,那么我们必须首先从Response对象中提取有效负载.这是一个不必要的麻烦.

有什么建议,意见,想法吗?

mule

6
推荐指数
1
解决办法
8802
查看次数

Mule 3.3.0 - 未从属性文件中解析全局属性

未从属性文件解析全局属性,因此mmc部署失败.任何想法为什么会出错?

<context:property-placeholder location="airports.properties" />
<global-property name="airportslist" value="${airportslist}" />
Run Code Online (Sandbox Code Playgroud)

获得以下异常 -

com.mulesoft.mmc.agent.v3.dto.DeploymentException: Unexpected exception parsing XML document from URL [file:/arprt/mule-esb-ee/mule-enterprise-standalone-3.3.0/apps/myapp-1.0.0-SNAPSHOT/myapp-config.xml]; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'airportslist' (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException)
        at com.mulesoft.mmc.agent.service.impl.ApplicationServiceImpl.deploy(ApplicationServiceImpl.java:245)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

airports.properties包含上述属性:

  airportslist={'SFO', 'YYZ', 'DFW'}
Run Code Online (Sandbox Code Playgroud)

mule

5
推荐指数
1
解决办法
1888
查看次数

从出站HTTP调用中删除MULE_SESSION标头

我想从传出的HTTP请求中删除mule特定的标头.我在HTTP调用中放置了以下transfomer.

<message-properties-transformer
            doc:name="Message Properties">
            <add-message-property key="Authorization" value="ffffffffff" />
            <add-message-property key="Content-Type" value="application/json" />
            <add-message-property key="Accept" value="application/json" />
            <delete-message-property key="MULE_ENCODING" />
            <delete-message-property key="MULE_SESSION" />
            <delete-message-property key="MULE_ENDPOINT" /> 
</message-properties-transformer>
Run Code Online (Sandbox Code Playgroud)

但是,以下属性仍然作为http标头出现 -

{
MULE_SESSION=rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAFWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0ceterteXZhL2xhbmcvU3RyaW5nO0wACnByb3BlcnRpZXN0AA9MamF2YS91dGlgdfgdfgdfg3JnL211bGUvYXBpL3NlY3VyaXR5L1NlY3VyaXR5Q29udGV4dDt4cAFwdAAkZDU3MWU5YmEtYTNlNC0xMWUzLWIxMjEtYmJlMWRiMDBjNTE1c3IAJWphdmEudXRpbC5Db2xsZWN0aW9ucyRTeW5jaHJvbml6ZWRNYXAbc/kJS0s5ewMAAkwAAW1xAH4AA0wABW11dGV4dAASTGphdmEvbGFuZy9PYmplY3Q7eHBzcgAkb3JnLm11bGUudXRpbC5DYXretertretreIYXNoTWFwndHZ72dFzgADAAB4cHcMP0AAAAAAABAAAAAAeHEAfgAJeHB4,     
Authorization=sHHZVtlErfzhiT4V6ecK6B, 
Host=localhost:8000, 
Content-Length=55, 
MULE_ENDPOINT=http://localhost:8000/test, 
User-Agent=Jakarta Commons-HttpClient/3.1, 
Keep-Alive=false, 
Connection=false, 
Content-Type=application/json, 
Accept=application/json, 
originatingip=20.20.20.20
}
Run Code Online (Sandbox Code Playgroud)

mule mule-studio

5
推荐指数
1
解决办法
2793
查看次数

Mule:有简单的方法将XML转换为JSON

有没有简单的方法将XML转换为JSON,而不首先将XML绑定到java对象?

就像这样做 - http://www.utilities-online.info/xmltojson/#.UrXnCvRDt0w

如果可能的话,我不想维护XML模式.

xml json mule

4
推荐指数
2
解决办法
5885
查看次数

Mule MEL 在流变量上做子串

我有一个变量 my_variable,其值为动态 URL,例如——

http://stackoverflow.com/questions/ask
Run Code Online (Sandbox Code Playgroud)

我想在这个动态 URL 上做一个子字符串来找到最后一个“/”之后的字符串,即在上面提到的 URL 的情况下,我想得到子字符串“ask”

我如何使用 MEL 来做到这一点?

mule mule-el

4
推荐指数
1
解决办法
2万
查看次数

使用MEL在Mule Flow中将Map设置为有效载荷

我正在尝试生成并设置一个映射(具有2个键值对)作为后续HTTP调用的有效负载.但是,用于创建Map的MEL表达式不起作用.

<sub-flow name="call-myservice" doc:name="call-myservice">
    <set-payload value="#[username :${my.username}, password : ${my.password}]" doc:name="Set Payload"/>
    <https:outbound-endpoint exchange-pattern="request-response" host="${myservice.Host}"  method="POST" mimeType="application/json" doc:name="My Service call" path="mypath" port="443"/>
</sub-flow>
Run Code Online (Sandbox Code Playgroud)

我按照http://www.mulesoft.org/documentation/display/current/Mule+Expression+Language+MEL上的说明进行操作

这暗示 -

MEL provides a streamlined way to access map data. 

Rather than constructing a map with a new statement, and then using its put method to populate it, you can simply write the following:

[key1 : value1, key2 : value2, . . .]
Run Code Online (Sandbox Code Playgroud)

但是,它给了我以下例外 -

ERROR 2014-02-28 15:27:51,424 [[services-proxy].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : …
Run Code Online (Sandbox Code Playgroud)

mule mule-el

3
推荐指数
1
解决办法
8563
查看次数

Java Spring Scheduled作业不起作用

我有一个应该运行预定代码的Web应用程序:

package com.myproject.daemon.jobs;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class MyDaemonJob  {

    private static final Logger log = LoggerFactory.getLogger(MyDaemonJob.class);

    @PostConstruct
    public void init() {
        log.info("MyDaemonJob is intialized " );
    }

    @Scheduled(fixedDelay = 1000)
    public void startDaemon()  {
        try {
            log.info("MyDaemonJob is running ...");
        } catch (Exception e) {
            log.error("Encountered error running scheduled job: " + e.getMessage());
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

正如我从PostConstruct日志中看到的那样,它肯定被识别为Spring bean并已初始化。尽管带有@Scheduled注释的方法应该每1秒运行一次,但是它永远不会运行。

这是应用程序上下文xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans …
Run Code Online (Sandbox Code Playgroud)

java spring scheduler

3
推荐指数
1
解决办法
2354
查看次数

Mule - 来自Jersey Component的流程返回

我有一个使用Jersey REST组件的mule流程

    <flow name="rest-api" doc:name="rest-api">
    <http:inbound-endpoint exchange-pattern="request-response"
        host="localhost" path="rest" port="8081" doc:name="HTTP" />
    <logger message="Message !!!!!!!! #[payload]" level="INFO"
        doc:name="Logger" />
    <jersey:resources doc:name="REST"> 
        <component class="com.test.api.TestAPI" />
    </jersey:resources>
    <logger message="Message $$$$$$$ #[payload]"  level="INFO" doc:name="Logger" />

</flow>
Run Code Online (Sandbox Code Playgroud)

过去的球衣组件的对象是"org.mule.module.jersey.MuleResponseWriter"类型

如何处理这个有效载荷?我需要使用该消息并在返回调用者之前对消息进行一些处理.

更新(下)

参考:http://www.mulesoft.org/documentation/display/current/Jersey+Module+Reference

发送泽西对其他流量的响应

如果您想要将您的球衣组件的请求转换或发送到下一个资源/流程,那么您需要使用

ContainerResponse cr = (ContainerResponse) message.getInvocationProperty("jersey_response");
String messageString = (String) cr.getResponse().getEntity();
message.setPayload(messageString); 
Run Code Online (Sandbox Code Playgroud)

这会将org.mule.module.jersey.MuleResponseWriter $ 1类型转换为String,您可以将其转发到下一个资源.

mule

2
推荐指数
1
解决办法
1940
查看次数

Mule - 将一个大的JSON列表拆分为多个较小的JSON列表

我有一个包含大约200个对象的json对象列表.我想将该列表拆分为较小的列表,其中每个列表每个包含最多20个对象.我想将每个子列表POST到基于HTTP的端点.

<flow name="send-to-next-step" doc:name="send-to-vm-flow">
    <vm:inbound-endpoint exchange-pattern="one-way"
        path="send-to-next-step-vm" doc:name="VM" />
    <!-- received the JSON List payload with 200 objects-->
    <!-- TODO do processing here to split the list into sub-lists and call sub-flow for each sub-list
    <flow-ref name="send-to-aggregator-sf" doc:name="Flow Reference" />
</flow>
Run Code Online (Sandbox Code Playgroud)

一种可能的方法是我编写一个迭代列表的java组件,并在迭代每个20个对象之后调用子流.有没有更好的方法来实现这一目标?

mule mule-studio mule-el

1
推荐指数
1
解决办法
2908
查看次数

建立mavenized MuleStudio项目

我在MuleStudio有一个mavenized Mule项目.当我尝试使用maven打包时,它开始从http://dev.ee.mulesource.com/repository/下载一些EE jar文件...

我的POM.xml中没有EE依赖项.

  1. 为什么maven试图下载这些依赖项?
  2. Maven只是拉pom文件(而不是相关的jar文件).为什么?

    Downloading: http://dev.ee.mulesource.com/repository/content/repositories/releas
    es/com/ibm/icu/icu4j-normalizer_transliterator/4.8.1.1/icu4j-normalizer_translit
    erator-4.8.1.1.pom
    Downloading: http://dev.ee.mulesource.com/repository/content/repositories/snapsh
    ots/com/ibm/icu/icu4j-normalizer_transliterator/4.8.1.1/icu4j-normalizer_transli
    terator-4.8.1.1.pom
    Downloading: http://dev.ee.mulesource.com/repository/content/repositories/ext-re
    leases/com/ibm/icu/icu4j-normalizer_transliterator/4.8.1.1/icu4j-normalizer_tran
    sliterator-4.8.1.1.pom
    Downloading: https://repository-lsi.forge.cloudbees.com/release/com/googlecode/s
    ardine/sardine/248/sardine-248.pom
    Downloading: http://dev.ee.mulesource.com/repository/content/repositories/releas
    es/com/googlecode/sardine/sardine/248/sardine-248.pom
    Downloading: http://dev.ee.mulesource.com/repository/content/repositories/snapsh
    ots/com/googlecode/sardine/sardine/248/sardine-248.pom
    

mule maven mule-studio

0
推荐指数
1
解决办法
1155
查看次数

标签 统计

mule ×9

mule-el ×3

mule-studio ×3

java ×1

json ×1

maven ×1

maven-2 ×1

scheduler ×1

slf4j ×1

spring ×1

xml ×1