You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Peter Klotz <pe...@blue-elephant-systems.com> on 2006/03/15 17:31:35 UTC

Embedded Servicemix problem with servicemix.xml

Hi,

I'm using servicemix embedded in a Avalon Phoenix container. I took the code
from servicemix Main.java and have created a Avalon component which takes the
servicemix.xml from its configuration:


...
    context = new
FileSystemXmlApplicationContext("file://"+configDir.getAbsolutePath()+File.separator+"servicemix.xml");
    container = (SpringJBIContainer) context.getBean("jbi");
...

Due to the totally uggly behaviour of FileSystemXmlApplicationContext regarding
absolute path names I had to use a file:// URL. The servicemix.xml file is very
similar to the http-binding example and works in this way perfectly in the
normal servicemix distribution. When I run this in the Phoenix container I get
the following exception:

...
jvm 1    | org.springframework.beans.factory.BeanDefinitionStoreException: Line
8 in XML document from URL
[file:/opt/MIDAS/server/apps/esbserver/conf/servicemix.xml] is invalid; nested
exception is org.xml.sax.SAXParseException: Document root element "beans", must
match DOCTYPE root "null".
jvm 1    | org.xml.sax.SAXParseException: Document root element "beans", must
match DOCTYPE root "null".
jvm 1    |      at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:267)
jvm 1    |      at
org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201)
jvm 1    |      at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:76)
jvm 1    |      at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:161)
jvm 1    |      at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:125)
jvm 1    |      at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:141)
jvm 1    |      at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
jvm 1    |      at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:81)
jvm 1    |      at
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)
jvm 1    |      at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:268)
jvm 1    |      at
org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:83)
jvm 1    |      at
org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:68)
jvm 1    |      at
org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:59)
....


The servicemix.xml file if found but obviously it has problems finding the .xsd
files specified in the schema location attribute, which are located in the SAME
directory as the servicemix.xml file!

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xbean.org/schemas/spring/1.0"
  xmlns:spring="http://xbean.org/schemas/spring/1.0"
  xmlns:sm="http://servicemix.org/config/1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xbean.org/schemas/spring/1.0 spring-beans.xsd
                      http://servicemix.org/config/1.0 servicemix.xsd"
  xmlns:my="http://blue-elephant-systems.com/midas/servicemix">

  <!-- the JBI container -->
  <sm:container spring:id="jbi"
    useMBeanServer="true"
    createMBeanServer="true"
    dumpStats="true"
    statsInterval="10"
    transactionManager="#transactionManager">

The code of the Main.java of servicemix and that of the Avalon component is
really functionally the same so it must be somewhat a problem  regarding class
loaders?? Phoenix does have its own class loaders installed but how could this
influence files and URLs?

Does anybody have experienced similar problem and can give me a hint please?


Thanks, Peter

Re: Embedded Servicemix problem with servicemix.xml

Posted by Guillaume Nodet <gn...@gmail.com>.
This issue has been reported several times, but I do not have a clear
understanding
of the causes.
You could just remove the schema locations though ...

Guillaume Nodet

On 3/15/06, Peter Klotz <pe...@blue-elephant-systems.com> wrote:
>
> Hi,
>
> I'm using servicemix embedded in a Avalon Phoenix container. I took the
> code
> from servicemix Main.java and have created a Avalon component which takes
> the
> servicemix.xml from its configuration:
>
>
> ...
>     context = new
>
> FileSystemXmlApplicationContext("file://"+configDir.getAbsolutePath()+File.separator+"
> servicemix.xml");
>     container = (SpringJBIContainer) context.getBean("jbi");
> ...
>
> Due to the totally uggly behaviour of FileSystemXmlApplicationContext
> regarding
> absolute path names I had to use a file:// URL. The servicemix.xml file is
> very
> similar to the http-binding example and works in this way perfectly in the
> normal servicemix distribution. When I run this in the Phoenix container I
> get
> the following exception:
>
> ...
> jvm 1    | org.springframework.beans.factory.BeanDefinitionStoreException:
> Line
> 8 in XML document from URL
> [file:/opt/MIDAS/server/apps/esbserver/conf/servicemix.xml] is invalid;
> nested
> exception is org.xml.sax.SAXParseException: Document root element "beans",
> must
> match DOCTYPE root "null".
> jvm 1    | org.xml.sax.SAXParseException: Document root element "beans",
> must
> match DOCTYPE root "null".
> jvm 1    |      at org.apache.xerces.parsers.DOMParser.parse(
> DOMParser.java:267)
> jvm 1    |      at
> org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java
> :201)
> jvm 1    |      at javax.xml.parsers.DocumentBuilder.parse(
> DocumentBuilder.java:76)
> jvm 1    |      at
>
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions
> (XmlBeanDefinitionReader.java:161)
> jvm 1    |      at
>
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions
> (AbstractBeanDefinitionReader.java:125)
> jvm 1    |      at
>
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions
> (AbstractBeanDefinitionReader.java:141)
> jvm 1    |      at
>
> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions
> (AbstractXmlApplicationContext.java:113)
> jvm 1    |      at
>
> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions
> (AbstractXmlApplicationContext.java:81)
> jvm 1    |      at
>
> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory
> (AbstractRefreshableApplicationContext.java:89)
> jvm 1    |      at
> org.springframework.context.support.AbstractApplicationContext.refresh(
> AbstractApplicationContext.java:268)
> jvm 1    |      at
> org.springframework.context.support.FileSystemXmlApplicationContext
> .<init>(FileSystemXmlApplicationContext.java:83)
> jvm 1    |      at
> org.springframework.context.support.FileSystemXmlApplicationContext
> .<init>(FileSystemXmlApplicationContext.java:68)
> jvm 1    |      at
> org.springframework.context.support.FileSystemXmlApplicationContext
> .<init>(FileSystemXmlApplicationContext.java:59)
> ....
>
>
> The servicemix.xml file if found but obviously it has problems finding the
> .xsd
> files specified in the schema location attribute, which are located in the
> SAME
> directory as the servicemix.xml file!
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://xbean.org/schemas/spring/1.0"
>   xmlns:spring="http://xbean.org/schemas/spring/1.0"
>   xmlns:sm="http://servicemix.org/config/1.0"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://xbean.org/schemas/spring/1.0 spring-beans.xsd
>                       http://servicemix.org/config/1.0 servicemix.xsd"
>   xmlns:my="http://blue-elephant-systems.com/midas/servicemix">
>
>   <!-- the JBI container -->
>   <sm:container spring:id="jbi"
>     useMBeanServer="true"
>     createMBeanServer="true"
>     dumpStats="true"
>     statsInterval="10"
>     transactionManager="#transactionManager">
>
> The code of the Main.java of servicemix and that of the Avalon component
> is
> really functionally the same so it must be somewhat a problem  regarding
> class
> loaders?? Phoenix does have its own class loaders installed but how could
> this
> influence files and URLs?
>
> Does anybody have experienced similar problem and can give me a hint
> please?
>
>
> Thanks, Peter
>
>