Migrating a project from 2.9.4 to 2.10.2

99 views
Skip to first unread message

nicolas.cou...@gmail.com

unread,
May 24, 2017, 8:37:25 AM5/24/17
to ddf-...@googlegroups.com
Hi!

I am trying to migrate a project from using version 2.9.4 to using 2.10.2. I am continuing the work of Samuel Pouchin, also a member of this group. 

Everything was working fine for 2.9.4, so I updated the dependencies to 2.10.2 and recompiled. I then attempted to deploy my kar file but it is as if the init method was not invoked. The bundle is using spring, so the main bean declaration looks like this:

<bean id="Mapper" class="csd.ddf.mapper.Mapper" scope="singleton" init-method="start" destroy-method="stop">
...

There are 2 bundles. Both get installed and are listed as active.

Does anyone have any idea as to why I get this behavior?


Steven Lombardi

unread,
May 26, 2017, 5:34:44 PM5/26/17
to ddf-users
Hello Nicolas: 

Could you please post the signature of your "start" method as it appears in "csd.ddf.mapper.Mapper". 

Also, are there any exceptions in the logs? 

nicolas.cou...@gmail.com

unread,
May 29, 2017, 9:09:38 AM5/29/17
to ddf-users
public void start()

I get no exception.

Steven Lombardi

unread,
May 30, 2017, 2:21:33 PM5/30/17
to ddf-users
Try the following: 

public void start() throws Exception

I think that Spring mandates the exception part of the signature. 

nicolas.cou...@gmail.com

unread,
May 31, 2017, 4:22:31 PM5/31/17
to ddf-users
I don't think that the version of spring framework changed from version 2.9.4 to 2.10.2, and it worked for version 2.9.4, but I tried your suggestion anyway. The start method still appears not to be called.

Steven Lombardi

unread,
Jun 1, 2017, 1:07:26 PM6/1/17
to ddf-users
Try using blueprint instead and see if you get the same issue. The syntax is nearly identical and spring is EoL anyways. 

At minimum this can serve as a test to verify our hypothesis. If blueprint does work, then I'd say that spring probably has an issue with the later karaf version. 

nicolas.cou...@gmail.com

unread,
Jun 8, 2017, 11:39:47 AM6/8/17
to ddf-users
So, I tried to convert my spring context file to blueprint but got an error while deploying. Here are a few excerpts from the log file:

org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to validate xml
...and a few lines below
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'map'. One of '{"http://www.osgi.org/xmlns/blueprint/v1.0.0":service, "http://www.osgi.org/xmlns/blueprint/v1.0.0":reference-list, "http://www.osgi.org/xmlns/blueprint/v1.0.0":bean, "http://www.osgi.org/xmlns/blueprint/v1.0.0":reference, WC[##other:"http://www.osgi.org/xmlns/blueprint/v1.0.0"]}' is expected.

Here is my blueprint.xml file, with the map part abstracted for a bit of information security:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
 http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.3.0.xsd"
>
 
<!-- Configuration section -->
 
<cm:property-placeholder persistent-id="CSD2DDF-Config">
 
<cm:property name="csdParameters" value="default" />
 
</cm:default-properties>
 
</cm:property-placeholder>


 
<reference id="CatalogFramework" interface="ddf.catalog.CatalogFramework" />
 
<reference id="SecurityManager" interface="ddf.security.service.SecurityManager" />



 
<bean id="Mapper" class="csd.ddf.mapper.Mapper" scope="singleton" init-method="start" destroy-method="stop">

 
<argument ref="CatalogFramework" />
 
<argument ref="ConnectionManager" />
 
<argument>
 
<map>
 
<entry key="some.key"
 
value="some value"/>
                                 ... a few other entries ...
 
</map>

 
</argument>
 
<argument ref="CsdInputTransformer" />
 
<argument>
 
<list></list>
 
</argument>
 
<argument ref="SecurityManager" />
 
</bean>
 
 
<bean id="ConnectionManager" class="csd.connection.ConnectionManager"
 
scope="singleton">
 
<property name="csdParameters" value="${csdParameters}" />
 
<property name="csdConnections" ref="ConnectionsMap"/>
 
<property name="csdSavedConnectionFilePath" value="default"/>
 
</bean>
 
 
<map id="ConnectionsMap" map-class="java.util.LinkedHashMap"/>


 
<bean id="CsdInputTransformer" class="ddf.csd.input.transformer.CsdInputTransformer" />


 
<bean id="CsdInterfaceManager" class="ca.dnd.lsec.isra.api.CsdInterfaceManager"
 
scope="singleton">
 
<argument name="clientApplicationName" value="CSD DDF Client" />
 
</bean>


 
<bean id="CSDstandingQueryListener" class="csd.queries.standing.CSDstandingQueryListener">
 
<property name="mapper" ref="Mapper" />
 
</bean>
 
 
<bean id="CsdConnection" class="csd.connection.CsdConnection">
 
<property name="csdParameters" ref="CsdParameters"/>
 
<property name="config" ref="Config"/>
 
</bean>
 
 
<bean id="CsdParameters" class="csd.connection.CsdConnectionParameters">
 
<property name="csdUser" value="default"/>
 
<property name="csdPassword" value="default"/>
 
<property name="iorLocationUrl" value="default"/>
 
</bean>
 
 
<bean id="Config" class="ca.dnd.lsec.isra.api.ClientConfig"/>
</blueprint>


I've been relying on reading the XSD to make the conversion. What is wrong with my file?
Message has been deleted

R.A. Porter

unread,
Jun 12, 2017, 2:00:39 PM6/12/17
to ddf-users
Nicolas,

I just want to confirm that you have a public constructor for your public class CsdInterfaceManager that looks like this:

public CsdInterfaceManager(String xxx) {
...
}


-R.A. Porter


On Monday, June 12, 2017 at 10:43:09 AM UTC-7, nicolas.cou...@gmail.com wrote:
So, I figured that my map element should not be a child of the blueprint element. I fixed it by moving it as a child of the argument element.

Now, I have a problem with the following part:

 <bean id="CsdInterfaceManager" class="ca.dnd.lsec.isra.api.CsdInterfaceManager"
 
scope="singleton">
 
<argument name="clientApplicationName" value="CSD DDF Client" />
 
</bean>

In my latest version, I removed the name attribute, but I get an error message stipulating that aries is unable to convert value to type class java.lang.String. Any suggestion on how to fix this?

nicolas.cou...@gmail.com

unread,
Jun 12, 2017, 3:42:54 PM6/12/17
to ddf-users
I actually made a mistake in my previous post. My problem is with csdParameters, which is supposed to be an array of strings.

I tried to change it to:

<cm:property name=csdParameters">
 
<array value-type="java.lang.String">
   
<value>Default</value>
 
</array>
</cm:property>


But I still get the same error (unable to convert value to type class).

R.A. Porter

unread,
Jun 13, 2017, 10:02:13 AM6/13/17
to ddf-users
Nicolas,

I then assume you have a method on your class with a signature like 
public void setCsdParameters(List<String> xxx) {
...
}


or
public void setCsdParameters(Set<String> xxx) {
...
}

or 
public void setCsdParameters(String[] xxx) {
...
}

-R.A. Porter

nicolas.cou...@gmail.com

unread,
Jun 13, 2017, 10:49:05 AM6/13/17
to ddf-users
I do.

Brendan Hofmann

unread,
Jun 13, 2017, 11:01:31 AM6/13/17
to ddf-users
Nicolas,
Looking back at your full blueprint, it looks like you are pulling the property element from the cm namespace. For a bundle I think you'd want the blueprint property element. Can you try the following?

<property name=csdParameters">
 
<array value-type="java.lang.String">
   
<value>Default</value>
 
</array>
</property>

nicolas.cou...@gmail.com

unread,
Jun 14, 2017, 8:18:03 AM6/14/17
to ddf-users
According to the xsd, a property element cannot be the direct child of the blueprint element. This is a config admin property or something; this is not a regular property.

R.A. Porter

unread,
Jun 14, 2017, 9:23:55 AM6/14/17
to ddf-users
Nicolas,

At this point I think it would be helpful if you could post your blueprint.xml file. Seeing out-of-context snippets of it are not giving us enough information to help you. It might also help if you could post your implementation class or, more precisely, a sanitized version of it. We don't need to see your class internals, but seeing the constructors, setters, and getters along with your blueprint definition would help us determine the issue here.

-R.A. Porter

R.A. Porter

unread,
Jun 14, 2017, 10:16:59 AM6/14/17
to ddf-users
Nicolas,

Brendan pointed me to the blueprint file you'd included earlier in the chain; I apologize for having forgotten it was there. I do see at least one problem with it which I'd like you to confirm is not present in your current file. This section in question

<!-- Configuration section -->
 
<cm:property-placeholder persistent-id="CSD2DDF-Config">
 
<cm:property name="csdParameters" value="default" />
 
</cm:default-properties>
 
</cm:property-placeholder>

is invalid XML. It is missing the opening tag for the <cm:default-properties> element. I can't see how this would be likely to be your problem; as invalid XML this file would not be parseable. However, I did want to confirm that the blueprint we are looking at is at least similar to that which you are deploying.

-R.A. Porter

nicolas.cou...@gmail.com

unread,
Jun 14, 2017, 11:10:09 AM6/14/17
to ddf-users
I mistyped it. I have my opening tag in my original file. I couldn't  copy and paste it because I'm woking on an offline computer.

R.A. Porter

unread,
Jun 14, 2017, 12:41:50 PM6/14/17
to ddf-users
Good to know.

In your CSD2DDF-Config.cfg file, what does the value of the csdParameters property look like? Simple string, comma-delimited string, or something else?

And in your ConnectionManager class, what is signature of your setCsdParameters() method?

-R.A. Porter

nicolas.cou...@gmail.com

unread,
Jun 14, 2017, 2:09:03 PM6/14/17
to ddf-users
I don't think I have a CSD2DDF-Config.cfg file. Should I?

public void setCsdParameters(String[] csdParameters)

Brendan Hofmann

unread,
Jun 14, 2017, 3:11:08 PM6/14/17
to ddf-users
It is not required.

I can find no instance either in our codebase or online of anyone referencing an array inside of a property-placeholder. It is possible that this is not supported. You could try declaring it as a list instead, or you could declare your default as a delimited string and split that string on the delimiter inside of your bean.

R.A. Porter

unread,
Jun 14, 2017, 3:42:50 PM6/14/17
to ddf-users
I had asked if you had that config file because Karaf will look for a file matching $DDF_HOME/etc/[PERSISTENT-ID].cfg for loading properties (and the filename cannot contain a dash). However, since the only value you care about is the default, it's not necessary.

As to loading the array, I have not tested it but this should work (I removed the dash from your persistent-id):
    <cm:property-placeholder persistent-id="CSD2DDFConfig">
       
<cm:default-properties>
           
<cm:property name="csdParameters">
               
<array>
                   
<value type="java.lang.String">default</value>
               
</array>
           
</cm:property>
       
</cm:default-properties>
   
</cm:property-placeholder>


-R.A. Porter

R.A. Porter

unread,
Jun 19, 2017, 10:30:50 AM6/19/17
to ddf-users
Nicolas,

I wanted to check in with you to see if you've made progress. I hope things are finally working for you now.

-R.A. Porter

nicolas.cou...@gmail.com

unread,
Jun 20, 2017, 2:17:18 PM6/20/17
to ddf-users
No. It still doesn't work. But there's no rush as it is due for next year and we're probably going to switch to Alliance which has builtin support for CSD.
Reply all
Reply to author
Forward
0 new messages