Results 1 to 5 of 5

Thread: Get rid of xmlns namespace declaration? - appContext.xml

  1. #1
    Join Date
    Mar 2009
    Posts
    4

    Question Get rid of xmlns namespace declaration? - appContext.xml

    Hi,

    I'm just wondering if is possible to get rid of the xmlns namespaces located at the head of the application context, this one:

    Code:
    <beans xmlns="http://www.springframework.org/schema/beans" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xsi:schemaLocation="http://www.springframework.org/schema/beans 
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    I'm asking 'cause I'm facing a situation where the client wants to run the app, in a server with restricted access to internet, so, when the app start, the context
    can't be instantiate 'cause the app can't find the declaration of element 'beans' and throw an exception:

    "Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'".

    So, it's possible to get rid of those xml namespace? (I mean, maybe I can put them into the WEB-INF folder or something like that...)

    How can I skip those xml namespaces?
    Last edited by Fabian; Apr 13th, 2009 at 01:05 PM.

  2. #2
    Join Date
    Mar 2009
    Posts
    4

    Default

    Bump
    bump

  3. #3
    Join Date
    Aug 2007
    Location
    San Diego, CA, USA
    Posts
    18

    Default

    Something else is weird with your configuration. I run spring apps disconnected from the network all the time. All of my spring configs have the schema namespaces defined. I'm not doing anything special to support it either.

  4. #4
    Join Date
    Mar 2009
    Posts
    4

    Default

    ok, this one is my appContext:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xsi:schemaLocation="http://www.springframework.org/schema/beans 
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> 
         
    <!-- DataSource configurations BEANS -->
        <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
              <property name="jndiName" value="${jndi.potala.database}"/>   
              <property name="resourceRef" value="true" />
        </bean>
        
        <bean id="propertyConfigurer" 
              class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations">
                <list>
                    <value>classpath:/WEB-INF/conf/debibacOperations.properties</value>
                </list>
            </property>
        </bean>
        
        <bean id="transactionManager" 
              class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource" ref="dataSource" />
        </bean>
    
        
        
    <!-- Service configuration BEAN -->
     <!-- more bean configuration here -->  
        
    </beans>
    Why the application is throwing this exception just when the app has no access to internet?

    Code:
    "Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'".
    Last edited by Fabian; Apr 21st, 2009 at 05:35 PM.

  5. #5
    Join Date
    Mar 2009
    Posts
    4

    Default

    Ok, I just found a work around, I'm using this:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <!--  As you can see, I'm skipping this xml namespaces
    <beans xmlns="http://www.springframework.org/schema/beans" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xsi:schemaLocation="http://www.springframework.org/schema/beans 
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> 
    -->  
    <beans>      
      <!-- DataSource configurations BEANS here-->        
    </beans>
    XD easy ain't?!
    Last edited by Fabian; Apr 21st, 2009 at 05:42 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •