小编Bur*_*ner的帖子

mvn包加载其他库作为Eclipse

如果我在Eclipse中运行我的项目一切都很好.但当我这样做时:

mvn clean 
mvn package
Run Code Online (Sandbox Code Playgroud)

然后开始我的项目然后它不工作.我发现了这个区别:

日食:

INFO  org.eclipse.jetty.server.Server:doStart:327 ~ jetty-9.2.13.v20150730
Run Code Online (Sandbox Code Playgroud)

mvn包:

INFO  org.eclipse.jetty.server.Server:doStart:327 ~ jetty-9.2.z-SNAPSHOT
Run Code Online (Sandbox Code Playgroud)

为什么?我能做什么,mvn package装载相同的码头版本9.2.13?

更新:

我发现了一些额外的差异:

在Eclipse中编译(WebApplicationInitializer):

org.eclipse.jetty.server.Server:doStart:327 ~ jetty-9.2.13.v20150730
org.eclipse.jetty.server.handler.ContextHandler$Context:log:2052 ~ No Spring WebApplicationInitializer types detected on classpath
Run Code Online (Sandbox Code Playgroud)

使用mvn package(ServletContainerInitializers)进行编译:

org.eclipse.jetty.server.Server:doStart:327 ~ jetty-9.2.z-SNAPSHOT
org.eclipse.jetty.annotations.AnnotationConfiguration:configure:456 ~ ServletContainerInitializers: detected. Class hierarchy: empty
Run Code Online (Sandbox Code Playgroud)

为什么mvn不使用WebApplication?

pom.xml中:

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>de.myPro.test</groupId>
    <artifactId>AllInOneBoiler</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>AllInOneBoiler</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <log4j.version>2.7</log4j.version>
        <spring.version>4.3.3.RELEASE</spring.version>
        <camel.version>2.18.3</camel.version>
        <activemq.version>5.14.5</activemq.version>
        <jolokia.version>1.3.5</jolokia.version>
        <jetty.version>9.2.13.v20150730</jetty.version>
    </properties>

    <dependencies>
        <!-- Log4J Start -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId> …
Run Code Online (Sandbox Code Playgroud)

java eclipse maven

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

ActiveMQ Jolokia API 如何获取完整的消息正文

我想编写自己的 ActiveMQ 监视器。我可以从队列中获取队列和消息。但是消息体(内容)是短的。如何获得完整的消息正文?

这是我测试过的:

得到: Always errors

http://localhost:8161/api/jolokia/exec/org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=errors/browseMessages(java.lang.String)/JMSMessageID%3D%27ID%3AW530-62766-1419849619826-0%3A15%3A1%3A1%3A1%27

http://localhost:8161/api/jolokia/exec/org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=errors/browseMessages(java.lang.String)/JMSMessageID='ID:W530-62766-1419849619826-0:15:1:1:1'
Run Code Online (Sandbox Code Playgroud)

与邮政:

http://localhost:8161/api/jolokia/?ignoreErrors=true&canonicalNaming=false
{
"type":"exec",
"mbean":"org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=errors",
"operation":"browseMessages(java.lang.String)",
"arguments":["JMSMessageID='ID:W530-62766-1419849619826-0:15:1:1:1'"],
}
Run Code Online (Sandbox Code Playgroud)

错误: java.lang.OutOfMemoryError: Java heap space

http://localhost:8161/api/jolokia/?ignoreErrors=true&canonicalNaming=false
{
"type":"exec",
"mbean":"org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=errors",
"operation":"browseMessages(java.lang.String)",
"arguments":["JMSMessageID='ID:W530-62766-1419849619826-0:15:1:1:1'"],
"path":"content"
}
Run Code Online (Sandbox Code Playgroud)

错误: java.lang.NumberFormatException : For input string: "content"

我可以工作的唯一方法是每个帖子:

http://localhost:8161/api/jolokia/?maxDepth=7&maxCollectionSize=500&ignoreErrors=true&canonicalNaming=false 
{
"type":"exec",
"mbean":"org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=errors",
"operation":"browseMessages(java.lang.String)",
"arguments":["JMSMessageID='ID:W530-62766-1419849619826-0:15:1:1:1'"],
}
Run Code Online (Sandbox Code Playgroud)

但后来我只得到前 500 个字符

感谢您的帮助

java activemq-classic jmx jolokia

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

如何打印漂亮的 Swagger / OpenAPI Spec

我们是 Swagger / Open API v2.0 的新成员。我们的第一个 API 规范已准备就绪。现在我们在打印出漂亮的规格时遇到了问题。从 UI 导出对于打印没有用。谷歌也帮不上忙。你是怎样做的?有人知道一些好工具吗?

感谢您的任何帮助

pdf swagger swagger-ui openapi

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

如何在 Camel 3.0 上添加附件

在 Camel 2.x 中,我可以向消息添加附件,例如:

exchange.getOut().addAttachment("LogFile.log.gz", new DataHandler(Base64.decodeBase64(FileContentBase64),"application/x-gzip"));
Run Code Online (Sandbox Code Playgroud)

但在 Camel 3.0 中这是不可能的。我像迁移指南所说的那样更改我的代码:

exchange.getMessage().addAttachment("LogFile.log.gz", new DataHandler(Base64.decodeBase64(FileContentBase64),"application/x-gzip"));
Run Code Online (Sandbox Code Playgroud)

但它不起作用。这也不是:

exchange.getIn().addAttachment("LogFile.log.gz", new DataHandler(Base64.decodeBase64(FileContentBase64),"application/x-gzip"));
Run Code Online (Sandbox Code Playgroud)

有一个想法,来解决这个问题。

我想通过电子邮件发送此附件。

java apache-camel apache-camel-mail

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