Hi Freeman
This is a good solution for spring/osgi component but I have a servicemix-http
component in SMX4. This http component needs to read the location URI of the
remote web service from a configuration file but I don't where to put it.
This is my configuration and the log file.
I put zzzservice.properties into etc directory.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns:http="http://servicemix.apache.org/http/1.0"
xmlns:zzz="http://zzz.company.it/webservices/"
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://servicemix.apache.org/http/1.0
http://servicemix.apache.org/schema/servicemix-http-3.4.0.2-fuse.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:/zzzservice.properties</value>
</property>
</bean>
<http:endpoint service="zzz:GMP"
endpoint="zzzSoapPort"
role="provider"
locationURI="${service.locationURI}"
defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
soap="true" />
</beans>
11:54:34,286 | ERROR | use-01-00/deploy | Deployer |
cemix.jbi.deployer.impl.Deployer 360 | Error handling bundle start event
javax.jbi.JBIException: java.lang.Exception: Error deploying SU
http-zzz-provider
at
org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.install(ServiceAssemblyInstaller.java:101)
at
org.apache.servicemix.jbi.deployer.impl.Deployer.onBundleStarted(Deployer.java:352)
at
org.apache.servicemix.jbi.deployer.impl.Deployer.bundleChanged(Deployer.java:282)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:919)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
at
org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
at
org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1350)
at
org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1301)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:362)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:272)
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.start(DirectoryWatcher.java:1090)
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.start(DirectoryWatcher.java:1076)
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:405)
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:212)
Caused by: java.lang.Exception: Error deploying SU http-zzz-provider
at
org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.deploySUs(ServiceAssemblyInstaller.java:213)
at
org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.install(ServiceAssemblyInstaller.java:85)
... 14 more
Caused by: javax.jbi.management.DeploymentException: <component-task-result
xmlns="http://java.sun.com/xml/ns/jbi/management-message">
<component-name>servicemix-http</component-name>
<component-task-result-details>
<task-result-details>
<task-id>deploy</task-id>
<task-result>FAILED</task-result>
<message-type>ERROR</message-type>
<task-status-msg><msg-loc-info><loc-token/><loc-message>Could not deploy xbean
service unit</loc-message></msg-loc-info></task-status-msg>
<exception-info>
<nesting-level>1</nesting-level>
<msg-loc-info>
<loc-token />
<loc-message>Could not load properties;
nested exception is java.io.FileNotFoundException: class path resource
[zzzservice.properties] cannot be opened because it does not exist</loc-message>
<stack-trace><![CDATA[org.springframework.beans.factory.BeanInitializationException:
Could not load properties; nested exception is java.io.FileNotFoundException:
class path resource [zzzservice.properties] cannot be opened because it does
not exist
at
org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:78)
at
org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:553)
at
org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:527)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:362)
at
org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:87)
at
org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
at
org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
at
org.apache.servicemix.jbi.deployer.artifacts.ServiceUnitImpl.deploy(ServiceUnitImpl.java:104)
at
org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.deploySUs(ServiceAssemblyInstaller.java:207)
at
org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.install(ServiceAssemblyInstaller.java:85)
at
org.apache.servicemix.jbi.deployer.impl.Deployer.onBundleStarted(Deployer.java:352)
at
org.apache.servicemix.jbi.deployer.impl.Deployer.bundleChanged(Deployer.java:282)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:919)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
at
org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
at
org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1350)
at
org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1301)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:362)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:272)
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.start(DirectoryWatcher.java:1090)
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.start(DirectoryWatcher.java:1076)
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:405)
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:212)
Caused by: java.io.FileNotFoundException: class path resource
[zzzservice.properties] cannot be opened because it does not exist
at
org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:143)
at
org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:182)
at
org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:161)
at
org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:69)
... 23 more
]]></stack-trace>
</msg-loc-info>
</exception-info>
</task-result-details>
</component-task-result-details>
</component-task-result>
at
org.apache.servicemix.common.ManagementSupport.failure(ManagementSupport.java:46)
at
org.apache.servicemix.common.AbstractDeployer.failure(AbstractDeployer.java:43)
at
org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:117)
at
org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
at
org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
at
org.apache.servicemix.jbi.deployer.artifacts.ServiceUnitImpl.deploy(ServiceUnitImpl.java:104)
at
org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.deploySUs(ServiceAssemblyInstaller.java:207)
... 15 more
11:54:34,288 | DEBUG | nitor WriteCheck | InactivityMonitor |
mq.transport.InactivityMonitor$2 106 | 9994 ms elapsed since last write check.
Thank you
Massimiliano Andriotto
-----Messaggio originale-----
Da: Freeman Fang [mailto:[email protected]]
Inviato: martedì 2 marzo 2010 14.23
A: [email protected]
Oggetto: Re: Outsource SU configuration in a properties file SM4
Hi,
Take a look at camel-osgi example shipped with smx4 kit. This example
demostrates how to use property placeholder in osgi container.
Just follow the README.txt and pay attention the beans.xml in this demo.
Freeman
On 2010-3-2, at 下午7:05, Andriotto Massimiliano wrote:
> In this page
> http://servicemix.apache.org/4-beginner-outsource-su-configuration-in-a-
> properties-file.html
>
> there is the description on how to configure externally a SU.
>
> Is it possible to do the same in SMX4 and how?
>
> Thank you
>
>
>
> Massimiliano Andriotto
>
>
>
--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com