Announcement Announcement Module
Collapse
No announcement yet.
context initialization failed passing params via url to mysql Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • context initialization failed passing params via url to mysql

    I'm trying to pass a few parameters to mysql via like this:

    Code:
    <bean id="appDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy-method="close">
    	<property name="driverClassName"value="com.mysql.jdbc.Driver"/>
    
    	<property name="url" value="jdbc:mysql://localhost/dbanme?useCursorFetch=true&useServerPrepStmts=true"/> 
    	<property name="username" value="user"/>
    	<property name="password" value="password"/>
    but I get this parse exception even if I add the semicolon like it wants.

    Code:
    Context initialization failed
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 217 in XML document from ServletContext resource [/WEB-INF/database.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The reference to entity "useServerPrepStmts" must end with the ';' delimiter.
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:359)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:158)
    	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:395)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:330)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
    	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.check(HostConfig.java:1218)
    	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
    	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
    	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1306)
    	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570)
    	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
    	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559)
    	at java.lang.Thread.run(Thread.java:613)

  • #2
    Since this is in an XML doc - try using '&amp;' escaping - like:

    Code:
    <property name="url" value="jdbc:mysql://localhost/dbanme?useCursorFetch=true&amp;useServerPrepStmts=true"/>

    Comment


    • #3
      dooh ... :o)

      Comment

      Working...
      X