Fuse Integration Services - ClassNotFound

Posted on

Hi,

I have deployed a bundled app (camel route) with Openshift using the fis-karaf-openshift image, however I am running into issues.
I will start off by saying that the app runs fine in a standalone JBoss Fuse instance on a virtual machine.

It requires a few private custom bundles which I have hosted in a private artifact repository.
I have added the required bundles to both the pom file for the maven build and for the karaf maven plugin.
The build is successful within OpenShift, but the when the app goes to run I get a class not found error.

Here is the error from the pod's log:

2016-11-04 09:54:49,514 | ERROR | ExtenderThread-2 | ContextLoaderListener | 41 - org.springframework.osgi.extender - 1.2.1 | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=<bundle name>, config=osgibundle:/META-INF/spring/*.xml)) 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'beanName' defined in URL [bundle://48.0:0/META-INF/spring/camelContext.xml]: Invocation of init method failed; nested exception is javax.naming.NoInitialContextException: Cannot instantiate class: com.sample.<MISSING CLASS NAME> [Root exception is java.lang.ClassNotFoundException: com.sample.<MISSING CLASS NAME> not found from bundle [<bundle name>]] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514)[25:org.apache.servicemix.bundles.spring-beans:3.2.12.RELEASE_2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)[25:org.apache.servicemix.bundles.spring-beans:3.2.12.RELEASE_2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)[25:org.apache.servicemix.bundles.spring-beans:3.2.12.RELEASE_2]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)[25:org.apache.servicemix.bundles.spring-beans:3.2.12.RELEASE_2]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)[25:org.apache.servicemix.bundles.spring-beans:3.2.12.RELEASE_2]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)[25:org.apache.servicemix.bundles.spring-beans:3.2.12.RELEASE_2]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)[25:org.apache.servicemix.bundles.spring-beans:3.2.12.RELEASE_2]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:618)[25:org.apache.servicemix.bundles.spring-beans:3.2.12.RELEASE_2]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)[20:org.apache.servicemix.bundles.spring-context:3.2.12.RELEASE_2]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[27:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[27:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[27:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[27:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[41:org.springframework.osgi.extender:1.2.1]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]
 ~~~

**Here is my karaf-maven-plugin config (note bundle-abc and bundle-xyz)**

        <!-- 2. create karaf assembly -->
        <!-- karaf-maven-plugin creates custom microservice distribution -->
        <plugin>
            <groupId>org.apache.karaf.tooling</groupId>
            <artifactId>karaf-maven-plugin</artifactId>
            <version>${karaf.plugin.version}</version>
            <extensions>true</extensions>
            <executions>
                <execution>
                    <id>karaf-assembly</id>
                    <goals>
                        <goal>assembly</goal>
                    </goals>
                    <phase>install</phase>
                </execution>
                <execution>
                    <id>karaf-archive</id>
                    <goals>
                        <goal>archive</goal>
                    </goals>
                    <phase>install</phase>
                </execution>
            </executions>
            <configuration>
                <karafVersion>v24</karafVersion>
                <javase>1.8</javase>
                <useReferenceUrls>true</useReferenceUrls>
                <!-- do not include build output directory -->
                <includeBuildOutputDirectory>false</includeBuildOutputDirectory>
                <startupFeatures>
                    <feature>karaf-framework</feature>
                    <feature>shell</feature>
                    <feature>jaas</feature>
                    <feature>spring</feature>
                    <feature>camel-spring</feature>
                    <feature>camel-jms</feature>
                    <feature>camel-jmx</feature>
                    <feature>camel-spring-javaconfig</feature>
                </startupFeatures>
                <startupBundles>
                    <!-- this needs to be here for spring-dm to resolve properly!! -->
                    <bundle>mvn:org.apache.karaf.bundle/org.apache.karaf.bundle.core/3.0.4</bundle>
                    <!-- <bundle>mvn:io.fabric8.mq/mq-client/2.2.0.redhat-079</bundle> -->
                    <bundle>mvn:io.fabric8/fabric8-utils/2.2.0.redhat-079</bundle>
                    <!-- Custom Bundles -->
                    <bundle>mvn:com.sample/bundle-abc/7.1.2.226</bundle>
                    <bundle>mvn:com.sample/bundle-xyz/7.1.2.226</bundle>
                    <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
                </startupBundles>
            </configuration>
        </plugin>

~~~

The required bundles do show up in the cat /deployments/karaf/etc/startup.properties file on the pod and the jars are present on the filesystem.

Any ideas as to how to fix this? Not sure why I'm getting ClassNotFound when the class should already be deployed in a required bundle.....

Responses