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
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 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
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?
Here is the problem:
I have packaged my Java application into a single jar using the Maven plugin One-Jar.
Now I want to run the application as a Unix Daemon using JSVC, i.e. Apache Commons Daemon.
I am using JSVC as follows (which works for Jars made with the Maven assembly plugin, etc):
jsvc -user $USER -home $HOME -pidfile $PID_PATH -cp $PATH_TO_ONE_JAR my.package.MyClass
The error is this:
jsvc.exec error: Cannot find daemon loader org/apache/commons/daemon/support/DaemonLoader
jsvc.exec error: Service exit with a return value of 1
Does anyone know if it is even possible to use JSVC and One-Jar together, since One-Jar uses a custom class loader? The jar runs just fine when I run java -jar my-one-jar.jar.
What can be done?
Thank you for any insight!
I had to add all jars dependencies to the classpath option from jsvc. It seems jsvc doesn't use the jars inside another jar
If you use the (poorly-documented) Maven Shade Plugin instead of One-jar (they can achieve similar results as each other), it should solve your problems. It unpacks the dependent jars and stores the class files directly in the fat Jar (rather than having jars within the jar). I have used it to create an executable jar for running under JSVC with some success.
Of course, things are seldom as simple as they sound. With the Shade plugin, you may have to do some work to relocate classes when there are conflicts in your dependency tree, or use resource transformers to handle your non-Java resource files. But hopefully not.
(Of course Mkyong.com has a guide on this)
I just exported a product that is working nicely if I hit the "Launch an Eclipse application" button. If try to execute the exported product, I get following exception on the startup:
!SESSION 2012-03-16 17:28:21.206 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=de_DE
Command-line arguments: -os linux -ws gtk -arch x86_64
!ENTRY org.eclipse.osgi 4 0 2012-03-16 17:28:22.184
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: No application id has been found.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Just before I exported the product, I performed a validation of the dependencies and it was fine. Do you have a clue what is going wrong? Thank you!
Normally, I would look for the following:
you are not exporting the exact same set of plug-ins in your product configuration as used in the launch configuration. There are no tools available for the compare.
you have a custom config.ini file that does not define the proper application for the product.
Added missing javax.xml dependency to the product configuration file:
<plugin id="com.ibm.icu"/>
<plugin id="javax.annotation"/>
<plugin id="javax.inject"/>
+<plugin id="javax.xml"/>
<plugin id="org.apache.batik.css"/>
<plugin id="org.apache.batik.util"/>
<plugin id="org.apache.batik.util.gui"/>
I had the same problem.
With E4 tooling the following steps worked for me.
Open .product file and go to Dependencies tab. Then press Add Required Plug-ins.
Then go to Overview and press Launch an Eclipse application.
Also you should do Help->Check for updates
I went to my run configurations and hit Add Required Plug-Ins one the Plug-Ins page. Made the problem go away.
I had a similar exception while launching my project. In my case, the reason was JRE version - I've set JRE 1.7 instead of 1.6 in debug configuration, and things started to work. I believe the same thing can happen, if the project was configured for OpenJDK 1.6, and the debug launches it with sun-JDK 1.6.
Review the Dependencies tab, and remove the extra plug-ins are are showing un-resolved in the Plug-ins and Fragments.
It basically means, that when launching an eclipse Program the id of the selected product in the run configuration is not preset in the set of your plugins: