Hi,

I had some neat logic to wrap various SVN plugins, and augment my builds 
with certain SCM info, call this PluginA (this has various SCM plugins as 
maven dependencies - e.g. *org.jenkins-ci.plugins:git:2.1.0*)

Recently I wanted to reuse that logic in another plugin (which gets 
deployed on the same master(s)), call this PluginB...

   1. I first tried to reference PluginA from PluginB (using Maven 
   dependencies), this kind of worked in the sense I could use my nice SCM 
   classes, however it also bundled the entire plugin and duplicated all its 
   functionality.
   2. So I moved the re-usable logic into its own library, let's call it 
   SharedLib (which has the various SCM plugins as maven dependencies - 
   e.g. *org.jenkins-ci.plugins:git:2.1.0*), this SharedLib is *packed as 
   jar*
   3. PluginA and PluginB list SharedLib as a dependency, and get deployed 
   to the same master (but not in all cases - so the solution isn't just to 
   make one giant plugin.)
   4. PluginA can still nicely augment my builds with the right 
   information, and PluginB can use the logic how it wants.
   5. Following restart I get hundreds of *InstantiationError*, *the 
   plugins both work fine when standalone*, only when they come together 
   and only after restart do they run into issues!!

04-Sep-2014 17:32:24 hudson.util.RobustReflectionConverter doUnmarshal
WARNING: Failed to resolve a type
*java.lang.InstantiationError: com.company.jenkins.scm.SCM*
at 
sun.reflect.GeneratedSerializationConstructorAccessor33.newInstance(Unknown 
Source)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at 
com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.newInstance(Sun14ReflectionProvider.java:76)
at 
hudson.util.RobustReflectionConverter.instantiateNewInstance(RobustReflectionConverter.java:376)
at 
hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:221)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at 
com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at 
hudson.util.RobustReflectionConverter.unmarshalField(RobustReflectionConverter.java:333)
at 
hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:275)
at 
hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:222)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at 
com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at 
com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
at 
hudson.util.RobustCollectionConverter.populateCollection(RobustCollectionConverter.java:85)
at 
com.thoughtworks.xstream.converters.collections.CollectionConverter.unmarshal(CollectionConverter.java:61)
at 
hudson.util.RobustCollectionConverter.unmarshal(RobustCollectionConverter.java:76)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at 
com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at 
hudson.util.RobustReflectionConverter.unmarshalField(RobustReflectionConverter.java:333)
at 
hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:275)
at 
hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:222)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at 
com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
at 
com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1061)
at hudson.util.XStream2.unmarshal(XStream2.java:109)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1045)
at hudson.XmlFile.unmarshal(XmlFile.java:166)
at hudson.model.Run.reload(Run.java:307)
at hudson.model.Run.<init>(Run.java:296)
at hudson.model.AbstractBuild.<init>(AbstractBuild.java:182)
at hudson.model.Build.<init>(Build.java:103)
at hudson.model.FreeStyleBuild.<init>(FreeStyleBuild.java:41)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at hudson.model.AbstractProject.loadBuild(AbstractProject.java:1120)
at hudson.model.AbstractProject$1.create(AbstractProject.java:317)
at hudson.model.AbstractProject$1.create(AbstractProject.java:315)
at hudson.model.RunMap.retrieve(RunMap.java:225)
at hudson.model.RunMap.retrieve(RunMap.java:59)
at 
jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:667)
at 
jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:650)
at 
jenkins.model.lazy.AbstractLazyLoadRunMap.all(AbstractLazyLoadRunMap.java:602)
at 
jenkins.model.lazy.AbstractLazyLoadRunMap.entrySet(AbstractLazyLoadRunMap.java:264)
at java.util.AbstractMap$2$1.<init>(AbstractMap.java:353)
at java.util.AbstractMap$2.iterator(AbstractMap.java:352)
at hudson.util.RunList.iterator(RunList.java:103)
at com.*company*.jenkins.scm.AutoAdder.autoAdd(AutoAdder.java:41)
at com.*company*.jenkins.scm.AutoAdder.autoAdd(AutoAdder.java:24)
at com.*company*.jenkins.scm.AutoAdder.onLoaded(AutoAdder.java:20)
at jenkins.model.Jenkins.<init>(Jenkins.java:850)
at hudson.model.Hudson.<init>(Hudson.java:81)
at hudson.model.Hudson.<init>(Hudson.java:77)
at hudson.WebAppMain$2.run(WebAppMain.java:214)
04-Sep-2014 17:32:24 hudson.util.RobustReflectionConverter doUnmarshal
*WARNING: Cannot convert type com.company.scm.SCMSummaryAction to type 
com.company.jenkins.scm.SCM*

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to