Announcement Announcement Module
Collapse
No announcement yet.
Help Me Friends to solve " ERROR initServletBean, Context initialization failed " Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help Me Friends to solve " ERROR initServletBean, Context initialization failed "

    Code:
    2011-07-14 14:48:54.576:INFO::No Transaction manager found - if your webapp requires one, please configure one.
    2011-07-14 14:48:55.314:INFO:/ISforCabSys:Initializing Spring FrameworkServlet 'spring'
    ERROR  initServletBean, Context initialization failed
    org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring-servlet.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getResourceLoader()Lorg/springframework/core/io/ResourceLoader;
    Caused by: 
    java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getResourceLoader()Lorg/springframework/core/io/ResourceLoader;
    	at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.configureScanner(ComponentScanBeanDefinitionParser.java:100)
    	at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:83)
    	at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
    2011-07-14 14:48:55.678:WARN:/ISforCabSys:unavailable
    org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring-servlet.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getResourceLoader()Lorg/springframework/core/io/ResourceLoader;
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:375)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
    [INFO] Started Jetty Server
    2011-07-14 14:48:55.785:INFO::Started [email protected]:8080

  • #2
    Fix your classpath... My guess you are mixing psring version or you have spring on different locations in your classpath....

    Comment


    • #3
      Could you provide your spring-servlet.xml file.

      Comment


      • #4


        thnks marten..because of your earliest replies i fixed my lot of errors in my app.
        what is you mean by psring version.? ?
        I used spring 3.0.5 & tiles 2.0.4 in my maven+jetty app
        I will post my config-servlet below..
        please help me to solve that error friend..

        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" xmlns:aop="http://www.springframework.org/schema/aop"
        	xmlns:context="http://www.springframework.org/schema/context"
        	xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang"
        	xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
        	xmlns:util="http://www.springframework.org/schema/util"
        	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
        		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        		http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
        		http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
        		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
        		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
        
        	<context:annotation-config />
        	<context:component-scan base-package="com.priyan.contact" />
        
        	<!-- <bean id="jspViewResolver" -->
        	<!-- class="org.springframework.web.servlet.view.InternalResourceViewResolver"> -->
        	<!-- <property name="viewClass" -->
        	<!-- value="org.springframework.web.servlet.view.JstlView" /> -->
        	<!-- <property name="prefix" value="/WEB-INF/jsp/" /> -->
        	<!-- <property name="suffix" value=".jsp" /> -->
        	<!-- </bean> -->
        
        	<bean id="messageSource"
        		class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        		<property name="basename" value="classpath:messages" />
        		<property name="defaultEncoding" value="UTF-8" />
        	</bean>
        
        	<bean id="propertyConfigurer"
        		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
        		p:location="/WEB-INF/jdbc.properties" />
        
        	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
        		destroy-method="close" p:driverClassName="${jdbc.driverClassName}"
        		p:url="${jdbc.databaseurl}" p:username="${jdbc.username}" p:password="${jdbc.password}" />
        
        
        	<bean id="sessionFactory"
        		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        		<property name="dataSource" ref="dataSource" />
        		<property name="configLocation">
        			<value>classpath:hibernate.cfg.xml</value>
        		</property>
        		<property name="configurationClass">
        			<value>org.hibernate.cfg.AnnotationConfiguration</value>
        		</property>
        		<property name="hibernateProperties">
        			<props>
        				<prop key="hibernate.dialect">${jdbc.dialect}</prop>
        				<prop key="hibernate.show_sql">true</prop>
        				<prop key="hibernate.hbm2ddl.auto">update</prop>
        			</props>
        		</property>
        	</bean>
        
        
        	<bean id="tilesConfigurer"
        		class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"
        		p:definitions="classpath:tiles-defs.xml" />
        	<bean id="viewResolver"
        		class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
        		<property name="basename" value="views" />
        	</bean>
        
        	<bean id="viewResolver"
        		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        		<property name="requestContextAttribute" value="requestContext" />
        		<property name="viewClass"
        			value="org.springframework.web.servlet.view.tiles.TilesView" />
        	</bean>
        
        
        	<tx:annotation-driven />
        
        	<bean id="transactionManager"
        		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        		<property name="sessionFactory" ref="sessionFactory" />
        	</bean>
        
        
        </beans>

        Comment


        • #5
          thanks friend..i try to attached but it cannot..
          now i show it below..see it dude & help me to solve

          Comment


          • #6


            I added this code also in my properties file

            Code:
            contact.(class)=org.springframework.web.servlet.view.tiles2.TilesView
            contact.url=contact
            and my pom like this for tiles jars

            Code:
            		<!-- Tiles Configuration -->
            
            		<dependency>
            			<groupId>org.apache.tiles</groupId>
            			<artifactId>tiles-api</artifactId>
            			<version>2.0.4</version>
            		</dependency>
            		<dependency>
            			<groupId>org.apache.tiles</groupId>
            			<artifactId>tiles-core</artifactId>
            			<version>2.0.4</version>
            		</dependency>
            		<dependency>
            			<groupId>org.apache.tiles</groupId>
            			<artifactId>tiles-jsp</artifactId>
            			<version>2.0.4</version>
            		</dependency>
            
            		<!-- Tiles Configuration -->
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-orm</artifactId>
            			<version>3.0.2.RELEASE</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springmodules</groupId>
            			<artifactId>spring-modules-validation</artifactId>
            			<version>0.8</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-tx</artifactId>
            			<version>3.0.2.RELEASE</version>
            		</dependency>
            		<dependency>
            			<groupId>dom4j</groupId>
            			<artifactId>dom4j</artifactId>
            			<version>1.6.1</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-aop</artifactId>
            			<version>3.0.2.RELEASE</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-context-support</artifactId>
            			<version>3.0.2.RELEASE</version>
            		</dependency>

            Comment


            • #7
              <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
              destroy-method="close" p:driverClassName="${jdbc.driverClassName}"
              p:url="${jdbc.databaseurl}" p:username="${jdbc.username}" password="${jdbc.password}" />

              form this bean class have u define "close" method. because u have define destroy-method="close" on ur bean tab.

              Comment


              • #8
                Originally posted by bishu24june View Post
                <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
                destroy-method="close" p:driverClassName="${jdbc.driverClassName}"
                p:url="${jdbc.databaseurl}" p:username="${jdbc.username}" password="${jdbc.password}" />

                form this bean class have u define "close" method. because u have define destroy-method="close" on ur bean tab.

                i can't understand friend..wat to do for that "close" word..? ?

                Comment


                • #9
                  You are depending on the abondonded spring-modules project which depends on an older version of spring, hence resulting in mixing different versions of spring. Why do you need spring-modules-validation? Most of that is in the core spring now...

                  Just a few other tips/clean ups that save you some xml.
                  1) You don't need context:annotation-config it is already implied by componet-scan
                  2) Use AnnotationSessionFactoryBean and remove the configuration class from the config

                  Comment


                  • #10
                    Originally posted by Marten Deinum View Post
                    1) You don't need context:annotation-config it is already implied by componet-scan
                    2) Use AnnotationSessionFactoryBean and remove the configuration class from the config
                    Dear Marten.,
                    early my app works 100% successfully.but yesterday i tried to apply spring tiles to it by the help of vaannila.com site.
                    then this error occured.i don't know how to add tile feature to my exist app..
                    but vaannila app works in alonly..

                    how am i add tile featue to my app.?
                    what are the changes.?

                    can i send it as a mail to you.?

                    Comment


                    • #11
                      Have you actually read my post!? You are focussing on some additional tips I gave you to cleanup your xml those are NOT related to your issue...

                      As I stated you are mixing spring versions and hence you need to fix your classpath... From somewhere there is another spring jar coming (or maybe it is in your classpath or maybe it is being loaded due to some class you now need). Hence fix your classpath... Check your spring jars etc. I also suggest checking the reference guide with regards to spring, if I;m not mistaken tiles 2.0 is not supported by spring 3.0 and you need a newer version.

                      Comment


                      • #12
                        Dear Marten.,
                        How to fix my classpath.??

                        Comment

                        Working...
                        X