Java libraries question on compile errors

We have a weird Java compile error. After importing a new module the application runs perfect local but when trying to make a deploy package we get the error below. Now it must be something with duplicated libraries and I found something that could be the problem. We have a couple of servicemix jar files like org.apache.servicemix.bundles.commons-codec-1.3.0.jar. Since this looks like just some kind of wrapper around another jar coudl this be the source of our problems? I have never experienced before that the model would run (with no compile errors) while creating the mda package fails due to compilation errors. Anybody a guess what might go wrong here? Regards, Ronald Buildfile: C:\Users\Ronald\AppData\Local\Temp\tmpAA0B.tmp\deployment\build_core.xml compile: [javac] Compiling 1185 source files to C:\Users\Ronald\AppData\Local\Temp\tmpAA0B.tmp\deployment\run\bin [javac] C:\Users\Ronald\AppData\Local\Temp\tmpAA0B.tmp\javasource\pushnotifications\implementation\gcm\ error: non-static method addExtensionProvider(String,String,Object) cannot be referenced from a static context [javac] ProviderManager.addExtensionProvider(GCM_ELEMENT_NAME, GCM_NAMESPACE, [javac] ^ [javac] C:\Users\Ronald\AppData\Local\Temp\tmpAA0B.tmp\javasource\pushnotifications\implementation\gcm\ error: method does not override or implement a method from a supertype [javac] @Override [javac] ^ [javac] C:\Users\Ronald\AppData\Local\Temp\tmpAA0B.tmp\javasource\pushnotifications\implementation\gcm\ error: method does not override or implement a method from a supertype [javac] @Override [javac] ^ [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [javac] Note: Some input files use unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [javac] 3 errors BUILD FAILED C:\Users\Ronald\AppData\Local\Temp\tmpAA0B.tmp\deployment\build_core.xml:27: Compile failed; see the compiler error output for details. [EDIT] After the answer of Jasper I started digging. Could it be that we have a clash here of classes with the same name? The smack library has the class ProviderManager and the spring security library also. How does Java handles these class name conflicts? It would explain why in the demo project everything worked, but as soon as I imported the module in our master model I get these conflicts.
2 answers

It indeed seems strange that such a compile error would not show up locally. If you do a fresh checkout of your project and redeploy locally, does it still work?

As for the compile errors: the first one is telling you that either you need to instantiate ProviderManager first before you can call addExtensionProvider on it, or you need to declare the addExtensionProvider method static.

The second and third one are telling you that an @Override annotation shouldn't be used when you are not actually overriding/implementing methods from an interface or superclass of LoggingConnectionListener.


A while ago I notice a difference in the class/library loading between eclipse and the modeler. It would be possible that there is also a small difference with our cloud environment.

The difference I noticed was the order in which libraries where included in the classpath. Normally this doesn't give any issues. At least not if every class only exists once in your project.

But if you would have multiple versions of you ProviderManager class in the userlib folder, 1 version has this method declared as static, the second has the method defined as non-static.
Depending on the order in which the libraries are included in the classpath it uses one of the two libraries. I noticed in eclipse that the order of libraries is alphabetic.

I would recommend trying to find which class you are using, through eclipse you should be able to find the library that is referenced there. If you would remove that library, eclipse would probably start using the other library. At least that gives you insight in the libraries, after that you can make the decision if you could remove one of the libraries or experiment with the lib names to see if that makes a difference.