You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by the_biswa <bi...@gmail.com> on 2010/10/19 14:25:57 UTC

Re: SMX3 & env variable

On the same line I wanted to know one thing. 
I've defined some variables in <servicemixhome>/etc/system.properties file
I want to dynamically load the locationURI value of <http:consumer .../>
endpoint from the aforesaid system.properties.

below is my http:consumer definition

 <http:consumer service="b:httpConsumerGateway"
                 endpoint="endpoint"
                 locationURI="${location}"
                 defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
                 targetService="b:srsGateway"/>

but while deploying the SA it is throwing MalformedURLException. where am I
going wrong. What is the process to do that?
-- 
View this message in context: http://servicemix.396122.n5.nabble.com/SMX3-env-variable-tp421193p3218956.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: SMX3 & env variable

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,

It looks like the ServiceUnitAnalyzer has a problem with the property
placeholder config.  We probably have to look into that, but I'm
guessing it's an issue with the classpath that's being used when
running the analyzer (doesn't contain the global.properties file
location).  Be sure to raise a JIRA issue about it so we can
investigate this.

However, as a workaround, you should be able to add
<useServiceUnitAnalyzer>false</useServiceUnitAnalyzer> to the
<configuration> section of the jbi-maven-plugin.  This might prevent
some metadata from being generated into the JBI descriptor, but
ServiceMix won't have a problem with that as it can deploy the SU
without the extra information anyway.

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



On Wed, Oct 20, 2010 at 7:30 AM, the_biswa <bi...@gmail.com> wrote:
>
> Hi JB,
> My xbean is like the following
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns:http="http://servicemix.apache.org/http/1.0"
>           xmlns:person="http://servicemix.apache.org/samples/wsdl-first"
>           xmlns:ts="http://ts"
>           xmlns:sws="https://webservices.sabre.com/websvc"
>    xmlns:b="http://abacus.com/amh">
>    <!--<bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
>       <property name="locations">
>          <value>classpath:global.properties</value>
>       </property>
>    </bean>-->
>    <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
>           <http:consumer service="b:httpConsumerGateway"
>                 endpoint="endpoint"
>                 locationURI="${location.value}"
>                 defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
>                 targetService="b:messagingService"
>                 marshaler="#marshaler" />
>
>
>   <bean id="marshaler"
> class="com.abacus.amh.http.marshallar.HTTPMarshaler"/>
> </beans>
>
>
> Thanks,
> BJ
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/SMX3-env-variable-tp421193p3227988.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>

Re: SMX3 & env variable

Posted by the_biswa <bi...@gmail.com>.
Hi JB,
My xbean is like the following

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:http="http://servicemix.apache.org/http/1.0"
	   xmlns:person="http://servicemix.apache.org/samples/wsdl-first"
	   xmlns:ts="http://ts"
	   xmlns:sws="https://webservices.sabre.com/websvc"
    xmlns:b="http://abacus.com/amh">
    <!--<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
       <property name="locations">
          <value>classpath:global.properties</value>
       </property>
    </bean>-->
    <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
	   <http:consumer service="b:httpConsumerGateway"
                 endpoint="endpoint"
                 locationURI="${location.value}"
                 defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
                 targetService="b:messagingService"
                 marshaler="#marshaler" />
                 
                   
   <bean id="marshaler"
class="com.abacus.amh.http.marshallar.HTTPMarshaler"/>
</beans>


Thanks,
BJ
-- 
View this message in context: http://servicemix.396122.n5.nabble.com/SMX3-env-variable-tp421193p3227988.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: SMX3 & env variable

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Could you paste your xbean.xml (or maybe do you use the EndpointExporter) ?

Thanks
Regards
JB

On 10/19/2010 03:47 PM, the_biswa wrote:
>
> Hi JB
>
> I've done what you've suggested to make my http:consumer definition look
> like the following
> <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
> 	<http:consumer service="b:httpConsumerGateway"
>                   endpoint="endpoint"
>                   locationURI="${location.value}"
>                   defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
>                   targetService="b:messagingService" />
>
> But now while building the application using maven it's giving me the
> following WARNING
>
> ----------------------------------------------------------------------------------------
> org.apache.servicemix.maven.plugin.jbi.JbiPluginException: Unable to
> generate service unit descriptor!
>          at
> org.apache.servicemix.maven.plugin.jbi.GenerateServiceUnitDescriptorMojo.generateJbiDescriptor(GenerateServiceUnitDescriptorMojo.java:206)
>          at
> org.apache.servicemix.maven.plugin.jbi.GenerateServiceUnitDescriptorMojo.execute(GenerateServiceUnitDescriptorMojo.java:143)
>          at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
>          at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
>          at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
>          at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
>          at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
>          at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
>          at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
>          at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
>          at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
>          at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
>          at
> org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
>          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.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>          at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>          at
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>          at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
> Invalid bean definition with name
> 'org.apache.servicemix.http.endpoints.HttpConsumerEndpoint#0' defined in URL
> [file:/D:/abacus/workspace/Testing/aws-http-consumer-gateway-su/src/main/resources/xbean.xml]:
> Could not resolve placeholder 'location.value'
>          at
> org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:268)
>          at
> org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75)
>          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.AbstractXBeanServiceUnitAnalyzer.init(AbstractXBeanServiceUnitAnalyzer.java:90)
>          at
> org.apache.servicemix.maven.plugin.jbi.GenerateServiceUnitDescriptorMojo.generateJbiDescriptor(GenerateServiceUnitDescriptorMojo.java:185)
>          ... 20 more
> -------------------------------------------------------------------------------------
>
> My system.properties is containg
> location.value=http://0.0.0.0:8080/amh/
>
>

Re: SMX3 & env variable

Posted by the_biswa <bi...@gmail.com>.
Hi JB

I've done what you've suggested to make my http:consumer definition look
like the following
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
	   <http:consumer service="b:httpConsumerGateway"
                 endpoint="endpoint"
                 locationURI="${location.value}"
                 defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
                 targetService="b:messagingService" />

But now while building the application using maven it's giving me the
following WARNING

----------------------------------------------------------------------------------------
org.apache.servicemix.maven.plugin.jbi.JbiPluginException: Unable to
generate service unit descriptor!
        at
org.apache.servicemix.maven.plugin.jbi.GenerateServiceUnitDescriptorMojo.generateJbiDescriptor(GenerateServiceUnitDescriptorMojo.java:206)
        at
org.apache.servicemix.maven.plugin.jbi.GenerateServiceUnitDescriptorMojo.execute(GenerateServiceUnitDescriptorMojo.java:143)
        at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        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.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
Invalid bean definition with name
'org.apache.servicemix.http.endpoints.HttpConsumerEndpoint#0' defined in URL
[file:/D:/abacus/workspace/Testing/aws-http-consumer-gateway-su/src/main/resources/xbean.xml]:
Could not resolve placeholder 'location.value'
        at
org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:268)
        at
org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75)
        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.AbstractXBeanServiceUnitAnalyzer.init(AbstractXBeanServiceUnitAnalyzer.java:90)
        at
org.apache.servicemix.maven.plugin.jbi.GenerateServiceUnitDescriptorMojo.generateJbiDescriptor(GenerateServiceUnitDescriptorMojo.java:185)
        ... 20 more
-------------------------------------------------------------------------------------

My system.properties is containg
location.value=http://0.0.0.0:8080/amh/


-- 
View this message in context: http://servicemix.396122.n5.nabble.com/SMX3-env-variable-tp421193p3219063.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: SMX3 & env variable

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

you need to define a PropertyPlaceholderConfigurer to be able to use 
system variable.

<bean 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" 
/>

In an OSGi blueprint environment you can use ConfigAdmin

<cm:property-placeholder id="property-placeholder" persistent-id="your-id">
   <cm:default-properties>
     <cm:property name="variable" value="value"/>
   </cm:default-properties>
</cm:property-placeholder>

Regards
JB

On 10/19/2010 02:25 PM, the_biswa wrote:
>
> On the same line I wanted to know one thing.
> I've defined some variables in<servicemixhome>/etc/system.properties file
> I want to dynamically load the locationURI value of<http:consumer .../>
> endpoint from the aforesaid system.properties.
>
> below is my http:consumer definition
>
>   <http:consumer service="b:httpConsumerGateway"
>                   endpoint="endpoint"
>                   locationURI="${location}"
>                   defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
>                   targetService="b:srsGateway"/>
>
> but while deploying the SA it is throwing MalformedURLException. where am I
> going wrong. What is the process to do that?

Re: SMX3 & env variable

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

I noticed you are use /etc/..., so I assume you are with SMX4, as SMX3  
has no etc folder.
For SMX4 which basically is a OSGi container, you should use OSGi  
way's properties place holder which underlying leverage ConfigAdmin  
service, take a look at camel-osgi example (README.txt) shipped with  
kit which demonstrate how to use it.

Freeman
On 2010-10-19, at 下午8:25, the_biswa wrote:

>
> On the same line I wanted to know one thing.
> I've defined some variables in <servicemixhome>/etc/ 
> system.properties file
> I want to dynamically load the locationURI value of  
> <http:consumer .../>
> endpoint from the aforesaid system.properties.
>
> below is my http:consumer definition
>
> <http:consumer service="b:httpConsumerGateway"
>                 endpoint="endpoint"
>                 locationURI="${location}"
>                 defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
>                 targetService="b:srsGateway"/>
>
> but while deploying the SA it is throwing MalformedURLException.  
> where am I
> going wrong. What is the process to do that?
> -- 
> View this message in context: http://servicemix.396122.n5.nabble.com/SMX3-env-variable-tp421193p3218956.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


-- 
Freeman Fang

------------------------
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Open Source SOA: http://fusesource.com
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org