Re: Writing the servicemix.log within custom java
L.S., You probably don't have edit this configuration file at all - if you want, you can use it to e.g. create a separate log file for your own code or something, but if you just want to write to servicemix.log, everything should be good to go. Just use any of the logging frameworks you're familiar with (slf4j, log4j, commons-logging, ...) from within your own Java code. In ServiceMix, logging from all these frameworks is being handled by Pax Logging, so it will automatically end up in the servicemix.log file. Regards, Gert Vanthienen FuseSource Web: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On Mon, Jan 23, 2012 at 5:57 PM, Castyn wrote: > Is there an example of this somewhere, I am fairly new to the majority of > this. > > In the file you mentioned I see > > # Root logger > log4j.rootLogger = INFO, out, osgi:VmLogAppender > log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer > > # CONSOLE appender not used by default > log4j.appender.stdout=org.apache.log4j.ConsoleAppender > log4j.appender.stdout.layout=org.apache.log4j.PatternLayout > log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | > %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - > %X{bundle.version} | %m%n > > # File appender > log4j.appender.out=org.apache.log4j.RollingFileAppender > log4j.appender.out.layout=org.apache.log4j.PatternLayout > log4j.appender.out.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | > %-16.16t > | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | > %m%n > log4j.appender.out.file=${karaf.data}/log/servicemix.log > log4j.appender.out.append=true > log4j.appender.out.maxFileSize=100MB > log4j.appender.out.maxBackupIndex=10 > > # Sift appender > log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender > log4j.appender.sift.key=bundle.name > log4j.appender.sift.default=servicemix > log4j.appender.sift.appender=org.apache.log4j.FileAppender > log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout > log4j.appender.sift.appender.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p > | %-16.16t | %-32.32c{1} | %m%n > log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log > log4j.appender.sift.appender.append=true > log4j.logger.org.apache.camel = INFO > > > I'm not sure how to create one here as well as in my code to properly have > it use one of these appenders. Sorry for being a newb! > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Writing-the-servicemix-log-within-custom-java-tp5166486p5166698.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: Camel for Karaf 2.0
L.S., You'll probably have to strike 2.7.x as an option as well, as those have a reference to mvn:org.apache.karaf.assemblies.features/standard/2.2.0/xml/features or something like that and that's probably not going to work either. Regards, Gert Vanthienen FuseSource Web: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On Thu, Oct 27, 2011 at 10:13 PM, Gert Vanthienen wrote: > L.S., > > The closest matching Camel version would be 2.5.0, which was using Karaf > 2.1.0 at the time it was released. I suspect that 2.6.0 and 2.7.x might > install fine as well, but you would have to give those a try to be sure. > > Regards, > > Gert Vanthienen > > FuseSource > Web: http://fusesource.com > Blog: http://gertvanthienen.blogspot.com/ > > > > On Thu, Oct 27, 2011 at 9:41 PM, mattmadhavan wrote: > >> Hello, >> Due my cleint's target platform which is IBM WAS 7.1, I'm stuck with Aries >> 0.1. I want to develop and test my app in Karaf before deploying testing >> and >> deploying to WAS since Karaf increases our development productivity many >> fold. >> >> So I'm stuck with Karaf 2.0 due to Aries 0.1. >> >> I would like to deploy Camel and ActiveMQ in to Karaf 2.0. >> >> Can some one please let me know what version of Camel I can use to do so. >> >> The 2.8.0 version of Camel failed with the following error:when I do >> *features:install camel* >> >> Error executing command: No feature named 'spring' with version '[3,4)' >> available >> >> I have spring feature 3.0.5 installed! >> [installed ] [3.0.5.RELEASE ] spring >> karaf-2.0.0 >> >> >> -- >> View this message in context: >> http://camel.465427.n5.nabble.com/Camel-for-Karaf-2-0-tp4943993p4943993.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> > >
Re: Camel for Karaf 2.0
L.S., The closest matching Camel version would be 2.5.0, which was using Karaf 2.1.0 at the time it was released. I suspect that 2.6.0 and 2.7.x might install fine as well, but you would have to give those a try to be sure. Regards, Gert Vanthienen FuseSource Web: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On Thu, Oct 27, 2011 at 9:41 PM, mattmadhavan wrote: > Hello, > Due my cleint's target platform which is IBM WAS 7.1, I'm stuck with Aries > 0.1. I want to develop and test my app in Karaf before deploying testing > and > deploying to WAS since Karaf increases our development productivity many > fold. > > So I'm stuck with Karaf 2.0 due to Aries 0.1. > > I would like to deploy Camel and ActiveMQ in to Karaf 2.0. > > Can some one please let me know what version of Camel I can use to do so. > > The 2.8.0 version of Camel failed with the following error:when I do > *features:install camel* > > Error executing command: No feature named 'spring' with version '[3,4)' > available > > I have spring feature 3.0.5 installed! > [installed ] [3.0.5.RELEASE ] spring > karaf-2.0.0 > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-for-Karaf-2-0-tp4943993p4943993.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: Camel under OSGi without Spring et al.
L.S., I just raised https://issues.apache.org/jira/browse/CAMEL-4147 to keep track of this request. Regards, Gert Vanthienen FuseSource Web: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On Tue, Jun 21, 2011 at 10:09 PM, Donald Whytock wrote: > Not familiar with OSGi Declarative Services, so there will be some > guesswork on my part... > > Yes, I use OsgiCamelTracker to control the Camel-using bundles. But > it also tracks whether the CamelContext-singleton-providing service > (ContextUtil) is up. That service in turn depends on an instance of > org.apache.camel.spi.TypeConverterLoader service. > > camel-core has a BundleActivator. That activator starts a > BundleTracker that checks every bundle that launches (including > itself) to see if it contains components that need to be loaded. It > registers the components as services first, then it registers > TypeConverterLoader. > > From the example you gave, it looks like you need to create another > class that binds to TypeConverterLoader, generates and starts a > CamelContext, and then registers itself as a service; then your > CamelStarter class would bind to that service along with the > ComponentResolver(s), and fetch the CamelContext from that service. > > Can you bind to multiple services via your XML, such that your class > won't activate until all the other services are found? > > Don > > On Tue, Jun 21, 2011 at 3:21 PM, Michael Furtak wrote: >> Hi Don, >> >> I reviewed your sample code. Thanks very much for sharing that with me. If I >> understand the intent and explanation correctly, you are using your >> OsgiCamelTracker to delay the start-up of your Camel-using code until you >> can be sure that the requisite ComponentResolver services have become >> available. >> >> In my current project we use OSGi Declarative Services, so I have set up an >> OSGi component (yay, overloaded terms!) that requests a service reference >> for a ComponentResolver that can provide the Camel 'file' component. This >> should have the same effect of delaying the activation of my CamelStarter >> class until that service can be bound. Here's the DS xml: >> >> >> http://www.osgi.org/xmlns/scr/v1.1.0"; >> name="com.cra.camelsandbox.CamelStarter"> >> >> > interface="org.apache.camel.spi.ComponentResolver" name="ComponentResolver" >> policy="dynamic" target="(component=file)" unbind="unbindComponentResolver"/> >> >> >> >> And the Java class itself: >> >> public class CamelStarter >> { >> private static final transient Logger LOG = >> LoggerFactory.getLogger(CamelStarter.class); >> >> protected void activate(ComponentContext context) throws Exception >> { >> LOG.trace("activating"); >> CamelContext camelContext = new >> OsgiDefaultCamelContext(context.getBundleContext()); >> // camelContext.start(); >> } >> >> protected void deactivate(ComponentContext context) >> { >> LOG.trace("deactivating"); >> } >> >> protected void bindComponentResolver(ComponentResolver cr) >> { >> LOG.trace("Binding ComponentResolver"); >> // Ignored, since the ComponentResolver is not directly used >> } >> >> protected void unbindComponentResolver(ComponentResolver cr) >> { >> LOG.trace("Unbinding ComponentResolver"); >> // Ignored, since the ComponentResolver is not directly used >> } >> } >> >> With the third line of the activate method commented out, everything seems >> to go as planned: >> >> [21 Jun 2011 15:08:19] TRACE [Component Resolve Thread (Bundle 12)] >> CamelStarter - Binding ComponentResolver >> [21 Jun 2011 15:08:19] TRACE [Component Resolve Thread (Bundle 12)] >> CamelStarter - activating >> >> >> But if I uncomment it, I get this: >> >> java.lang.reflect.InvocationTargetException >> 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.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:210) >> at >> org.eclipse.equinox.internal.ds.model.Ser
Re: Camel under OSGi without Spring et al.
L.S., I think adding support for pure OSGi deployments (no blueprint, spring, ...) might be an interesting addition to Camel as such. It's probably not that useful in the environment we typically have in mind (ESB, enterprise applications, ...) but for other use cases it may make perfect sense to be able to have a more lightweight approach available as well. Not entirely sure what the current OsgiCamelTracker is doing, but we could e.g. (just guessing what would be useful here, so feel free to amend/comment/...) build something that tracks RouteBuilder instances in the OSGi Service Registry and then creates CamelContexts to run those, with a service property to allow configuring the CamelContext instance to add the routes to? Regards, Gert Vanthienen FuseSource Web: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On Tue, Jun 21, 2011 at 4:38 PM, Donald Whytock wrote: > Odd...I can see it there. I'll send it to you directly. > > Don > > On Tue, Jun 21, 2011 at 8:01 AM, Michael Furtak wrote: >> Hi Don, >> >> I wasn't able to find OsgiCamelTracker.java attached to your message. >> >> Thanks, >> -Mike >> >> >> >> >> >> >> >> THIS MESSAGE IS INTENDED FOR THE USE OF THE PERSON TO WHOM IT IS ADDRESSED. >> IT MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM >> DISCLOSURE UNDER APPLICABLE LAW. If you are not the intended recipient, your >> use of this message for any purpose is strictly prohibited. If you have >> received this communication in error, please delete the message and notify >> the sender so that we may correct our records. >> >> -Original Message- >> >> >> >> From: Donald Whytock [mailto:dwhyt...@gmail.com] >> Sent: Monday, June 20, 2011 4:45 PM >> To: users@camel.apache.org >> Subject: Re: Camel under OSGi without Spring et al. >> >> OsgiCamelTracker.java (attached) is a work in progress. There's a >> reference to ContextUtil; that's the service class that supplies the >> CamelContext singleton. >> >> Use it by subclassing it and implementing methods start() and stop(). >> Call setBundleContext(bundleContext) first, then startTracking(). >> >> OsgiCamelTracker.startTracking() accepts no parameters, a single >> String, or a Collection. The strings are the names of >> components that you need. It'll track instances of ComponentResolver, >> maintaining a list of what components are available and what >> components are still needed. When all the components you need are >> available, it'll call start(); when any of the components cease to be >> available, it'll call stop(). >> >> If you don't supply component names, it'll react to camel-core itself >> becoming active, which is all you need for core components like mock, >> bean and file. >> >> Use routeId() in your route definitions. Use >> camelcontext.startRoute() from the OsgiCamelTracker.start(); use >> camelcontext.stopRoute() from the OsgiCamelTracker.stop(). >> >> Be advised, you'll need to use a singleton CamelContext if you're >> using SEDA queues, because SEDA queues are local to a CamelContext >> instance. A route that consumes from a SEDA queue from one >> CamelContext instance won't see anything produced to a SEDA queue from >> a different CamelContext instance. >> >> For OsgiDefaultCamelContext... >> >>> On Mon, Jun 20, 2011 at 3:31 PM, Michael Furtak wrote: >>>> I did come across mention of this in my troubleshooting exploration. It >>>> seems to be part of a bundle called camel-core-osgi, is that right? I >>>> don't think I have it in my 2.7.2 distribution. Is it something I need to >>>> bundle myself? I also saw mention of it being private to the Spring >>>> bundle, which is what prompted my discussion about not wanting to bring in >>>> Spring. >> >> org.apache.camel.core.osgi is in camel-blueprint.jar. I split it out >> into its own .jar so as to not worry about the Blueprint dependencies. >> You'll need to modify the manifest, or make your own. >> >> Don >> >> >
Re: Missing Constraint: org.springframework.osgi.context
Stefan, That package is part of spring-dm - those are a separate set of bundles (spring-osgi-core, spring-osgi-io, ...) that need to be installed next to the default Spring libraries that you probably have (things like spring-bean, ...). Regards, Gert Vanthienen FuseSource Web: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On Wed, Jun 15, 2011 at 1:33 PM, Lorenz, Stefan wrote: > Hi, > > I just tried to upgrade from Camel 2.5 to 2.7.2. > I use Camel in an Equinox OSGI environment. > > But now I get the following error: > > !ENTRY org.apache.camel.camel-spring 4 0 2011-06-15 13:14:53.341 > !MESSAGE > !STACK 0 > org.osgi.framework.BundleException: The bundle > "org.apache.camel.camel-spring_2.7.2 [23]" could not be resolved. Reason: > Missing Constraint: Import-Package: org.springframework.osgi.context; > version="[1.2.0,2.0.0)" > > I'm not sure what I'm doing wrong. But it seems that the libraries from > springframework are not including the missing package... > Do I have to get them manually? > > Thx & regards > Stefan >
Re: IllegalArgumentException: class Tracer$$EnhancerByCGLIB$$3c5de9de is not an enhanced class
L.S., The proxy gets created when you do the in your other bundles. In an OSGi world, the bundle providing the service can get updated and the proxy allows the bundle that consumes the service to handle that scenario. For your scenario, you want to be able to replace the Tracer bundle with a newer version or to fix an issue, without having to restart all the Camel routes that use the Tracer. For the problem you're facing here, I suspect the consumer bundle might not be importing the org.apache.camel.processor.interceptor package or you actually have a final class around, however... Usually, people refer to services in the OSGi Service Registry using an interface instead of class. In your case, you could e.g. use an . Camel itself is only interested in the interface anyway, it doesn't really care about what the implementation class is, and doing this will avoid the requirement for CGLib to enhance the classes entirely because interfaces are a lot easier to proxy. Regards, Gert Vanthienen FuseSource Web: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On Tue, Feb 8, 2011 at 6:37 PM, Christian Müller wrote: > Hello List! > > My environment is ServiceMix 4.2.0-fuse-02-00 and Camel 2.2.0-fuse-02-00. > I'm not sure whether this problem is related to ServiceMix or Camel. > > In our integration solution, we developed our own Tracer, whcih extends > org.apache.camel.processor.interceptor.Tracer. We have to do this, because > we have the requirement to trace some more information as the default Tracer > in Camel trace. Our Tracer collect all the needed data and write the new > trace exchange into a queue. This tracer instance is exported as an OSGI > service, so that all other services can use this service and we don't have > to configure the tracer in each service again. It looks like following > > tracer bundle: > {code} > class="com.xxx.yyy.services.common.tracer.processor.interceptor.Tracer"> > > > value="${toTracerEndpoint}${toTracerEndpoint.options}" /> > > > ref="traceInterceptorFactory" /> > > > class="com.xxx.yyy.services.common.tracer.processor.interceptor.WlsiTraceInterceptorFactory"> > > > > class="com.xxx.yyy.services.common.tracer.processor.interceptor.ToNodePredicate"> > > > > > ^marshal\[.*\]$ > ^unmarshal\[.*\]$ > ^direct:.*$ > ^removeHeader\[.*\]$ > ^setHeader\[.*\]$ > ^choice$ > ^split$ > > > > {code} > > In each other service, we import this OSGI service and Camel detect and use > our central tracer instance: > > bundle n: > {code} > interface="org.apache.camel.processor.interceptor.Tracer" /> > {code} > > But in one of our services, we get the following exception after starting > the bundle: > > {code} > karaf@root> listException in thread "SpringOsgiExtenderThread-21" > org.springframework.beans.factory.BeanCreationException: Er > ror creating bean with name 'tracer': FactoryBean threw exception on object > creation; nested exception is org.springframework > .aop.framework.AopConfigException: Could not generate CGLIB subclass of > class [class org.apache.camel.processor.interceptor.T > racer]: Common causes of this problem include using a final class or a > non-visible class; nested exception is java.lang.Illeg > alArgumentException: class > org.apache.camel.processor.interceptor.Tracer$$EnhancerByCGLIB$$3c5de9de is > not an enhanced class > at > org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:127) > at java.security.AccessController.doPrivileged(Native Method) > at > org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistr > ySupport.java:116) > at > org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistryS > upport.java:91) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:12 > 88) > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:217) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstan
Re: Federating Endpoints between separately hosted Servicemix
L.S., You could use any kind of transport/protocol supported by Camel to connect the two boxes (HTTP, mina, ...). However, since both ServiceMix boxes already have an embedded ActiveMQ broker, the best solution is probably to configure those brokers to become a network of brokers (cfr. http://activemq.apache.org/networks-of-brokers.html). This way, you can just communicate with the local queue and ActiveMQ will store/forward the message when necessary. If you're already using JBI, you could also use the JBI cluster engine (which uses the same ActiveMQ technique to forward the JBI MessageExchange to the remote box) which allows you to send to a JBI endpoint and then the cluster engine knows whether or not to forward that. Note that JBI only allows for XML payloads though. We are planning to make that same feature availalable for the NMR as well (cfr. https://issues.apache.org/activemq/browse/SMX4NMR-193) but that's not available in the latest version of ServiceMix yet. Regards, Gert - Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ -- View this message in context: http://camel.465427.n5.nabble.com/Federating-Endpoints-between-separately-hosted-Servicemix-tp1686244p1977784.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Changing operation in ServiceMix CXF consumer --> provider
L.S., There are two ways to handle this with servicemix-camel. Option 1: the JBI operation is conveyed in the Camel Exchange in an exchange header called 'JbiOperation' (value of the JbiBinding.OPERATION constant) so you could override that header value in your route -- the value should be your operation QName. In Java code, it would look like this exchange.setProperty(JbiBinding.OPERATION, new QName("http://example.org";, "greet")) Option 2: the easier solution would be to just append the target operation to the endpoint URI, e.g. you could use http://example.org/greetingService?operation={http://example.org}greet"/> to override the incoming operation while sending the Exchange to the greetService endpoint. Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On 28 June 2010 12:18, Anto wrote: > > Hi, > > When routing from ServiceMix CXF-BC consumer to ServiceMix CXF-BC > provider, need to call a different operation of CXF provider web service. > The application uses ServiceMix and Camel JBI component. Camel is used for > routing purpose only. The route is > > CXF BC consumer > Camel > CXF BC provider > > For example > > operation: {http://example.org}hello > > changed to > > operation: {http://example.org}greet > > I tried to set operation as a header in camel route but is not working. > > > http://example.org/helloRouteBuilder"/> > > greet > > http://example.org/greetingService"/> > > > I know that this syntax is for Camel CXF endpoints. Will it work for > ServiceMix CXF components? > > Anto > -- > View this message in context: > http://camel.465427.n5.nabble.com/Changing-operation-in-ServiceMix-CXF-consumer-provider-tp511639p511639.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: 2.3-SNAPSHOT: Stream Caching again enabled by Bug Fix for Camel-2686 and CAMEL-2694 (rev 941275)?
L.S., Instead of having this option on the endpoint, wouldn't it make more sense to somehow attach that as an attribute/policy to the route or on the routebuilder? That way, people can enable/disable stream caching on that level instead of having to worry about which endpoints in their routes need special flags to enable/disable it. Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On 17 May 2010 16:19, Claus Ibsen wrote: > On Mon, May 17, 2010 at 3:58 PM, _Jens wrote: >> >> I would like to disable the feature in the DefaultHttpBinding because of >> existing code. Our code already reads the stream content into a file, so we >> do not require this feature from the Http binding. And obviously we don't >> want to write the data twice. This is why I was asking if this is the >> intended behavior for 2.3. In that case we need to implement an HTTP binding >> that bypasses that feature. >> To be honest, I think that the Jetty component should allow me to get access >> to the pure input stream that Jetty provides. Any additional streaming into >> a file is a nice feature but should be optional. But this is up to you guys. >> I simply need to make sure that we can upgrade to 2.3 as soon as it is >> released. >> > > I think the end user should *always* have the choice. And the cache > stream have bitten us before. > So I think willem should create an option which you can enable on the > endpoint to tell it to use that cached stream or not. > > >> >> willem.jiang wrote: >>> >>> Yes, from this point, you can't disable the Stream Caching. >>> But there is a difference between the Stream Caching and current Http >>> binding change. >>> If you don't enable the Stream Caching, there is no interceptor will be >>> used to reset the Stream for you before the message is routing to the >>> next endpoint. >>> >>> If there are large Post message body, the Stream Caching will help you >>> avoid the OutOfMessage error as it can dump the message into a file. >>> I don't know why are your going to disable it. >>> >>> Willem >>> >>> _Jens wrote: >>>> Hi Willem, >>>> >>>> thanks for your quick reply. The issue is that I cannot disable >>>> streamCaching in 2.3-SNAPSHOT anymore. This is what was changed in >>>> DefaultHttpBinding.parseBody: >>>> >>>> Before: >>>> >>>> // otherwise use input stream >>>> return HttpConverter.toInputStream(request); >>>> >>>> Now: >>>> // otherwise use input stream and we need to cache it first >>>> InputStream is = HttpConverter.toInputStream(request, >>>> httpMessage.getExchange()); >>>> if (is == null) { >>>> return is; >>>> } >>>> // convert the input stream to StreamCache >>>> try { >>>> CachedOutputStream cos = new >>>> CachedOutputStream(httpMessage.getExchange()); >>>> IOHelper.copy(is, cos); >>>> return cos.getStreamCache(); >>>> } finally { >>>> is.close(); >>>> } >>>> >>>> This means, the CachedOutputStream is always used. I have tried to >>>> disable >>>> this on the camelContext. But obviously the above code does not check >>>> this >>>> option in the camelContext. So it is not possible anymore. >>>> >>>> >>>> >>>> >>>> willem.jiang wrote: >>>>> These changes just to make sure the we can still read the post message >>>>> body even the body is form message. >>>>> >>>>> You can still configure the CachedOutputStream by using the camelContext >>>>> properties, I don't know what kind of issue that the changes introduced >>>>> to you. >>>>> >>>>> Willem >>>>> >>>>> _Jens wrote: >>>>>> Hi, >>>>>> >>>>>> it seems to me that the DefaultHTTPBinding again uses a >>>>>> CachedOutputStream. >>>>>> This means that the binding cannot be used anymore with longer streams >>>>>> and >>>>>> that the streamCache option on the CamelContext bean is ignored. Is >>>>>> this >>>>>> going to be the way the caching is done in 2.3? >>>>>> >>>>>> Thanks, >>>>>> Jens >>>>> >>>>> >>>> >>> >>> >>> >> >> -- >> View this message in context: >> http://old.nabble.com/2.3-SNAPSHOT%3A-Stream-Caching-again-enabled-by-Bug-Fix-for-Camel-2686-and-CAMEL-2694-%28rev-941275%29--tp28582952p28583757.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus >
Re: Apache Camel 2.3 - Pending SNAPSHOTs before release can be done
L.S., I'll start making sure that all these are building fine first now in order to get the release cut tomorrow or so Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On 28 April 2010 17:56, Claus Ibsen wrote: > Hi > > We have some SNAPSHOT deps which we must have GA releases for before > we can do Apache Camel 2.3 release. > All those deps are OSGi bundles which are defined in the > /platforms/karaf/features/src/main/resources/feautures/xml file. > > Currently we have the following 6 SNAPSHOTs > > > camel-cometd > mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.cometd-java-server/1.0.1_1-SNAPSHOT > > camel-ftp > mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsch/0.1.42_1-SNAPSHOT > > camel-nagios > mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsendnsca-core/1.3.1_1-SNAPSHOT > > camel-xmpp > mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.smack/3.1.0_1-SNAPSHOT > > camel-bean-validator > mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jsr303-api-1.0.0/1.5-SNAPSHOT > mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator/4.0.2.GA_1-SNAPSHOT > > > We need the SMX team to get those bundles released and published to maven > repos. > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus >
Re: How can I access Servicemix Environment viriables?
L.S., Yes. If you have something like PropertyPlaceHolderConfigurer or the likes in your Spring XML file, it will fall back into the system properties when it doesn't find a value in the specified properties file, so that should make these properties available for resolution. Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On 13 February 2010 16:24, lekkie wrote: > > Thanks for your response. > > Just one more question. > > Will the line below resolve to the intended values? > > 1) > 2) > > ${karaf.home}/data/conf/mysettings.properties > > > > > Sample 1 should get the value of request-queue from a properties file. > Sample 1 is the beginning of a camel route > > Sample 2 should read the values in the properties file > (${karaf.home}/data/conf/mysettings.properties). > > regards? > > > > Gert Vanthienen wrote: >> >> L.S., >> >> This information is available as a Java System property: >> - for ServiceMIx 3.2.x/3.3.x/4.0, the system property is called >> servicemix.home >> - for later versions of Servicemix (based on Felix Karaf), the >> property name to use id karaf.base >> >> Regards, >> >> Gert Vanthienen >> >> Open Source SOA: http://fusesource.com >> Blog: http://gertvanthienen.blogspot.com/ >> >> >> >> On 13 February 2010 13:27, lekkie wrote: >>> >>> Not sure if SMX has somethin like this, but I'd like to be able to access >>> the >>> root folder (hard drive path e.g. c:\\mysmxdirectory) in which SMX is >>> deploy. >>> >>> IS there an environment var for this? >>> >>> How can u access/use it in a camel application? >>> >>> rgds. >>> -- >>> View this message in context: >>> http://old.nabble.com/How-can-I-access-Servicemix-Environment-viriables--tp27574690p27574690.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> - >> --- >> Gert Vanthienen >> http://gertvanthienen.blogspot.com >> > > -- > View this message in context: > http://old.nabble.com/How-can-I-access-Servicemix-Environment-viriables--tp27574690p27575886.html > Sent from the Camel - Users mailing list archive at Nabble.com. > >
Re: How can I access Servicemix Environment viriables?
L.S., This information is available as a Java System property: - for ServiceMIx 3.2.x/3.3.x/4.0, the system property is called servicemix.home - for later versions of Servicemix (based on Felix Karaf), the property name to use id karaf.base Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On 13 February 2010 13:27, lekkie wrote: > > Not sure if SMX has somethin like this, but I'd like to be able to access the > root folder (hard drive path e.g. c:\\mysmxdirectory) in which SMX is > deploy. > > IS there an environment var for this? > > How can u access/use it in a camel application? > > rgds. > -- > View this message in context: > http://old.nabble.com/How-can-I-access-Servicemix-Environment-viriables--tp27574690p27574690.html > Sent from the Camel - Users mailing list archive at Nabble.com. > >
Re: Scala DSL equivalent on onException
L.S., The relevant unit test with the examples is in http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/OnExceptionTest.scala?view=markup The errorhandling clause you're looking for will look something like handle[Throwable].maximumRedeliveries(0).handled Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On 29 January 2010 07:15, Claus Ibsen wrote: > Hi > > On Thu, Jan 28, 2010 at 10:54 PM, crankydillo wrote: >> I need to do the Scala equivalent of: >> >> onException(Throwable.class).maximumRedeliveries(0).handled(true).end() >> >> Would someone be able to provide this? Thanks. > > I assume you have looked in the unit test source code for camel-scala? > > >> >> Thanks. >> >> -- >> crankydillo >> >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus >
Re: Errors parsing camel-context.xml
Pete, I think it's just a matter of adding the camel: prefix before the json element as well - the way it is written now, the json element is not using the camel namespace and I suspect that's why you're getting the parse exception (which says it found element "json" and was expecting "http://camel.apache.org/schema/spring":json ) Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/12/4 Pete Mueller : > > Hello, > > I am receiving the following error trying to start up my camel routing > bundle with a camel-context.xml in it. > > The error is: > org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line > 16 in XML document from URL > [bundle://135.0:0/META-INF/spring/camel-context.xml] is invalid; nested > exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid > content was found starting with element 'json'. One of > '{"http://camel.apache.org/schema/spring":artixDS, > "http://camel.apache.org/schema/spring":bindy, > "http://camel.apache.org/schema/spring":csv, > "http://camel.apache.org/schema/spring":flatpack, > "http://camel.apache.org/schema/spring":gzip, > "http://camel.apache.org/schema/spring":hl7, > "http://camel.apache.org/schema/spring":jaxb, > "http://camel.apache.org/schema/spring":json, > "http://camel.apache.org/schema/spring":rss, > "http://camel.apache.org/schema/spring":secureXML, > "http://camel.apache.org/schema/spring":serialization, > "http://camel.apache.org/schema/spring":string, > "http://camel.apache.org/schema/spring":tidyMarkup, > "http://camel.apache.org/schema/spring":xmlBeans, > "http://camel.apache.org/schema/spring":xstream, > "http://camel.apache.org/schema/spring":zip}' is expected. > > Clearly from the error, it shows that "json" is an allowed element. but SAX > says otherwise. Any idea how to reconcile this? I have a similar error > with using the placeholderPrefix attribute inside a property-placeholder > element. > > Thanks, > -p > > Here are relevant portions of my camel-context.xml if it helps. I thought > perhaps I'm using the wrong schema. > > > http://www.springframework.org/schema/beans"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xmlns:context="http://www.springframework.org/schema/context"; > xmlns:osgi="http://www.springframework.org/schema/osgi"; > xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"; > xmlns:camel="http://camel.apache.org/schema/spring"; > > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > http://www.springframework.org/schema/context > http://www.springframework.org/schema/context/spring-context.xsd > http://www.springframework.org/schema/osgi > http://www.springframework.org/schema/osgi/spring-osgi.xsd > http://www.springframework.org/schema/osgi-compendium > http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd";> > > placeholderPrefix="#{" placeholderSuffix="}" /> > > unmarshalTypeName="com.routecloud.bean.Message" /> > > > ... > -- > View this message in context: > http://old.nabble.com/Errors-parsing-camel-context.xml-tp26635732p26635732.html > Sent from the Camel - Users mailing list archive at Nabble.com. > >
Re: Using Camel with Felix (Karaf) without Spring
Charles, Peter, Given that you can also create a CamelContext from within a simple main() method and run routes that way, it should be possible to build a solution that does not require spring-dm. I think we should be able to build a simple Activator that is capable of tracking all RoutesBuilder implementations in the service registry and start those routes in a shared CamelContext. This would only require the standard OSGi Activator and ServiceTracker. For the dynamic disabling of routes, we can probably reuse the same mechanism for stopping the route if the RoutesBuilder implementation gets unregistered. Not sure how we could deal with services that are in other bundles, but perhaps the bundle that registers the builder can itself track the requirements and unregister the routesbuilder as soon as the requirements are no longer met. Anyway, I think it's a very interesting use case -- I think it would be kind of cool if we can also deploy Camel in this kind of embedded environment. Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/11/26 Charles Moulliard : > Hi Peter, > > Interesting design that you propose here. > >> - How do I create the camel content and export it to be picked up by the >> routing bundle. Is this done automatically? > > The camel-spring-osgi component allow to automatically register the > camelContext and made it available for other bunldes. > > The existing implementation of camel top of an OSGI server (Apache > Felix Karaf, Apache ServiceMix 4) depends on Spring Dynamic Module > (spring DM). Why : This project initiated some months ago by Spring > offer the advantage to register objects dynamically in the OSGI > service registry. In consequence, those objects (including the > camelContext) are available by other bundles of the OSGI platform. > > This is why when you deploy camel on osgi platform, the following > bundles must be deployed : > > > mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1 > spring > spring-dm // Spring Dynamic Module > mvn:org.springframework/spring-tx/2.5.6.SEC01 > camel-core > mvn:org.apache.camel/camel-spring-osgi/2.1-SNAPSHOT > > > This situation will change in the future. The last OSGI specification > R4.2 includes a Blueprint Container Specification (based on Spring DM > work) (see page 121 of OSGI R4.2 specification) and a blueprint > implementation is already available > (http://svn.apache.org/repos/asf/incubator/aries/trunk/blueprint). A > camel-blueprint component is currently developed > (https://svn.apache.org/repos/asf/camel/trunk/components/camel-blueprint). > > In consequence, it will be possible in a near future to use blueprint > as "Dynamic Service layer" for Camel > >> - Do I need Spring DM to use the elements? > > Yes > >> - Do I need Spring DM to use the .beanRef() camel routing? > > No > >> - If I have OSGi services defined with iPOJO, how do I access them from a >> camel route? > > You don't need to use iPOJO. You can create your POJOs, package them > in one or several bundles and use them in your camel route like this : > > In your Spring config file > > > > > > > > > Remark : Don't forget to import the packages names of your POJOS in > the manifest file of your camel bundle > >> If there is a better way to accomplish the goal, I'm open to suggestions. > > The question is : How a service which is down will inform the camel > routes where it is used that the route must be stopped ? What is a > down service (a bundle, a web application, a database, ...) ? > > Regards, > > Charles Moulliard > Senior Enterprise Architect > Apache Camel Committer > > * > blog : http://cmoulliard.blogspot.com > twitter : http://twitter.com/cmoulliard > Linkedlin : http://www.linkedin.com/in/charlesmoulliard > > Apache Camel Group : > http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm > > > > On Wed, Nov 25, 2009 at 8:29 PM, Pete Mueller wrote: >> >> Hello Charles, >> >> I should have been more specific. Yes, I meant without Spring DM. What I >> am attempting is to create a system that has X number of services >> registered, but not all services are running at all times, if a service is >> down, the routes that direct messages to it must also be brought down to >> stop messages from being accepted and going nowhere. A simple example would >> be: >> >> HTTP POST --> Translator Service --> Database >> >> If the translator service is brought offline, the HTTP listener and database >> re
Re: ContextTestSupport version for camel-scala
Hans, We don't package a camel-scala test jar, but you can use Scala to build your unit tests in combination with the camel-core test jar. Just create a Camel unit test that extends the normal Camel ContextTestSupport class and add the Scala DSL's RouteBuilderSupport trait. We use this technique in our own unit tests. An example can be found at http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SOnCompletionWhenTest.scala?revision=781747. The OnCompletionWhenTest is a plain CamelTestSupport based unit test class and the trait is mixed in so we can use a Scala RouteBuilder. Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/6/10 Claus Ibsen : > On Tue, Jun 9, 2009 at 5:02 PM, hans couder wrote: >> Hi, >> >> >> I'm using for my camel project the Scala DSL and would like to create some >> routes for testing in scala. >> Is there a scala version of CamelTestSupport or the camel-test module? > Not that I know of. As they are pure Java you should be able to use it > seamless from Scala. > > What are you looking for by a Scala version? > > >> >> >> Thx and regards, >> >> Hans Couder >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus >
Re: JBI In-Only Exchange Never Completes
L.S., No offense taken at all -- looks like I have to apologize if my first response sounded a bit too defensive ;). Anyway, if this thing locks up, we need to find out why and either fix or document it. While running this route, do you see any exceptions at all appearing in the log file? Just for testing purposes, could you try removing the seda queues or replace them with direct: endpoints to see if this is somehow caused by the additional threading that happens in there? What would really help in troubleshooting this issue is a thread dump? You can find some information on creating one in http://java.sun.com/developer/technicalArticles/Programming/Stacktrace/. Thanks and apologies once again, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/5/27 Bob Pollack : > > Dear Mr. Vanthienen, > > I appreciate your prompt attention to this problem, and I apologize for my > suggestion that the in-only logic was simply not implemented. I have spent > the entire day crawling around the code and I see that this logic is very > much in place. > > Right now, I believe that my problem was due to the incorrect use of a > splitter. The logic I had was something like this: > > from ("jbi:...") // the service I'm offering > .inOnly ("seda:packetQueue") > ; > > from ("seda:packetQueue") > .to ("xslt:transform1.xslt") > .splitter (xpath1) > .inOnly ("seda:mbQueue") > ; > > from ("seda:mbQueue") > .inOnly (jbi: ...") // the service I'm calling > ; > > When my transformed message has three parts, everything just locks up. When > I tested with a message that only has one part, everything works fine. I > will be trying to figure out what I did wrong and how I can correct it--and > I invite your comment on what is wrong with my splitter logic, but only if > you have the time and inclination. > > In the meantime, I apologize again for my diagnosis that something was > broken in the JBI in-only logic. When I figure out what the splitter problem > is, I will post my solution to this forum to help other people that may have > a similar problem. > > Thanks again. > -- > View this message in context: > http://www.nabble.com/JBI-In-Only-Exchange-Never-Completes-tp23732734p23751497.html > Sent from the Camel - Users mailing list archive at Nabble.com. > >
Re: JBI In-Only Exchange Never Completes
Bob, This scenario should definitely work. I regularly use Camel inside ServiceMix with customers and most of the flows there are with InOnly exchanges. I've just added a few lines to a unit test of ours as well, so it reads: from("jbi:service:urn:test:forward").to("jbi:service:urn:test:in-only?mep=in-only"); from("jbi:service:urn:test:in-only").convertBodyTo(String.class).to("mock:done"); Is this what you're trying to do? From what you're saying, I guess you see the ACTIVE MessageExchange in the DEBUG log but there's no DONE MessageExchange afterwards? If that is the case, the likely culprit is the provider component, the one that is actually receiving the MessageExchange and handling it might not be setting the status correctly. Could you send us a brief summary of the flow (components/endpoints used) to help us troubleshoot? Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/5/27 Bob Pollack : > > Has anyone gotten an in-only JBI exchange to work? If I send a message to > "jbi:service:foo:bar?mep=in-only", it works, but the exchange never seems to > complete. That is, I can only do this once. > > Is this a bug, or am I doing something wrong? If anyone has a working > example of sending to a JBI in-only exchange, I'd love to see it. > > Thanks. > -- > View this message in context: > http://www.nabble.com/JBI-In-Only-Exchange-Never-Completes-tp23732734p23732734.html > Sent from the Camel - Users mailing list archive at Nabble.com. > >
Re: passing an xml fragment to xslt
Gert-Jan, It seems like a reasonable use case so I'd like to give it a shot to fix this. Do you think you can create a unit test or something that demonstrates the problem? That would make it a lot easier to troubleshoot and fix your issue. Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/5/4 Gert-Jan van de Streek : > > I want to pass an xml fragment to an xslt. I have the following code where > the queue holds xml messages > > from("activemq:example.A") > .setHeader("agent.id", new XPathExpression("/")) > .process(new ReadLocalFile()) > .to("xslt:transform.xsl") > > > The xslt looks like: > > ... > > > > > > > I would expect the xml fragment to be available as a nodeset in the xsl, but > I get the following exception: > > javax.xml.transform.TransformerException: java.lang.RuntimeException: > Invalid conversion from > 'com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList' to 'node-set'. > at > com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:670) > at > com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:300) > at > org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:83) > ... > > Any ideas on how to solve this? >
Re: porting camel routers (camel-jdbc) to servicemix4.0
Matteo, Could you try adding an OSGi import for the dbcp or spring-jdbc packages to your bundle? The bundle plugin doesn't look into the Spring XML file to figure out what imports to add to your bundle, so it might not be able to see the class you're looking for. Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/4/26 Matteo Redaelli : > > Thanks for the quick answers > > FYI, I found and installed commons-dbcp and spring-jdbc using features/list > and features/install (without adding new features urls, I use smx 4.0) but, > as I said, I have the same error messages > > In the meanwhile I'll keep my old camel-jdbc-spring projects outside smx4 > :-( > > Many thanks > Matteo > > > Gert Vanthienen wrote: >> >> Matteo, >> >> The camel-jdbc feature doesn't load the commons-dbcp or spring-jdbc >> stuff because it doesn't really depend on it. As you have shown >> yourself, you can use either one of them to define the DataSource >> object (there are even other options out there, e.g. C3PO), so I guess >> we can't really manage those for you. >> >> Doing another tutorial page would be a good idea though, so we can >> give people an idea on how to solve this kind of issue. From a >> development perspective, I'm also wondering if we can't make this a >> bit more easy for end users by reading the Spring context file and >> doing more imports or something... >> >> ServiceMix 4 itself ships with JNDI support, so you could use JNDI >> there, but for ServiceMix Kernel, I guess the OSGi Service Registry >> would be the best way to share a DataSource. You could e.g. use >> Spring-DM to define the service in one bundle and then refer to that >> from another bundle. Have a look at >> http://static.springframework.org/osgi/docs/1.2.0/reference/html/service-registry.html >> to find our more about this. >> >> Regards, >> >> Gert Vanthienen >> >> Open Source SOA: http://fusesource.com >> Blog: http://gertvanthienen.blogspot.com/ >> >> >> >> 2009/4/26 Matteo Redaelli : >>> >>> Thanks for answer >>> >>> I installed also other features like >>> >>> [ 161] [Active ] [ ] [ 60] Apache ServiceMix Bundles: >>> commons-dbcp-1.2.2 (1.2.2.3) >>> [ 181] [Active ] [ ] [ 60] Spring JDBC (2.5.6) >>> >>> but I have the same problem. I'll go on adding something more. But from >>> the >>> end user point of view this is quite strange: should the feature >>> "camel-jdbc" be responsable of loading all other "low level" necessary >>> libraries? >>> >>> In any case, if I can give a suggestion to Camel/smx4 team, it would be >>> nice >>> to have an example/wiki page about using camel-jdbc in smx4/osgi. And how >>> to >>> share more than one datasource in smx4/kernel >>> >>> http://trenaman.blogspot.com/2008/12/how-to-share-single-jdbc-pool-across.html >>> http://trenaman.blogspot.com/2008/12/sharing-oracle-jdbc-pool-in-smx4.html >>> >>> "Cameling" with databases is quite common, smx doesn't have at the moment >>> a >>> jbi servicemix-jdbc component, so camel-jdbc is the way if you do not >>> want >>> to write java code... >>> >>> Regards >>> Matteo >>> >>> >>> Claus Ibsen-2 wrote: >>>> >>>> Hi >>>> >>>> You need some additional .jars on the classpath. So you need to >>>> install more .jars into the OSGi. >>>> >>>> You should look at the exception: >>>> Cannot >>>>> find class [org.apache.commons.dbcp.BasicDataSource] for bean with name >>>>> 'DB" >>>> >>>> Where it states that it cannot find the class above. Then you need to >>>> find the .jar that contains this .class and install it. >>>> >>>> Some of the .jars can be found here: >>>> http://servicemix.apache.org/SMX4/bundles-repository.html >>>> >>>> >>>> >>>> >>>> >>>> On Thu, Apr 23, 2009 at 9:19 PM, Matteo Redaelli >>>> wrote: >>>>> >>>>> ciao >>>>> >>>>> I'm trying to port a maven project to the osgi container servicemix4.0. >>>>>
Re: porting camel routers (camel-jdbc) to servicemix4.0
Matteo, The camel-jdbc feature doesn't load the commons-dbcp or spring-jdbc stuff because it doesn't really depend on it. As you have shown yourself, you can use either one of them to define the DataSource object (there are even other options out there, e.g. C3PO), so I guess we can't really manage those for you. Doing another tutorial page would be a good idea though, so we can give people an idea on how to solve this kind of issue. From a development perspective, I'm also wondering if we can't make this a bit more easy for end users by reading the Spring context file and doing more imports or something... ServiceMix 4 itself ships with JNDI support, so you could use JNDI there, but for ServiceMix Kernel, I guess the OSGi Service Registry would be the best way to share a DataSource. You could e.g. use Spring-DM to define the service in one bundle and then refer to that from another bundle. Have a look at http://static.springframework.org/osgi/docs/1.2.0/reference/html/service-registry.html to find our more about this. Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/4/26 Matteo Redaelli : > > Thanks for answer > > I installed also other features like > > [ 161] [Active ] [ ] [ 60] Apache ServiceMix Bundles: > commons-dbcp-1.2.2 (1.2.2.3) > [ 181] [Active ] [ ] [ 60] Spring JDBC (2.5.6) > > but I have the same problem. I'll go on adding something more. But from the > end user point of view this is quite strange: should the feature > "camel-jdbc" be responsable of loading all other "low level" necessary > libraries? > > In any case, if I can give a suggestion to Camel/smx4 team, it would be nice > to have an example/wiki page about using camel-jdbc in smx4/osgi. And how to > share more than one datasource in smx4/kernel > > http://trenaman.blogspot.com/2008/12/how-to-share-single-jdbc-pool-across.html > http://trenaman.blogspot.com/2008/12/sharing-oracle-jdbc-pool-in-smx4.html > > "Cameling" with databases is quite common, smx doesn't have at the moment a > jbi servicemix-jdbc component, so camel-jdbc is the way if you do not want > to write java code... > > Regards > Matteo > > > Claus Ibsen-2 wrote: >> >> Hi >> >> You need some additional .jars on the classpath. So you need to >> install more .jars into the OSGi. >> >> You should look at the exception: >> Cannot >>> find class [org.apache.commons.dbcp.BasicDataSource] for bean with name >>> 'DB" >> >> Where it states that it cannot find the class above. Then you need to >> find the .jar that contains this .class and install it. >> >> Some of the .jars can be found here: >> http://servicemix.apache.org/SMX4/bundles-repository.html >> >> >> >> >> >> On Thu, Apr 23, 2009 at 9:19 PM, Matteo Redaelli >> wrote: >>> >>> ciao >>> >>> I'm trying to port a maven project to the osgi container servicemix4.0. I >>> created a new project with >>> >>> mvn archetype:create \ >>> -DarchetypeGroupId=org.springframework.osgi \ >>> -DarchetypeArtifactId=spring-osgi-bundle-archetype \ >>> -DarchetypeVersion=1.2.0-m2 \ >>> -DgroupId=pire.upms \ >>> -DartifactId=pire-upms-users >>> -Dversion=1.0-SNAPSHOT >>> >>> I installed all supposed camel features >>> >>> s...@root:/> osgi/list|grep camel >>> [ 65] [Active ] [ ] [ 60] camel-core (1.6.0) >>> [ 66] [Active ] [ ] [ 60] camel-osgi (1.6.0) >>> [ 67] [Active ] [ ] [ 60] camel-spring (1.6.0) >>> [ 159] [Active ] [ ] [ 60] camel-ognl (1.6.0) >>> [ 160] [Active ] [ ] [ 60] camel-jms (1.6.0) >>> [ 162] [Active ] [ ] [ 60] camel-quartz (1.6.0) >>> [ 164] [Active ] [ ] [ 60] camel-jdbc (1.6.0) >>> [ 170] [Active ] [ ] [ 60] camel-velocity (1.6.0) >>> [ 172] [Active ] [ ] [ 60] camel-juel (1.6.0) >>> [ 182] [Active ] [ ] [ 60] camel-sql (1.6.0) >>> [ 186] [Active ] [ ] [ 60] camel-spring-integration (1.6.0) >>> [ 195] [Active ] [ ] [ 60] camel-jpa (1.6.0) >>> [ 201] [Active ] [ ] [ 60] camel-ibatis (1.6.0) >>> >>> I also added the same dependences in pom.xml I used in my old camel >>> project >>> >>> but when I deploy my .jar in deploy folder I get >
Re: Deploying same camelContext.xml in and out of OSGi
Willem, Would adding a Bundle-Activator to our jars help? The activator would only be called upon in an OSGi environment so it could take of putting in place everything that's necessary for OSGi without the need for anyone to change the configuration in the XML files. Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/3/26 Willem Jiang : > Hi, > > Yes, in servicemix-camel component, we can use the Spring namespace for > OSGi and non-OSGi environment. That is because ServiceMix take charge of > the Camel Spring handler itself, and the Spring handler of camel-spring > will detect the CamelContextFactoryBean of OSGi (in the camel-osgi > bundle) by using Class.forName() and replace the CamelContextFactoryBean > of Spring with the OSGi one. > > But if we deploy a camel context spring configure file into ServiceMix > directly, the Spring handler will be inited by Spring DM first, and the > Class.forName() detection will not work for camel-spring bundle anymore, > since the camel-osgi bundle is not be installed at that time. > > Maybe we need to find some other way to accomplish this kind of auto > replacing work. > > BTW, I don't if we can achieve this by using Spring java config ? > > Willem > > > James Strachan wrote: >> BTW I remember having a chat with Guillaume a while back and I don't >> think the OSGi namespace in the XML is required any more; I think he >> figured out how to wire in the OSGi injection without having to change >> the XML namespace. Though I've not tested it to be sure though - want >> to give it a try? >> >> Then in OSGi you add camel-osgi but when not using OSGi you can omit >> this dependency? >> >> 2009/3/25 Willem Jiang : >>> Hi Aaron >>> >>> The CamelContextFactoryBean of OSGi version extends the >>> CamelContextFactoryBean of Spring version. It only add the handle of >>> bundle context injection. For non-OSGi container it will not inject the >>> bundle context into the OSGi CamelContextFactoryBean, so the OSGi >>> CamelContextFactoryBean will act as Spring CamelContextFactoryBean. >>> >>> The only side effect is you need to add the camel-osgi dependented third >>> party jars into the class path. >>> >>> Willem >>> >>> Aaron Crickenberger wrote: >>>> I have the following XML I'd like to deploy both in an OSGi container, and >>>> a >>>> non-OSGi container. To deploy in the OSGi container, I have to use the >>>> "osgi" schema so that the "quartz" component is resolved to the >>>> camel-quartz >>>> bundle. >>>> >>>> To deploy in a non-OSGi container, I had to add spring-osgi-core-1.1.2.jar >>>> and org.osg.core-1.2.0.jar to the classpath. It appears to be working, but >>>> I wanted to double-check with the experts. Can you think of any >>>> side-effects I might see from deploying this way vs. deploying w/ the " >>>> http://activemq.apache.org/camel/schema/spring"; schema? >>>> >>>> http://www.springframework.org/schema/beans"; >>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >>>> xmlns:camel="http://activemq.apache.org/camel/schema/spring"; >>>> xsi:schemaLocation=" >>>> http://www.springframework.org/schema/beans >>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd >>>> http://activemq.apache.org/camel/schema/spring >>>> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd >>>> http://activemq.apache.org/camel/schema/osgi >>>> http://activemq.apache.org/camel/schema/osgi/camel-osgi.xsd";> >>>> >>>> http://activemq.apache.org/camel/schema/osgi";> >>>> >>>> >>> /> >>>> >>>> >>>> >>>> >>>> >>>> >>>> - aaron >>>> >>> >> >> >> > >
Re: What If JBI sendSync() Never Returns?
L.S., When sending a JBI MessageExchange to another JBI endpoint from Camel, the servicemix-camel component will the same messaging style as is used in the Camel route. If your Camel route contains e.g. a seda: endpoint, Camel will start using async messaging and it will also use an async JBI MessageExchange to communicate with the JBI NMR. This still doesn't handle the use case where the service fails to respond at all (although it will usually not hang, it's far more likely to return an Error status). However, your suggestion for improving the Camel component to allow sync messaging with a message timeout is a very interesting one, so we'd really appreciate a JIRA issue for it at https://issues.apache.org/activemq/browse/SMXCOMP. Since you obviously know your way around the source code, don't hesitate to try doing a patch -- just let us know if you need any help... Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/3/20 Bob Pollack : > > Does anyone know of a way to set a timer for JBI endpoints? If I make a > request of a JBI service (by something like to ("jbi:endpoint:foo"), the > call to the JBI endpoint seems to be made as DeliveryChannel.sendSync > (message), with no timeout. If the target JBI service doesn't respond (let's > say it crashes), the Camel route seems to hang forever. > > When I look at the code, the JBI call seems to be done by > org.apache.servicemix.common.endpoints.SimpleEndpoint, which doesn't even > contain a sendSync() call with a timeout. So I conclude that there's no way > for Camel to ask for one. > > Should this be submitted as an enhancement request? (If so, can someone tell > me where?) Or does someone have a Camel workaround or a Java thread > solution? > > (This is related to > http://www.nabble.com/Servicemix-Camel-problem---ToJbiProcessor-hangs-tp18651622p18651622.html > a similar problem that has already been posted here. But the previous > problem concerned a JBI-JMS interaction that appears to have been solved by > changing the JMS logic. I'm interested in a solution that gives me some kind > of timeout when the target JBI component fails to respond for any reason > whatsoever.) > > Thanks in advance to anyone who can help. > -- > View this message in context: > http://www.nabble.com/What-If-JBI-sendSync%28%29-Never-Returns--tp22628026p22628026.html > Sent from the Camel - Users (activemq) mailing list archive at Nabble.com. > >
Re: StreamCaching in Camel 1.6
Jens, Stream caching is turned on automatically when you use a DeadLetterChannel as the error handler. Because the Exchange might be redelivered or sent to the DLQ destination, we have to cache it before we send it into the DLC. Adding an errorHandler(noErrorHandler()); to the configure() method should fix that for you. Regards, Gert Vanthienen Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/3/3 _Jens : > > Hi, > > I have run into a problem with stream caching in Camel 1.6. I have a route > that reads data via streaming from an Http request. In some cases this can > be a large amount of data, so I cannot stream the data completely into > memory. I wrote this little test to demonstrate my problem: > > �...@test > public void testUploadFailsForHugeFile() throws Exception { > CamelContext context = new DefaultCamelContext(); > > context.addRoutes(new RouteBuilder() { > �...@override > public void configure() throws Exception { > noStreamCaching(); > from("jetty:http://localhost:8989/bigfile";) > .noStreamCaching() > .process(new Processor() { > public void process(Exchange exchange) throws > Exception { > InputStream inputStream = > exchange.getIn().getBody(InputStream.class); > while (inputStream.read() != -1) {} > } > }); > } > }); > > context.start(); > > HttpClient client = new HttpClient(); > PostMethod method = new PostMethod("http://localhost:8989/bigfile";); > File file = new File("c:\\temp\\test.bin.ok2"); > method.setRequestEntity(new FileRequestEntity(file, > "unknown/unknown")); > assertEquals(200, client.executeMethod(method)); > } > > This fails with an OutOfMemoryError if test.bin.ok2 is a larger file because > the StreamCachingInterceptor reads the input stream into memory. Now I > understand that stream caching is turned on by default in Camel 1.6. > However, as you can see I tried to disable it in the route builder. This > seems not to make any difference. > > Now, my question is if there is some other way to disable stream caching or > if I'm doing something wrong here. > > Thanks in advance > Jens > -- > View this message in context: > http://www.nabble.com/StreamCaching-in-Camel-1.6-tp22305654p22305654.html > Sent from the Camel - Users (activemq) mailing list archive at Nabble.com. > >
Re: Camel + ActiveMQ in Tomcat6
Markus, What does the path to the GC root look like for the classloader object that couldn't be unloaded in Eclipse MAT? Regards, Gert Markus Wolf wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 we tried this but it throws this Exception during creation of the ActiveMQConnectionFactory: Tried what exactly? Running the camel-activemq-web war works fine for me. I've tried to put only the activemq libraries into my tomcat common classpath and all camel dependencies including camel-core into my webapp. That caused the exeception I mentioned. Caused by: java.lang.NoClassDefFoundError: org/apache/activemq/management/JMSStatsImpl Looks like missing dependencies. Are you using maven to resolve the dependencies? That file resides in the activemq-core.jar. I've checked that. And that file is inside the tomcat common classpath. Maybe I missconfigured something here... :/ [snip] I guess there is currently no way to use ActiveMQ in an embedded way which does not have classloader leaks. I don't see any evidence of a class loader leak? Ok, let me explain it a bit more in detail. The ActiveMQConnectionFactory and the TcpTransport (some other classes also) create ThreadPools (to be excact ScheduledThreadPools from Java Concurrent). That thread pools are configured with custom ThreadFactories to set the created Threads to daemon behaviour. When we undeploy our application then the ThreadPool classes keep a reference to the ThreadFactories. This factories are loaded by tomcats webapp classloader whereas the ThreadPool classes are loaded by the bootstrap classloader of the JDK. Therefore the webapp classloader could not be unloaded. I'm not a classloader expert but I check this with the eclipse memory analyzer tool (http://www.eclipse.org/mat), because I wanted to see which part of our application keeps the PermGen. Markus - -- NMMN - New Media Markets & Networks GmbH Geschäftsführung: Kfm. Michael Schütt Finanzamt HH-Altona UStID DE 812 699 852 HRB 71102 Hamburg HypoVereinsbank - BLZ 200 300 00 - Konto-Nr. 156 29 82 http://www.nmmn.com Tel.: +49 40 284 118 -0 Langbehnstrasse 6 Entwicklung: -720 22761 Hamburg Fax: -999 Rufen Sie uns kostenlos an: http://www.nmmn.com/call/software -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkmkAksACgkQDBHISU1oEKHELACfcKfNvdgRQ4WguvQmX1V9DZJE IjAAoJpO6qGDd43epV9UsnZ30z7V7AaK =a7vE -END PGP SIGNATURE-
Re: Camel + ActiveMQ in Tomcat6
Markus, Could you verify that it is not a thread leak that is causing the PermGen memory leak? If you have threads being left behind when undeploying the WAR file (e.g. a JMS connection not closed properly), these threads will probably hang on to the classloader. Regards, Gert James Strachan wrote: 2009/2/24 Markus Wolf : -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 this approach does not help me, since when the ActiveMQ is created by tomcats webapplication classloader it cannot be undeployed. You don't have to create the broker in the WAR (or you could put it in another WAR). This approach works totally fine if you are using the ActiveMQ JMS client with Camel. But it requires to put the activemq-core dependency to the webapp for creating the ConnectionFactory for ActiveMQ, doesn't it? Or am I missing something here. Yes. How else could you use ActiveMQ from a web app? Even starting the ConnectionFactory produce memory leaks in the webapp classloader. Not sure what you mean by "memory leak in the web app class loader". Do you consider adding a class to a class loader a leak? :)
Re: Procedure to format AND checkstyle in Eclipse according to Camel rules ?
L.S., We could also configure the Maven Eclipse plugin to generate per-project code formatting rules while doing mvn eclipse:eclipse. The only drawback is that it overwrites the .settings/org.eclipse.jdt.core.prefs in the process, so we also have to specify the compiler compliance level ourselves in the template prefs file. I gave it a quick try on my machine and it seems to work fine this way. Regards, Gert Jon Anstey wrote: Spot on Ramon. You can also tell Maven where your Eclipse workspace actually is like so mvn -Psetup.eclipse -Declipse.workspace.dir=/path/to/your/workspace On Tue, Jan 27, 2009 at 9:28 AM, Ramon Buckland wrote: cc'd to dev@ Thanks Charles, I have/had the same question. Once it is in email I'll volunteer to push that to the wiki. I know already that line width is set at 140 (thanks Claus). In Eclipse I am using Sun standard formatting with change of 140 line width. It seems, by inspecting the uber pom.xml that {code} mvn -Psetup.eclipse {code} should create the magic with a checkstyle configuration applied to a workspace. but it assumed a few things about workspace locations and etc which did not seem to hold for me. On Tue, Jan 27, 2009 at 23:49, cmoulliard wrote: Hi, I would like to know the procedure to follow in order to format code to be published to camel project in Eclipse ? Idem but to check style ? Is the code formatted automatically during maven build process of Camel project ? Remarks : - ActiveMQCodeFormatter.xml file exists under the folder etc/eclipse. Maybe this file could be rename to CamelCodeFormater ? Is it the file to be used in Eclipse to format the code ? - Several files exist under buildingtools project ? Which one to be used with eclipse to checkstyle (using checkstyle plugin / PMD plugin) ?