ClassNotFoundException during start but working?!
Asked by Philipp Meyer:

Hello out there,

i'm wondering why am i getting the following error in the console when i start my plugin via atlas-package, but everything is working fine though when the plugin is running. I'm trying to get rid of this error in the console but can't find the problem.

The Error:

```
[INFO] [talledLocalContainer] org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with
name 'tx-processor' defined in URL [bundle://292.0:0/META-INF/spring/atlassian-plugins-components.xml]: Unsatisfied dep
endency expressed through constructor argument with index 0 of type [com.atlassian.activeobjects.external.ActiveObjects]
: Cannot find class [de.mycompany.confluence.service.FieldDefinitionServiceImpl] for bean with name 'field-definition-servi
ce' defined in URL [bundle://292.0:0/META-INF/spring/atlassian-plugins-components.xml]; nested exception is java.lang.Cl
assNotFoundException: de.mycompany.confluence.service.FieldDefinitionServiceImpl not found from bundle [de.mycompany.confluenc
e.custom-field-plugin-enterprise]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: C
annot find class [de.mycompany.confluence.service.FieldDefinitionServiceImpl] for bean with name 'field-definition-service'
defined in URL [bundle://292.0:0/META-INF/spring/atlassian-plugins-components.xml]; nested exception is java.lang.Class
NotFoundException: de.mycompany.confluence.service.FieldDefinitionServiceImpl not found from bundle [de.mycompany.confluence.c
ustom-field-plugin-enterprise]
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(Con
structorResolver.java:749)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(Con
structorResolver.java:185)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowire
Constructor(AbstractAutowireCapableBeanFactory.java:1143)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBe
anInstance(AbstractAutowireCapableBeanFactory.java:1046)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreate
Bean(AbstractAutowireCapableBeanFactory.java:510)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBe
an(AbstractAutowireCapableBeanFactory.java:482)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBea
nFactory.java:306)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(D
efaultSingletonBeanRegistry.java:230)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanF
actory.java:302)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFac
tory.java:202)
[INFO] [talledLocalContainer] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplic
ationContext.java:1060)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationCon
text.registerBeanPostProcessors(AbstractDelegatedExecutionApplicationContext.java:511)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationCon
text.registerBeanPostProcessors(AbstractDelegatedExecutionApplicationContext.java:451)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationCon
text$4.run(AbstractDelegatedExecutionApplicationContext.java:306)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(Priv
ilegedUtils.java:85)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationCon
text.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:290)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterA
pplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:137)
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[INFO] [talledLocalContainer] at java.lang.Thread.run(Thread.java:748)
[INFO] [talledLocalContainer] Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find cla
ss [de.mycompany.confluence.service.FieldDefinitionServiceImpl] for bean with name 'field-definition-service' defined in UR
L [bundle://292.0:0/META-INF/spring/atlassian-plugins-components.xml]; nested exception is java.lang.ClassNotFoundExcept
ion: de.mycompany.confluence.service.FieldDefinitionServiceImpl not found from bundle [de.mycompany.confluence.custom-field-pl
ugin-enterprise]
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(Abstra
ctBeanFactory.java:1352)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determin
eTargetType(AbstractAutowireCapableBeanFactory.java:628)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictB
eanType(AbstractAutowireCapableBeanFactory.java:597)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractB
eanFactory.java:1445)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesFo
rType(DefaultListableBeanFactory.java:445)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForT
ype(DefaultListableBeanFactory.java:415)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors
(BeanFactoryUtils.java:220)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCand
idates(DefaultListableBeanFactory.java:1177)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDepende
ncy(DefaultListableBeanFactory.java:1116)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependenc
y(DefaultListableBeanFactory.java:1014)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgumen
t(ConstructorResolver.java:813)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(Con
structorResolver.java:741)
[INFO] [talledLocalContainer] ... 19 more
[INFO] [talledLocalContainer] Caused by: java.lang.ClassNotFoundException: de.mycompany.confluence.service.FieldDefinitionS
erviceImpl not found from bundle [de.mycompany.confluence.custom-field-plugin-enterprise]
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.util.BundleDelegatingClassLoader.findClass(BundleDelegat
ingClassLoader.java:139)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.util.BundleDelegatingClassLoader.loadClass(BundleDelegat
ingClassLoader.java:211)
[INFO] [talledLocalContainer] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[INFO] [talledLocalContainer] at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(Abs
tractBeanDefinition.java:394)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(Abst
ractBeanFactory.java:1397)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(Abstra
ctBeanFactory.java:1344)
[INFO] [talledLocalContainer] ... 30 more
[INFO] [talledLocalContainer] Caused by: java.lang.ClassNotFoundException: de.mycompany.confluence.service.FieldDefinitionS
erviceImpl not found by de.mycompany.confluence.custom-field-plugin-enterprise [292]
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWir
ingImpl.java:1532)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringI
mpl.java:1955)
[INFO] [talledLocalContainer] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[INFO] [talledLocalContainer] at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1844)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:937)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.util.BundleDelegatingClassLoader.findClass(BundleDelegat
ingClassLoader.java:135)
[INFO] [talledLocalContainer] ... 36 more
```

My plugin.xml

```
<component key="tx-processor" name="Transactional Annotation Processor"
         class="com.atlassian.activeobjects.external.TransactionalAnnotationProcessor">
   <description>Processes @Transactional annotations.</description>
</component>

<!-- used this compnent import; replaced it with @Component in the class itself. 
 <component key="field-definition-service" name="Field Definition Service" class="de.mycompany.confluence.service.FieldDefinitionServiceImpl"/> -->
```

The interface:

```
package de.mycompany.confluence.service;

import com.atlassian.activeobjects.tx.Transactional;

@Transactional
public interface FieldDefinitionService {
            // some methods to implement
}
```

The implementation:

```
package de.mycompany.confluence.service;

import com.atlassian.activeobjects.external.ActiveObjects;


// Imported all of those to test some different annotations...
import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Scanned
@Component
public class FieldDefinitionServiceImpl implements FieldDefinitionService {

    private final static Logger LOGGER = LoggerFactory.getLogger(FieldDefinitionServiceImpl.class);

    private final ActiveObjects ao;

    @Autowired
    public FieldDefinitionServiceImpl(@ComponentImport final ActiveObjects ao) {
        this.ao = checkNotNull(ao, "Active Objects Null @FieldDefinitionServiceImpl constructor");
    }

    
    // Method implementations...
```

I don't get where the actual problem is here.. maybe someone can help?

Thanks in advance!


Answers:
author: Stephen Sifers
body: Hello Philipp,

Something to be aware of is this is a support community and not often browsed by developers. We want to ensure you get the responses and answers you need so we would suggest you check out the [Developer Community](https://community.developer.atlassian.com/). The [Developer Community](https://community.developer.atlassian.com/) may have more available resources to answer or address your developer questions.

Regards,  
Stephen Sifers


Tags: atl-adm

atl-dev

confluence-server

server