We have been working in jboss-fuse-6.2.1.redhat-084 with camel version 2.15.1.
I need use camel-protobuf 2.15.1 (dependency to protobuf-java 2.6.1) in the route to transform messages. Meanwhile, the proto messages are compiled with protobuf-java 3.0.
The bundle manifest includes:
Import-Package: org.apache.camel.dataformat.protobuf;version=" 2.15.0.3", com.google.protobuf;version="[3.0.0,3.1.0)"......
In this case, I get the following error message:
Uses constraint violation. Unable to resolve resource esb-route [esb-route/4.0.0] because it is exposed to package 'com.google.protobuf' from resources com.google.protobuf [com.google.protobuf/3.0.0] and com.google.protobuf [com.google.protobuf/2.6.1] via two dependency chains.
Chain 1:
esb-route [esb-route/4.0.0]
import: (&(osgi.wiring.package=com.google.protobuf)(version>=3.0.0)(!(version>=3.1.0)))
|
export: osgi.wiring.package: com.google.protobuf
com.google.protobuf [com.google.protobuf/3.0.0]
Chain 2:
esb-route [esb-route/4.0.0]
import: (&(osgi.wiring.package=org.apache.camel.dataformat.protobuf)(version>=2.15.0)(!(version>=3.0.0)))
|
export: osgi.wiring.package=org.apache.camel.dataformat.protobuf; uses:=com.google.protobuf
org.apache.camel.camel-protobuf [org.apache.camel.camel-protobuf/2.15.1.redhat-621084]
import: (&(osgi.wiring.package=com.google.protobuf)(version>=2.6.0)(!(version>=3.0.0)))
|
export: osgi.wiring.package: com.google.protobuf
com.google.protobuf [com.google.protobuf/2.6.1]
How can I configure my bundle so that the imported camel-protobuf doesn't use the protobuf-java 2.6.0 but 3.0?
Related
I am trying to upgrade camel from 2 to 3. I had previously had camel-quartz2 from camel 2 included in my pom.xml, but because quartz2 is apparently called quartz now, I have added this to my pom.xml:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-quartz</artifactId>
<version>3.17.0</version>
</dependency>
I removed quartz2.
The problem is that I now receive this error.
Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'startDelayedSeconds' of bean class [org.apache.camel.component.quartz.QuartzComponent]: Bean property 'startDelayedSeconds' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
I looked and saw that the the StartDelayedSeconds method is not part of quartz as it was with quartz2. Does this mean that they are really not the same? If this is the case, then why is the newest version of quartz2 so far behind the newest version of quartz. Is there some sort of workaround that I could do, or some part of quartz that I should use?
From the Came 3 migration guide:
The quartz2 component has been renamed to quartz, and it’s corresponding component package from org.apache.camel.component.quartz2 to org.apache.camel.component.quartz. The supported scheme is now quartz.
Source: https://camel.apache.org/manual/camel-3-migration-guide.html
When I run command mvn dependency:tree with project that contains camel-quartz dependency I get the following:
[INFO] +- org.apache.camel:camel-quartz:jar:3.4.4:compile
[INFO] | +- org.quartz-scheduler:quartz:jar:2.3.2:compile
[INFO] | | +- com.mchange:mchange-commons-java:jar:0.2.15:compile
[INFO] | | \- com.zaxxer:HikariCP-java7:jar:2.4.13:compile
[INFO] | \- com.mchange:c3p0:jar:0.9.5.5:compile
Based on that I would say its safe to assume that camel-quartz in camel 3.x uses quartz scheduler version 2.x. The option StartDelayedSeconds has likely been moved or changed during one of the major or minor version changes.
A lot of components have gone through some changes to use more up to date libraries and to make them easier to use or just consistent with other components.
[Edit] Regarding the StartDelayedSeconds option found this from one of the many Apache Camel upgrade guides.
UPGRADING CAMEL 3.14 TO 3.15
Removed the option startDelaySeconds as this does not work correctly and causes problems if in use.
Source: Upgrading camel 3.14 TO 3.15
I'm trying to use the code below.
import com.microsoft.azure.sqldb.spark.config.Config
import com.microsoft.azure.sqldb.spark.connect._
// Aquire a DataFrame collection (val collection)
val config = Config(Map(
"url" -> "mysqlserver.database.windows.net",
"databaseName" -> "MyDatabase",
"dbTable" -> "dbo.Clients"
"user" -> "username",
"password" -> "*********"
))
import org.apache.spark.sql.SaveMode
collection.write.mode(SaveMode.Append).sqlDB(config)
The script is from this link.
https://github.com/Azure/azure-sqldb-spark
I'm running this in a databricks environment. I'm getting these errors:
command-836397363127942:5: error: object sqlDB is not a member of package com.microsoft.azure
import com.microsoft.azure.sqlDB.spark.connect._
^
command-836397363127942:4: error: object sqlDB is not a member of package com.microsoft.azure
import com.microsoft.azure.sqlDB.spark.config.Config
^
command-836397363127942:7: error: not found: value Config
val bulkCopyConfig = Config(Map(
^
command-836397363127942:18: error: value sqlDB is not a member of org.apache.spark.sql.DataFrameWriter[org.apache.spark.sql.Row]
df.write.mode(SaveMode.Append).sqlDB(bulkCopyConfig)
I'm guessing that some kind of library is not installed correctly. I Googled for an answer, but didn't find anything useful. Any idea how to make this work? Thanks.
If you are getting the sqldb error means all other support libraries already imported to your notebook and only the latest JAR with dependencies are missing.
As per the repro, I got the same error message as shown above:
After bit of research, I had found that you will experience this error due to missing JAR with dependencies.
To resolve this issue, you need to download the JAR file from here: https://search.maven.org/artifact/com.microsoft.azure/azure-sqldb-spark/1.0.2/jar
After downloaded the jar file, upload the JAR library into the cluster and install it.
Note: After installing both the libraries, make sure to restart the cluster.
Now, you will be able to run the command successfully.
I think you have missed the library
If your using Maven Build Add the following library in pom.xml
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-sqldb-spark</artifactId>
<version>1.0.2</version>
</dependency>
If your using SBT Build Add the following library in build.sbt
libraryDependencies += "com.microsoft.azure" % "azure-sqldb-spark" % "1.0.2"
Have you imported and installed the library in DataBricks?
I found it easiest to import the library using Maven. See this answer: How to install a library on a databricks cluster using some command in the notebook?
Note: You need to install the Library on your cluster and then restart the cluster before you can use it.
I'm trying to install hazelcast-all-3.6.5 version in Jboss Fuse 6.2.1 server (Fabric Managed). Upon installation it throws the following error.
Unable to update agent org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement [root]
osgi.identity; osgi.identity=appid1-hazelcast; type=karaf.feature; version=0
[caused by: Unable to resolve appid1-hazelcast/3.0.1.release: missing requirement [appid1-hazelcast/3.0.1.release]
osgi.identity; osgi.identity=com.hazelcast; type=osgi.bundle; version="[3.6.5,3.6.5]"; resolution:=mandatory
[caused by: Unable to resolve com.hazelcast/3.6.5: missing requirement [com.hazelcast/3.6.5]
osgi.wiring.package; filter:="(osgi.wiring.package=sun.misc)"]]
Tried installing fragment bundle to expose sun.misc package but got the following error "Error: Resource has no uri".
Fragment bundle : mvn:com.diffplug.osgi/com.diffplug.osgi.extension.sun.misc/0.0.0
2017-03-16 18:02:22,814 | INFO | 2.0.1-1-thread-1 | Agent | 72 - io.fabric8.fabric-agent - 1.2.0.redhat-621166 | null
2017-03-16 18:02:22,814 | ERROR | 2.0.1-1-thread-1 | DeploymentAgent | 72 - io.fabric8.fabric-agent - 1.2.0.redhat-621166 | Unable to update agent
java.lang.IllegalStateException: Resource has no uri
at io.fabric8.agent.service.Deployer.getBundleInputStream(Deployer.java:1466)[72:io.fabric8.fabric-agent:1.2.0.redhat-621166]
at io.fabric8.agent.service.Deployer.deploy(Deployer.java:812)[72:io.fabric8.fabric-agent:1.2.0.redhat-621166]
at io.fabric8.agent.service.Agent.provision(Agent.java:366)[72:io.fabric8.fabric-agent:1.2.0.redhat-621166]
at io.fabric8.agent.service.Agent.provision(Agent.java:199)[72:io.fabric8.fabric-agent:1.2.0.redhat-621166]
at io.fabric8.agent.DeploymentAgent.doUpdate(DeploymentAgent.java:733)[72:io.fabric8.fabric-agent:1.2.0.redhat-621166]
at io.fabric8.agent.DeploymentAgent$4.run(DeploymentAgent.java:289)[72:io.fabric8.fabric-agent:1.2.0.redhat-621166]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_55]
at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_55]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_55]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_55]
at java.lang.Thread.run(Thread.java:745)[:1.7.0_55]
Note: The same approach works fine in Fuse 6.1.0 version (both standalone and fabric).
You need to activate access to sun.misc.Unsafe package in jboss. Normally the OSGi framework has some configuration where you can enable packages from the system classloader into bundles (boot class delegation). Not sure though how it exactly works in fabric8 but this older post fixed it in the past, guess the config is still the same: https://developer.jboss.org/message/884503#884503
Initially I have appended sun.misc package to "org.osgi.framework.system.packages.extra" property in etc/config.properties file, but this didn't solve the issue. (This should work 90% of the case) .
Later figured out that there was one another property named "org.osgi.framework.system.packages.extra" present in /etc/custom.properties file, adding sun.misc package to /etc/custom.properties file fixed the issue.
# Branding
org.osgi.framework.system.packages.extra = org.apache.karaf.branding,com.sun.xml.bind.v2.model.core,sun.misc
When I try to install my package
mvn:br.com.mycompany/integration/1.0.0-SNAPSHOT
I receive the follow error:
Unable to start bundle mvn:br.com.dbitech/animus/1.0.0-SNAPSHOT: Unresolved constraint in bundle Integration [359]: Unable to resolve 359.0: missing requirement [359.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.dbcp2)(version>=2.1.0)(!(version>=3.0.0)))
And when I try to install the dbcp2 feature, the follow error ocurs:
Error executing command: No feature named 'commons-dbcp2' with version '0.0.0' available
How I install an feature that don't is in the fuse index?
I found how install a dependency:
In this case I need to Wrap the bundle and your dependencies:
osgi:install -s wrap:mvn:org.apache.commons/commons-pool2/2.4.2
osgi:install -s wrap:mvn:org.apache.commons/commons-dbcp2/2.1.1
We are trying to transform data coming into a route from java objects to XML. For this we need xmlBeans and there is a dependancy on DataFormatResolver.
When we try to deploy the project, the package does not start, the status shows as GracePeriod.
In the error log we get the following message:
11:00:24,210 | ERROR | rint Extender: 1 | BlueprintContainerImpl
| 10 - org.apache.aries.blueprint - 0.3.1.fuse-70-097
| Unable to start blueprint container for bundle POC-3.0 due to
unresolved dependencies (&(dataformat=xmlBeans)
(objectClass=org.apache.camel.spi.DataFormatResolver))
We have tried to add this class in the POM file as a dependancy, but there is a duplicate class within Fuse!
Any ideas please?
You may have to repackage the jars to remove the duplicate classes. We've had to do this with the Tika jar since it included many dependencies that were stale, including XmlBeans, which conflicted with our classpath.
You need to install the camel-xmlbeans feature first.
In the Fuse ESB shell you can type
features:install camel-xmlbeans
And then after this has been installed, you can install and start your bundle.
I realize this is old, but Claus' answer is correct and should be accepted. As an addendum, note that you will probably want to create a <feature> (or several) for your business logic, and then make a top-level <feature> that is dependent on all. Something like:
(features.xml)
...
<feature name="com.yourbusiness::Application_Name">
...
<feature>camel-xmlbeans</feature>
<feature>com.yourbusiness::feature_one</feature>
<feature>com.yourbusiness::feature_two</feature>
...
</feature>
<feature name="com.yourbusiness::feature_one">
...
</feature>
<feature name="com.yourbusiness::feature_two">
...
</feature>
...
hope that provides some additional insight.
Cheers,
Hans