Announcement Announcement Module
Collapse
No announcement yet.
Unclosed bean? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • nickcliff
    started a topic Unclosed bean?

    Unclosed bean?

    I have now been looking at my servlet.xml for a couple of days and continually keep getting the same error

    "The end-tag for element type "bean" must end with a '>' delimiter"

    I have checked everything I can think off and the error is at line 85 (the line before the </beans> tag) I was wondering if anyone else could see my problem?

    Cheers
    Here is my stack trace from my tomcat:

    Code:
    2008-10-11 03:32:29,260 ERROR [org.springframework.web.servlet.DispatcherServlet] - <Context initialization failed>
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 85 in XML document from ServletContext resource [/WEB-INF/photos-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The end-tag for element type "bean" must end with a '>' delimiter.
    Caused by: 
    org.xml.sax.SAXParseException: The end-tag for element type "bean" must end with a '>' delimiter.
    	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
    	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
    	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
    	at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1411)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1745)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2923)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
    	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
    	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
    	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
    	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
    	at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:73)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:361)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
    	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
    	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
    	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101)
    	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:394)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:324)
    	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:332)
    	at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:266)
    	at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:236)
    	at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
    	at javax.servlet.GenericServlet.init(GenericServlet.java:212)
    	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
    	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
    	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
    	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:831)
    	at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:720)
    	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
    	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
    	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:448)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
    and here is my servlet.xml file

    Code:
    <beans>
    	<bean id="photosController" class="photosController">
        	<property name="photoManager">
        		<ref bean="photoMan"/>
        	</property>
        </bean>
    	
    	<bean id="photoPageController" class="web.PhotoPageController">
        	<property name="photoManager">
        		<ref bean="photoMan"/>
        	</property>	
        </bean>
    
        <!--  Validator and Form Controller for the "Create Question" page -->
        <bean id="createPhotoValidator" class="web.CreatePhotoValidator">
        </bean>
        
        <bean id="createPhotoForm" class="web.CreatePhotoFormController">
            <property name="sessionForm"><value>true</value></property>
            <property name="commandName"><value>photo</value></property>
            <property name="commandClass"><value>prog.Photo</value></property>
            <property name="validator"><ref bean="createPhotoValidator"/></property>
            <property name="formView"><value>createPhoto</value></property>
            <property name="successView"><value>(url not allowed till 5 posts)</value></property>
            <property name="photoManager">
                <ref bean="photoMan"/>
            </property>
    	</bean>
    
    	<bean id="editPhotoValidator" class="web.EditPhotoValidator">
    	</bean>
    	
    	<bean id="editPhotoForm" class="web.EditPhotoFormController">
            <property name="sessionForm"><value>true</value></property>
            <property name="commandName"><value>photo</value></property>
            <property name="commandClass"><value>prog.Photo</value></property>
            <property name="validator"><ref bean="editPhotoValidator"/></property>
            <property name="formView"><value>editphoto</value></property>
            <property name="successView"><value>(url not allowed till 5 posts)</value>
            <property name="photoManager">
                <ref bean="photoMan"/>
            </property>
    	</bean>
    	
        <bean id="photoManDao" class="db.PhotoManagerDaoHibernate">
        <!--
            <property name="dataSource">
                <ref bean="dataSource"/>
            </property>
        -->
    	</bean>
    	
    	<bean id="photoMan" class="prog.PhotoManager">
    		<property name="photoManagerDao">
    			<ref bean="photoManDao"/>
    		</property>
    	</bean>
    	
    	<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    		<property name="basename"><value>messages</value></property>
    	</bean>
    	
        <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property>
            <property name="prefix"><value>/WEB-INF/jsp/</value></property>
            <property name="suffix"><value>.jsp</value></property>
        </bean>
    	
        <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                <props>
                    ... (there were urls in here wasn't allowed to post but all these tags are closed)
                </props>
            </property>
        </bean>
    </beans>

  • nickcliff
    replied
    I am using eclipse, with the spring plugin, i have a red bar indicating an error on the second from bottom line and as I indicated above it was an error with my copying.

    Leave a comment:


  • nickcliff
    replied
    Unfortunately that was not the problem I had just copied the code in here incorrectly. and while it is not specific to this forum It is part of a spring project and I was hoping that the people on this forum deal with servlets enough to see my folly and help me (people like you ) so thank you, unfortunately that is not my error

    I hope that it is something so simple though (and i'm sure it is)

    Here is the corrected code

    Code:
    <beans>
    	<bean id="photosController" class="photosController">
        	<property name="photoManager">
        		<ref bean="photoMan"/>
        	</property>
        </bean>
    	
    	<bean id="photoPageController" class="web.PhotoPageController">
        	<property name="photoManager">
        		<ref bean="photoMan"/>
        	</property>	
        </bean>
    
        <!--  Validator and Form Controller for the "Create Question" page -->
        <bean id="createPhotoValidator" class="web.CreatePhotoValidator">
        </bean>
        
        <bean id="createPhotoForm" class="web.CreatePhotoFormController">
            <property name="sessionForm"><value>true</value></property>
            <property name="commandName"><value>photo</value></property>
            <property name="commandClass"><value>prog.Photo</value></property>
            <property name="validator"><ref bean="createPhotoValidator"/></property>
            <property name="formView"><value>createPhoto</value></property>
            <property name="successView"><value>(url not allowed till 5 posts)</value></property>
            <property name="photoManager">
                <ref bean="photoMan"/>
            </property>
    	</bean>
    
    	<bean id="editPhotoValidator" class="web.EditPhotoValidator">
    	</bean>
    	
    	<bean id="editPhotoForm" class="web.EditPhotoFormController">
            <property name="sessionForm"><value>true</value></property>
            <property name="commandName"><value>photo</value></property>
            <property name="commandClass"><value>prog.Photo</value></property>
            <property name="validator"><ref bean="editPhotoValidator"/></property>
            <property name="formView"><value>editphoto</value></property>
            <property name="successView"><value>(url not allowed till 5 posts)</value></property>
            <property name="photoManager">
                <ref bean="photoMan"/>
            </property>
    	</bean>
    	
        <bean id="photoManDao" class="db.PhotoManagerDaoHibernate">
        <!--
            <property name="dataSource">
                <ref bean="dataSource"/>
            </property>
        -->
    	</bean>
    	
    	<bean id="photoMan" class="prog.PhotoManager">
    		<property name="photoManagerDao">
    			<ref bean="photoManDao"/>
    		</property>
    	</bean>
    	
    	<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    		<property name="basename"><value>messages</value></property>
    	</bean>
    	
        <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property>
            <property name="prefix"><value>/WEB-INF/jsp/</value></property>
            <property name="suffix"><value>.jsp</value></property>
        </bean>
    	
        <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                <props>
                    ... (there were urls in here wasn't allowed to post but all these tags are closed)
                </props>
            </property>
        </bean>
    </beans>

    Leave a comment:


  • chudak
    replied
    Originally posted by frankjl View Post
    You are missing the < /property> tag for the 'successView'. This was on line 38.
    Yep, pasting this xml into an xml editor in eclipse immediately highlighted that line......

    Leave a comment:


  • frankjl
    replied
    While this isn't a Spring-related problem, because you used the [ code] tags I figured I'd help you out

    Code:
      <property name="formView"><value>editphoto</value></property>
            <property name="successView"><value>(url not allowed till 5 posts)</value>
            <property name="photoManager">
                <ref bean="photoMan"/>
            </property>
    You are missing the < /property> tag for the 'successView'. This was on line 38.

    Leave a comment:

Working...
X