A: 

Actually, I think it is. The first constructor argument you pass to the Jakarta object is of type abc.def.mdd.msg.alarm.huawei.MDDPackagerAlarmM2000, but the ctor wants a String. Make the types match properly.

It reads as a straight-forward message. What am I missing?

I'll assume from the package structure that those are your classes. True?

duffymo
But isn't the point that his arguments *do* match a constructor? Just that Spring doesn't seem to think so?
oxbow_lakes
I must be tired. Sorry, I missed it.
duffymo
The other part of the question of course is which constructor is it actually considering. According to the log it has decided to ignore one of them, as it should. Why does it think it needs a String argument? Or is the String requirement an artefact of choosing the wrong constructor?
A: 

Are you in control of the AlarmChannel class? If so, can you roll a new version which has a print statement in the constructor (also you could use try-catch within a static initializer to get a stack trace from where the class is being initialized from)?

That way, you might get some idea of whether there are duplicate classes involved

Also in the Spring config file you could cause the ClassLoader to be printed out using a MethodInvokingFactoryBean - this might also shed some light on the matter?

oxbow_lakes
Unfortunately, I control the container but not the software that is being executed. I was able to get the constructor signatures and the Spring fragments but I will not be able to access/modify any of the executing code.
Can you subclass AlarmChannel and add the info, or is it final?
oxbow_lakes
I have no direct access to the software running in the container. Anything that I do has to be done in the container manager.
I'm a bit confused; sorry. Then how do you know what the contructor signatures of the AlarmChannel look like?Can you debug the Spring container where it is actually taking the class name and trying to find the contructor? Or roll your own app context with appropriate logging statements?
oxbow_lakes
I asked the vendor for the constructor signatures but I cannot get full source code. I am trying to construct an environment to duplicate (logically at least) the environment.
Have you verified that the class signatures are correct using javap? Maybe Spring is right and they are wrong?
oxbow_lakes
+3  A: 

From the error message, it sounds like Spring is attempting to instantiate the object with this constructor:

public M2000AlarmChannel(String host, int port, String username, String password, MDDComponent componenet)

Looks like Spring is confused on which constructor to use, possibly because both constructors have a MDDComponent parameter (in a way, both constructors have this as their last parameter, I'm curious if that has something to do with the logic that Spring uses in determining which constructor to use. Anyway...).

According to the Spring manual, there are parameters you can add to the <constructor-arg> element to help the container resolve which constructor to use:

You can add "type":

<bean id="exampleBean" class="examples.ExampleBean">
  <constructor-arg type="int" value="7500000"/>
  <constructor-arg type="java.lang.String" value="42"/>
</bean>

or you can add an index:

<bean id="exampleBean" class="examples.ExampleBean">
  <constructor-arg index="0" value="7500000"/>
  <constructor-arg index="1" value="42"/>
</bean>

(You can probably specify both, if you really want to)

Adding one or both of these should help Spring resolve which constructor to use.

As a corollary, if this doesn't help, can you simply change the XML definition to pass in the parameters required for the other constructor, the one Spring is attempting to use?

BTW, it might make your question a lot more readable to use the quote tags within WMD.

matt b
Sorry, I forgot to mention that the application runs fine standalone, ie. not within a container.
You mean "standalone" as in using Spring, but not your home-brewed app container?
matt b
That is correct.
Then you might want to look into checking if somehow a different version of the class abc.def.mdd.channel.corba.M2000AlarmChannel is on the classpath
matt b
have you tried isolating this app, e.g. running it by itself in your container? If you are running other apps in the same JVM, shut down all and try this one on its own.
Rocket Surgeon
Yes, we are running only one app in the container.
Have you added the 'type' and/or 'index' attributes as I mentioned above and are still getting the same errors?
matt b
The client site is in another country (Indonesia). There are difficulties, I am working on it.
I am trying to construct an environment to duplicate (logically at least) the environment.