0 Replies Latest reply on Nov 8, 2013 3:11 AM by srinu3669

    Exception while running spring mvc application in osgi container

    srinu3669

      Exception : org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 13 in XML document from ServletContext resource [/WEB-INF/spring-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1.a: Cannot find the declaration of element 'beans'.

       

      Hi Team,

       

      I am trying to run spring mvc application by creating war file using maven i got the above mentioned Exception.

       

      Please give any suggestion how  to get this. for your clarity i add my pom.xml and spring configuration file.

       

       

      Here is Spring-servlet.xml file:

       

       

      <?xml version="1.0" encoding="UTF-8"?>

      <beans xmlns="http://www.springframework.org/schema/beans"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance

          xmlns:context="http://www.springframework.org/schema/context"

          xmlns:tx="http://www.springframework.org/schema/tx

          xmlns:p="http://www.springframework.org/schema/p"

          xsi:schemaLocation="

                  http://www.springframework.org/schema/beans     

                  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

                  http://www.springframework.org/schema/tx 

                  http://www.springframework.org/schema/tx/spring-tx-3.0.xsd

                  http://www.springframework.org/schema/context 

                  http://www.springframework.org/schema/context/spring-context-3.0.xsd">

       

       

       

       

        <context:component-scan base-package="net.viralpatel.spring3.controller" />

       

        <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">

              <!--<property name="requestContextAttribute" value="rc"/>

              --><property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>

              <property name="prefix" value="/WEB-INF/jsp/"/>

              <property name="suffix" value=".jsp"/>

          </bean>

          </beans>

       

       

       

       

      Here is my Pom.xml

       

       

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

        <modelVersion>4.0.0</modelVersion>

        <groupId>com.sample.maven</groupId>

        <artifactId>mavenwebapp</artifactId>

        <packaging>war</packaging>

        <version>1.0-SNAPSHOT</version>

       

        <dependencies>

        <dependency>

        <groupId>junit</groupId>

        <artifactId>junit</artifactId>

        <version>4.8.1</version>

        </dependency>

       

      <dependency>

        <groupId>javax.servlet</groupId>

        <artifactId>servlet-api</artifactId>

        <version>2.5</version>

        </dependency>

       

        <dependency>

          <groupId>org.springframework</groupId>

          <artifactId>spring-web</artifactId>

          <version>3.0.5.RELEASE</version>

          </dependency>

        

      <dependency>

          <groupId>org.springframework</groupId>

          <artifactId>spring-core</artifactId>

          <version>3.0.5.RELEASE</version>

          </dependency>

        

      <dependency>

          <groupId>org.springframework</groupId>

          <artifactId>spring-tx</artifactId>

          <version>3.0.5.RELEASE</version>

          </dependency>

        

      <dependency>

          <groupId>log4j</groupId>

          <artifactId>log4j</artifactId>

          <version>1.2.14</version>

          </dependency>

        

      <dependency>

          <groupId>org.springframework</groupId>

          <artifactId>spring-tx</artifactId>

          <version>3.0.5.RELEASE</version>

          </dependency>

        

      <dependency>

          <groupId>jstl</groupId>

          <artifactId>jstl</artifactId>

          <version>1.1.2</version>

          </dependency>

        

      <dependency>

          <groupId>org.springframework</groupId>

          <artifactId>spring-webmvc</artifactId>

          <version>3.0.5.RELEASE</version>

          </dependency>

        

      <dependency>

          <groupId>org.springframework</groupId>

          <artifactId>spring-aop</artifactId>

          <version>3.0.5.RELEASE</version>

          </dependency>

        

      <dependency>

          <groupId>org.apache.tiles</groupId>

          <artifactId>tiles-core</artifactId>

          <version>2.2.2</version>

          </dependency>

        

      <dependency>

          <groupId>org.apache.tiles</groupId>

          <artifactId>tiles-template</artifactId>

          <version>2.2.2</version>

          </dependency>

         

      <dependency>

          <groupId>org.apache.tiles</groupId>

          <artifactId>tiles-jsp</artifactId>

          <version>2.2.2</version>

          </dependency>

         

        <dependency>

          <groupId>org.slf4j</groupId>

          <artifactId>slf4j-api</artifactId>

          <version>1.5.8</version>

          </dependency>

       

       

          <dependency>

          <groupId>org.slf4j</groupId>

          <artifactId>slf4j-log4j12</artifactId>

          <version>1.5.8</version>

          <type>jar</type>

          <scope>compile</scope>

          </dependency>

          <dependency>

          <groupId>commons-beanutils</groupId>

          <artifactId>commons-beanutils</artifactId>

          <version>20030211.134440</version>

          </dependency>

         

        <dependency>

          <groupId>dom4j</groupId>

          <artifactId>dom4j</artifactId>

          <version>1.6.1-jboss</version>

          </dependency>

        

      <dependency>

          <groupId>org.springframework</groupId>

          <artifactId>spring-asm</artifactId>

          <version>3.2.0.BUILD-20120125.231906-17</version>

          <type>pom</type>

          </dependency>

        

      <dependency>

          <groupId>org.springframework</groupId>

          <artifactId>spring-expression</artifactId>

          <version>3.2.0.BUILD-20121213.004239-476</version>

          <type>pom</type>

          </dependency>

        

      <dependency>

          <groupId>taglibs</groupId>

          <artifactId>standard</artifactId>

          <version>1.1.2</version>

          </dependency>

       

      </dependencies>

         

           <build>

               <plugins>

                      <plugin>

                      <groupId>org.apache.maven.plugins</groupId>

                      <artifactId>maven-compiler-plugin</artifactId>

                      <version>2.3.2</version>

                      <configuration>

                          <source>1.6</source>

                          <target>1.6</target>

                          <encoding>UTF-8</encoding>

                      </configuration>

               </plugin>

                 

            <plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-war-plugin</artifactId>

                <configuration>

                       <archive>

                          <manifestFile>${basedir}/target/bnd/MANIFEST.MF</manifestFile>

                     </archive>

              </configuration>

            </plugin>

          

       

       

      <plugin>

              <groupId>org.apache.felix</groupId>

              <artifactId>maven-bundle-plugin</artifactId>

              <version>2.3.5</version>

              <executions>

                <execution>

                  <id>bundle-manifest</id>

                  <phase>process-classes</phase>

                  <goals>

                    <goal>manifest</goal>

                  </goals>

                </execution>

              </executions>

              <configuration>

                <supportedProjectTypes>

                  <supportedProjectType>war</supportedProjectType>

                </supportedProjectTypes>

                <manifestLocation>target/bnd</manifestLocation>

                <instructions>

                <Webapp-Context>spring</Webapp-Context>

                  <Web-ContextPath>spring</Web-ContextPath>

                  <!--<Export-Package>!*</Export-Package>

                 

                --><Import-Package>

                    javax.servlet,

                    javax.servlet.http,

                    javax.servlet.jsp.jstl.core,

                    javax.servlet.resources,

                    org.springframework.beans.factory.config,

                    org.springframework.osgi.web.context.support,

                    org.springframework.stereotype,

                    org.springframework.web.bind.annotation,

                    org.springframework.web.servlet,

                    org.springframework.web.servlet.view,

                    *

                  </Import-Package>

                  <Bundle-ClassPath>

                    WEB-INF/classes,.

                   

                  </Bundle-ClassPath>

                </instructions>

              </configuration>

            </plugin>

          </plugins>

        </build>

       

      </project>