java.net.MalformedURLException: unknown protocol: jndi

Spring JIRA | Barry Lagerweij | 1 decade ago
  1. 0

    Re-open of bug SPR-322 : When using references to DataSources and EJB references in the spring.xml file, the following exception is thrown: Nested exception is: org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition. Group resource name [classpath*:META-INF/bean-ref-factory.xml], factory key [root]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition resource pattern [classpath*:META-INF/bean-ref-factory.xml]; nested exception is java.net.MalformedURLException: unknown protocol: jndi org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition resource pattern [classpath*:META-INF/bean-ref-factory.xml]; nested exception is java.net.MalformedURLException: unknown protocol: jndi java.net.MalformedURLException: unknown protocol: jndi at java.net.URL.<init>(URL.java:544) at java.net.URL.<init>(URL.java:434) at java.net.URL.<init>(URL.java:383) at org.springframework.core.io.UrlResource.<init>(UrlResource.java:57) at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findAllClassPathResources(PathMatchingResourcePatternResolver.java:242) at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:204) at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:679) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:140) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:81) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:268) at org.springframework.context.access.ContextSingletonBeanFactoryLocator.initializeDefinition(ContextSingletonBeanFactoryLocator.java:136) at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:386) at org.springframework.ejb.support.AbstractEnterpriseBean.loadBeanFactory(AbstractEnterpriseBean.java:117) at org.springframework.ejb.support.AbstractStatelessSessionBean.ejbCreate(AbstractStatelessSessionBean.java:63) It is caused by the following code in PathMatchingResourceResolver: /** * Find all class location resources with the given location via the ClassLoader. * @param location the absolute path within the classpath * @return the result as Resource array * @throws IOException in case of I/O errors * @see java.lang.ClassLoader#getResources */ protected Resource[] findAllClassPathResources(String location) throws IOException { String path = location; if (path.startsWith("/")) { path = path.substring(1); } ClassLoader cl = getClassLoader(); if (cl == null) { // No class loader specified -> use thread context class loader. cl = Thread.currentThread().getContextClassLoader(); } Enumeration resourceUrls = cl.getResources(path); Set result = new HashSet(); while (resourceUrls.hasMoreElements()) { URL url = (URL) resourceUrls.nextElement(); // Use normalized path to avoid multiple entries pointing to the same resource. result.add(new UrlResource(StringUtils.cleanPath(url.toString()))); } return (Resource[]) result.toArray(new Resource[result.size()]); } Please note the line "new UrlResource(StringUtils.cleanPath(url.toString())));" This was fixed for 1.1.1, but appearantly got back in a later revision. I've only just noticed, since I was upgrading my spring.jar version.

    Spring JIRA | 1 decade ago | Barry Lagerweij
    java.net.MalformedURLException: unknown protocol: jndi
  2. 0

    Re-open of bug SPR-322 : When using references to DataSources and EJB references in the spring.xml file, the following exception is thrown: Nested exception is: org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition. Group resource name [classpath*:META-INF/bean-ref-factory.xml], factory key [root]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition resource pattern [classpath*:META-INF/bean-ref-factory.xml]; nested exception is java.net.MalformedURLException: unknown protocol: jndi org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition resource pattern [classpath*:META-INF/bean-ref-factory.xml]; nested exception is java.net.MalformedURLException: unknown protocol: jndi java.net.MalformedURLException: unknown protocol: jndi at java.net.URL.<init>(URL.java:544) at java.net.URL.<init>(URL.java:434) at java.net.URL.<init>(URL.java:383) at org.springframework.core.io.UrlResource.<init>(UrlResource.java:57) at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findAllClassPathResources(PathMatchingResourcePatternResolver.java:242) at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:204) at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:679) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:140) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:81) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:268) at org.springframework.context.access.ContextSingletonBeanFactoryLocator.initializeDefinition(ContextSingletonBeanFactoryLocator.java:136) at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:386) at org.springframework.ejb.support.AbstractEnterpriseBean.loadBeanFactory(AbstractEnterpriseBean.java:117) at org.springframework.ejb.support.AbstractStatelessSessionBean.ejbCreate(AbstractStatelessSessionBean.java:63) It is caused by the following code in PathMatchingResourceResolver: /** * Find all class location resources with the given location via the ClassLoader. * @param location the absolute path within the classpath * @return the result as Resource array * @throws IOException in case of I/O errors * @see java.lang.ClassLoader#getResources */ protected Resource[] findAllClassPathResources(String location) throws IOException { String path = location; if (path.startsWith("/")) { path = path.substring(1); } ClassLoader cl = getClassLoader(); if (cl == null) { // No class loader specified -> use thread context class loader. cl = Thread.currentThread().getContextClassLoader(); } Enumeration resourceUrls = cl.getResources(path); Set result = new HashSet(); while (resourceUrls.hasMoreElements()) { URL url = (URL) resourceUrls.nextElement(); // Use normalized path to avoid multiple entries pointing to the same resource. result.add(new UrlResource(StringUtils.cleanPath(url.toString()))); } return (Resource[]) result.toArray(new Resource[result.size()]); } Please note the line "new UrlResource(StringUtils.cleanPath(url.toString())));" This was fixed for 1.1.1, but appearantly got back in a later revision. I've only just noticed, since I was upgrading my spring.jar version.

    Spring JIRA | 1 decade ago | Barry Lagerweij
    java.net.MalformedURLException: unknown protocol: jndi
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Error using Java Control (jcx) - ControlException

    Oracle Community | 10 years ago | 666705
    weblogic.jws.control.ControlException: Exception in onAcquirecontext event handler[Context failure: onAcquire[unknown protocol: jndi]]

  1. boussoffara med ali 11 times, last 1 week ago
  2. bmacedo 2 times, last 1 week ago
  3. Aria Pahlavan 41 times, last 3 weeks ago
  4. Andreas Häber 13 times, last 4 weeks ago
  5. ajinkya_w 21 times, last 2 months ago
33 more registered users
46 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.net.MalformedURLException

    unknown protocol: jndi

    at java.net.URL.<init>()
  2. Java RT
    URL.<init>
    1. java.net.URL.<init>(URL.java:544)
    2. java.net.URL.<init>(URL.java:434)
    3. java.net.URL.<init>(URL.java:383)
    3 frames
  3. Spring Core
    PathMatchingResourcePatternResolver.getResources
    1. org.springframework.core.io.UrlResource.<init>(UrlResource.java:57)
    2. org.springframework.core.io.support.PathMatchingResourcePatternResolver.findAllClassPathResources(PathMatchingResourcePatternResolver.java:242)
    3. org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:204)
    3 frames
  4. Spring Context
    AbstractApplicationContext.getResources
    1. org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:679)
    1 frame
  5. Spring Beans
    AbstractBeanDefinitionReader.loadBeanDefinitions
    1. org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:140)
    1 frame
  6. Spring Context
    ContextSingletonBeanFactoryLocator.initializeDefinition
    1. org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
    2. org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:81)
    3. org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)
    4. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:268)
    5. org.springframework.context.access.ContextSingletonBeanFactoryLocator.initializeDefinition(ContextSingletonBeanFactoryLocator.java:136)
    5 frames
  7. Spring Beans
    SingletonBeanFactoryLocator.useBeanFactory
    1. org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:386)
    1 frame
  8. Spring Context
    AbstractStatelessSessionBean.ejbCreate
    1. org.springframework.ejb.support.AbstractEnterpriseBean.loadBeanFactory(AbstractEnterpriseBean.java:117)
    2. org.springframework.ejb.support.AbstractStatelessSessionBean.ejbCreate(AbstractStatelessSessionBean.java:63)
    2 frames