3 Replies Latest reply on Sep 11, 2012 10:06 PM by njiang

    java.io.FileNotFoundException:

    anupradhan_anupradhan

      I am getting the following error when loading my hibernate configuration files

      My spring config file is attached. How can I load the hibernate files?

      java.io.FileNotFoundException: class path resource cannot be resolved to absolute file path because it does not reside in the file system: bundle://400.3:1/com/hcsc/bluezone/integration/daoimpl/hibernate/

           at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:205)

           at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:52)

           at org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingFileResources(PathMatchingResourcePatternResolver.java:526)

           at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:347)

           at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:279)

           at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1245)

           at org.springframework.core.io.support.ResourceArrayPropertyEditor.setAsText(ResourceArrayPropertyEditor.java:132)

           at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:434)

           at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:406)

           at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:163)

           at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470)

           at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516)

           at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:510)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1406)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1365)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

           at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)

           at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)

           at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)

           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)

           at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:400)

           at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:275)

           at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:139)

           at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.(ClassPathXmlApplicationContext.java:93)

           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

           at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:44)

           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)

           at java.lang.reflect.Constructor.newInstance(Constructor.java:516)

           at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)

           at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:110)

           at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:939)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

           at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)

           at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)

           at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)

           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)

           at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1097)

           at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:394)

           at com.hcsc.frameworkx.spring.web.context.DynamicContextLoader.loadParentContext(DynamicContextLoader.java:144)

           at com.hcsc.frameworkx.spring.web.context.DynamicContextLoader.configureAndRefreshWebApplicationContext(DynamicContextLoader.java:341)

           at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)

           at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)

           at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext$1.call(HttpServiceContext.java:169)

           at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext$1.call(HttpServiceContext.java:165)

           at org.ops4j.pax.swissbox.core.ContextClassLoaderUtils.doWithClassLoader(ContextClassLoaderUtils.java:60)

           at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.addEventListener(HttpServiceContext.java:162)

           at org.ops4j.pax.web.service.jetty.internal.JettyServerImpl.addEventListener(JettyServerImpl.java:242)

           at org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl$Started.addEventListener(ServerControllerImpl.java:276)

           at org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl.addEventListener(ServerControllerImpl.java:127)

           at org.ops4j.pax.web.service.internal.HttpServiceStarted.registerEventListener(HttpServiceStarted.java:286)

           at org.ops4j.pax.web.service.internal.HttpServiceProxy.registerEventListener(HttpServiceProxy.java:133)

           at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorWC.visit(RegisterWebAppVisitorWC.java:276)

           at org.ops4j.pax.web.extender.war.internal.model.WebApp.accept(WebApp.java:561)

           at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$HttpServiceListener.register(WebAppPublisher.java:170)

           at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$HttpServiceListener.serviceChanged(WebAppPublisher.java:155)

           at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$HttpServiceListener.serviceChanged(WebAppPublisher.java:119)

           at org.ops4j.pax.swissbox.tracker.ReplaceableService.setService(ReplaceableService.java:114)

           at org.ops4j.pax.swissbox.tracker.ReplaceableService.access$100(ReplaceableService.java:28)

           at org.ops4j.pax.swissbox.tracker.ReplaceableService$CollectionListener.serviceAdded(ReplaceableService.java:183)

           at org.ops4j.pax.swissbox.tracker.ServiceCollection$Tracker.addingService(ServiceCollection.java:181)

           at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:980)

           at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)

           at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:262)

           at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:185)

           at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:348)

           at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:283)

           at org.ops4j.pax.swissbox.tracker.ServiceCollection.onStart(ServiceCollection.java:139)

           at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle$Stopped.start(AbstractLifecycle.java:121)

           at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle.start(AbstractLifecycle.java:49)

           at org.ops4j.pax.swissbox.tracker.ReplaceableService.onStart(ReplaceableService.java:146)

           at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle$Stopped.start(AbstractLifecycle.java:121)

           at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle.start(AbstractLifecycle.java:49)

           at org.ops4j.pax.web.extender.war.internal.WebAppPublisher.publish(WebAppPublisher.java:81)

           at org.ops4j.pax.web.extender.war.internal.WebXmlObserver.doPublish(WebXmlObserver.java:304)

           at org.ops4j.pax.web.extender.war.internal.WebXmlObserver.addingEntries(WebXmlObserver.java:153)

           at org.ops4j.pax.swissbox.extender.BundleWatcher.register(BundleWatcher.java:186)

           at org.ops4j.pax.swissbox.extender.BundleWatcher.access$000(BundleWatcher.java:45)

           at org.ops4j.pax.swissbox.extender.BundleWatcher$1.bundleChanged(BundleWatcher.java:127)

           at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:870)

           at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:791)

           at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:515)

           at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4321)

           at org.apache.felix.framework.Felix.startBundle(Felix.java:1945)

           at org.apache.felix.framework.Felix.updateBundle(Felix.java:2306)

           at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:965)

           at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:952)

           at org.apache.karaf.shell.osgi.UpdateBundle.doExecute(UpdateBundle.java:37)

           at org.apache.karaf.shell.osgi.BundleCommand.doExecute(BundleCommand.java:42)

           at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)

           at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)

           at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)

           at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)

           at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)

           at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)

           at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)

           at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)

           at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)

           at org.apache.karaf.shell.console.jline.Console.run(Console.java:226)

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

        • 1. Re: java.io.FileNotFoundException:
          njiang

          Where did you put the configuration files?

          Did you put them in your application bundle?

          If not, can you put it there?

           

          Willem

          • 2. Re: java.io.FileNotFoundException:
            anupradhan_anupradhan

            The configuration files are in my application bundle.

            I don't have this error any more. Not sure what I changed to make it go away. But is gone for now.

            I now have a different error -

            Caused by: javax.naming.NoInitialContextException: Unable to determine caller's BundleContext

                 at org.apache.aries.jndi.OSGiInitialContextFactoryBuilder.getInitialContext(OSGiInitialContextFactoryBuilder.java:49)

                 at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:225)

                 at javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:327)

                 at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:357)

                 at javax.naming.InitialContext.internalInit(InitialContext.java:295)

                 at javax.naming.InitialContext.init(InitialContext.java:317)

                 at javax.naming.ldap.InitialLdapContext.(InitialLdapContext.java:103)

                 at org.springframework.ldap.core.support.LdapContextSource.getDirContextInstance(LdapContextSource.java:43)

                 at org.springframework.ldap.core.support.AbstractContextSource.createContext(AbstractContextSource.java:254)

            • 3. Re: java.io.FileNotFoundException:
              njiang

              Not sure what causes the BunndleContext is not injected rightly.

              It looks like you are using leverage Spring and Aries at the same time. Can you try to use the Aries blueprint to setup the application context ?

               

              Willem