我是Java / Karaf 4.0.9 / Maven / Pom / Camel的新手,我无法解决问题
# Likelihood
yact = pm.Bernoulli('yact', logit_p=top_level[top_to_bot_idx] + mid_level[mid_to_bot_idx] + intercept, observed=y)
文件中的Json部分,在这里我更改了许多Json version,但没有用。
pom.xml
在这里,我将 <dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20151123</version>
</dependency>
文件附加到了Google上。并获得same issue in GSON,但我不知道如何用felix解决该问题。
Pom.xml
java文件
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>PaxelESBNotification</groupId>
<artifactId>PaxelESBNotification</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>A Camel Blueprint Route</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
<dependencies>
<!-- Camel BOM -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
<version>2.16.5</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Camel -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-rabbitmq</artifactId>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20151123</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-mail</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-stream</artifactId>
</dependency>
<!-- Testing -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-blueprint</artifactId>
<scope>test</scope>
</dependency>
<!-- logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.7</version>
</dependency>
<!-- <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.7</version>
</dependency> -->
</dependencies>
<build>
<plugins>
<!-- compiler plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- to generate the MANIFEST.MF of the bundle -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.5.0</version>
<extensions>false</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>prepare-package</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- to include MANIFEST.MF in the bundle -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<!-- to run the example using mvn camel:run -->
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
<version>2.16.5</version>
<!-- <version>3.3.3</version> -->
</plugin>
</plugins>
</build>
</project>
错误
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.json.JSONObject;
public class EmailProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
String RequestPayload = exchange.getIn().getBody(String.class);
JSONObject obj = new JSONObject(RequestPayload);
String mail_id_to = obj.get("email").toString();
String mail_subject = obj.get("subject").toString();
String mail_content = obj.get("content").toString();
System.out.print(mail_id_to);
System.out.print(mail_subject);
System.out.print(mail_content);
}
}
我该如何解决?
答案 0 :(得分:3)
您的构建看起来很棒。据我所知,您会产生有效的捆绑包。
现在,在运行时,您必须提供项目所依赖的所有捆绑软件。该错误消息告诉您,您的软件包需要一个软件包org.json
。因此,您需要安装一个可以导出此软件包的捆绑包。
您可以尝试使用此软件包:
install -s mvn:org.json/json/20180813
您还应该考虑在构建过程中创建一个功能文件,该文件允许一次性安装包括依赖项在内的代码。