4 Replies Latest reply on Jul 9, 2010 8:46 PM by njiang

    java.lang.IllegalStateException in thread "SpringOsgiExtenderThread-XX"

    garyyark

      Hi,

       

      I'm going through Adrian Trenaman's tutorial (Getting started with ESB: Use case 4: http://download.progress.com/open/progress/fuse_esb/deploying_enterprise_integration_pattern_into_fuse_esb4.mov ).

       

      I'm getting this exception on starting the bundle "payments-batch-incoming-endpoints". I can build and install it, but when I try to start it, I'm getting an exception. The jar is attached also:

       

      Any help is greatly appreciated!

       

      karaf@root> install mvn:com.progress.pso/payments-batch-incoming-endpoints

      Bundle ID: 193

       

      karaf@root> start 193

       

      karaf@root> Exception in thread "SpringOsgiExtenderThread-52" java.lang.IllegalStateException: BeanFactory not initializ

      ed or already closed - call 'refresh' before accessing beans via the ApplicationContext

              at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableA

      pplicationContext.java:153)

              at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.cl

      ose(DependencyWaiterApplicationContextExecutor.java:345)

              at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.fa

      il(DependencyWaiterApplicationContextExecutor.java:401)

              at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.st

      ageOne(DependencyWaiterApplicationContextExecutor.java:287)

              at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.re

      fresh(DependencyWaiterApplicationContextExecutor.java:175)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegat

      edExecutionApplicationContext.java:175)

              at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:7

      18)

              at java.lang.Thread.run(Thread.java:619)

       

      karaf@root>

        • 1. Re: java.lang.IllegalStateException in thread "SpringOsgiExtenderThread-XX"
          garyyark

          Actually, I think I found the problem but not sure how to fix it. There is a mismatch of namespaces. Line 2 imports new namespace (gets redirected), but the old one is expected (activemq). Changing name space in 

          camelContext did not work.

           

          Line 2 in XML document from URL bundleentry://193.fwk32755292/META-INF/spring/bundle-context.xml is invalid; nested exception is org.xml.sax.SAXParseException: TargetNamespace.1: Expecting namespace 'http://activemq.apache.org/camel/schema/spring', but the target namespace of the schema document is 'http://camel.apache.org/schema/spring'.

           

           

           

          16:35:59,165 | INFO  | l Console Thread | ultOsgiApplicationContextCreator | ultOsgiApplicationContextCreator   67 | Dis

          covered configurations in bundle [payments-batch-incoming-endpoints (com.progress.ps

          o.payments-batch-incoming-endpoints)]

          16:35:59,165 | INFO  | xtenderThread-52 | OsgiBundleXmlApplicationContext  | pport.AbstractApplicationContext  411 | Refreshing org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@7ff57c: display name OsgiBundleXmlApplicationContext(bundle=com.progress.pso.payments-batch-incoming-endpoints, config=osgibundle:/META-INF/spring/*.xml); startup date ; root of context hierarchy

          16:35:59,165 | INFO  | xtenderThread-52 | OsgiBundleXmlApplicationContext  | ractOsgiBundleApplicationContext  359 | Unpublishing application context OSGi service for bundle payments-batch-incoming-endpoints (com.progress.pso.payments-batch-incoming-endpoints)

          16:35:59,165 | INFO  | xtenderThread-52 | XmlBeanDefinitionReader          | tory.xml.XmlBeanDefinitionReader  323 | Loading XML bean definitions from URL bundleentry://193.fwk32755292/META-INF/spring/bundle-context-osgi.xml

          16:35:59,197 | INFO  | xtenderThread-52 | XmlBeanDefinitionReader          | tory.xml.XmlBeanDefinitionReader  323 | Loading XML bean definitions from URL bundleentry://193.fwk32755292/META-INF/spring/bundle-context.xml

          16:36:00,493 | ERROR | xtenderThread-52 | ContextLoaderListener            | BundleApplicationContextListener   50 | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=com.progress.pso.payments-batch-incoming-endpoints, config=osgibundle:/META-INF/spring/*.xml))org.springframework.beans.factory.xml.

          XmlBeanDefinitionStoreException: Line 2 in XML document from URL bundleentry://193.fwk32755292/META-INF/spring/bundle-context.xml is invalid; nested exception is org.xml.sax.SAXParseException: TargetNamespace.1: Expecting namespace 'http://activemq.apache.org/camel/schema/spring', but the target namespace of the schema document is 'http://camel.apache.org/schema/spring'.

                  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)

                  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)

                  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)

                  at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)

                  ...................................................

          Caused by: org.xml.sax.SAXParseException: TargetNamespace.1: Expecting namespace 'http://activemq.apache.org/camel/schema/spring', but the target namespace of the schema document is 'http://camel.apache.org/schema/spring'.

                  at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:

          195)

                  at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)

                  at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)

                  at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:2537)

                  at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:2528)

                  at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:768)

                  at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:569)

                  at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:552)

                  at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2436)

           

                  at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1781

          )

                  at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705)

                  at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.ja

          va:400)

                  at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocument

          FragmentScannerImpl.java:2755)

                  at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)

                  at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)

                  at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScanne

          rImpl.java:511)

                  at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)

                  at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)

                  at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)

                  at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)

                  at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)

                  at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)

                  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.j

          ava:396)

                  ... 18 more

          17:16:07,290 | ERROR | Timer-1          | DelegatingTimerTask              | duling.timer.DelegatingTimerTask   69 | Une

          xpected exception thrown from Runnable: org.springframework.osgi.extender.internal.util.concurrent.RunnableTimedExecutio

          n$MonitoredRunnable@a3ada8

          java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

                  at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:153)

                  at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.close(DependencyWaiterApplicationContextExecutor.java:345)

                  at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.doClose(AbstractDelegatedExecutionApplicationContext.java:236)

                  at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:794)

                  at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$3.run(ContextLoaderListener.java:807)

                  at org.springframework.osgi.extender.internal.util.concurrent.RunnableTimedExecution$MonitoredRunnable.run(Runna

          bleTimedExecution.java:60)

                  at org.springframework.scheduling.timer.DelegatingTimerTask.run(DelegatingTimerTask.java:66)

                  at java.util.TimerThread.mainLoop(Timer.java:512)

                  at java.util.TimerThread.run(Timer.java:462)

           

          karaf@root>

          • 2. Re: java.lang.IllegalStateException in thread "SpringOsgiExtenderThread-XX"
            njiang

            Which version of Fuse ESB are you using?

            If you are using latest Fuse ESB 4.2.0, you need to update the camelContext's namespace with the "http://camel.apache.org/schema/spring", because it's using Camel 2.x now.

            You may also need to compile the RouteBuilder again with Camel 2.x.

             

            If you are using Fuse ESB 4.0.x, which still uses Camel 1.x, you can work around that kind of issue with this FAQ entry

             

            Willem

            • 3. Re: java.lang.IllegalStateException in thread "SpringOsgiExtenderThread-XX"
              garyyark

              Thank you, Willem, for the reply.

               

              I'm using 4.2. Looks like this example is incompatible with Camel 2. The camelContext schema has changed. Recompiling 4.2 with Camel 1 does not make sense. Somehow examples in 4.2 don't have file pollers/file writers. Are these components part of the default configuration?

               

              Another question - I could not find Fuse 4.0 download - the link to "previous" release shows 4.1, but clicking on it, brings 3.4 download.

               

              I'm looking for a distribution to run these example as they are very close to what I'm trying to prototype: file to JMS bridging. Once again, 4.2 does not seem to have this example. Is there a way to get a working file to JMS example for 4.2 in Eclipse.

               

              Thank you!

              gary

              • 4. Re: java.lang.IllegalStateException in thread "SpringOsgiExtenderThread-XX"
                njiang

                You can find the file to jms example from the camel examples, and it can be deployed into Fuse ESB without any issue.

                You can find the examples after you download the Fuse MR 2.x.