Hi,
Some more thoughts about this problem : It's really weird...
using the standard way of launching Spring files to launch a serviceMix
spring-based XML descriptor inside a web WAR leads to the "no grammar found"
error.
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/spring/servicemix.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
However, if I do a dirty hack, only use a standard Spring container here that
launches a class that will
context = new ClassPathXmlApplicationContext(configFiles);
then it's ok, I don't get the previous error...
Is is supposed to behave that way ???
In any case, I'm getting an exception I don't know about :
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'jbi' defined in class path resource [spring/servicemix-ext.xml]: Initial
ization of bean failed; nested exception is java.lang.IllegalArgumentException:
null source
java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(Unknown Source)
at javax.management.Notification.<init>(Unknown Source)
at javax.management.AttributeChangeNotification.<init>(Unknown Source)
at org.servicemix.jbi.management.BaseStandardMBean.sendAttributeChangeNo
tification(BaseStandardMBean.java:438)
at org.servicemix.jbi.management.BaseStandardMBean.updateAttribute(BaseS
tandardMBean.java:221)
What does "null source" mean ? does it mean there is no component that inputs
data into the JBI engine ?
thanks a lot,
Sami Dalouche
Selon Sami Dalouche <[EMAIL PROTECTED]>:
> Sorry to bother you once again, here's the exception I get when I use the
> spring
> -dev-2 package bundled with serviceMix (in lib/ directory):
>
> "No grammar found"... aall examples don't seem to supply a DTD, so I guess
> I'm
> not supposed to use any, right ?
>
> regards,
> Sami Dalouche
>
> org.springframework.beans.factory.BeanDefinitionStoreException: Line 2 in XML
> do
> cument from class path resource [spring/servicemix.xml] is invalid; nested
> excep
> tion is org.xml.sax.SAXParseException: Document is invalid: no grammar found.
> org.xml.sax.SAXParseException: Document is invalid: no grammar found.
> at
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
> known Source)
> at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
> own Source)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.s
> canRootElementHook(Unknown Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
> Dispatcher.dispatch(Unknown Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
> known Source)
>
> And here's my serviceMix file
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns:my="http://servicemix.org/demo/">
>
> <!-- the JBI container -->
> <container id="jbi">
> <property name="rootDir" value="./META-INF/servicemix/wdir"/>
> <property name="useMBeanServer" value="true"/>
> <property name="createMBeanServer" value="true"/>
> <property name="installationDirPath"
> value="./META-INF/servicemix/install"/>
> <property name="deploymentDirPath" value="./META-INF/servicemix/deploy"/>
>
> <property name="monitorInstallationDirectory" value="false"/>
> <property name="dumpStats" value="true"/>
> <property name="statsInterval" value="10"/>
> <property name="transactionManager" ref="transactionManager"/>
>
> <components>
>
> <!-- lets kick off a timer to send messages on an input destination
> topic
> -->
> <component id="timer" service="my:timer"
> class="org.servicemix.components.quartz.QuartzComponent"
> destinationService="my:inputSender">
> <property name="triggers">
> <map>
> <entry>
> <key>
> <bean class="org.quartz.SimpleTrigger">
> <property name="repeatInterval" value="5000"/>
> <property name="repeatCount" value="-1"/>
> </bean>
> </key>
> <bean class="org.quartz.JobDetail">
> <property name="name" value="My Example Job"/>
> <property name="group" value="ServiceMix"/>
> </bean>
> </entry>
> </map>
> </property>
> </component>
>
> <component id="inputSender" service="my:inputSender"
> class="org.servicemix.components.jms.JmsSenderComponent">
> <property name="template">
> <bean class="org.springframework.jms.core.JmsTemplate">
> <property name="connectionFactory">
> <ref local="jmsConnectionFactory"/>
> </property>
> <property name="defaultDestinationName" value="WeatherTopic"/>
> <property name="pubSubDomain" value="true"/>
> </bean>
> </property>
> </component>
>
>
> <!-- lets subscribe and republish on a different JMS destination - i.e.
> make a JMS bridge -->
> <component id="inputReceiver" service="my:inputReceiver"
> class="org.servicemix.components.jms.JmsInUsingJCABinding"
> destinationService="my:outputSender">
> <property name="jcaContainer" ref="jencks"/>
> <property name="activationSpec">
> <bean class="org.activemq.ra.ActiveMQActivationSpec">
> <property name="destination" value="WeatherTopic"/>
> <property name="destinationType" value="javax.jms.Topic"/>
> </bean>
> </property>
> </component>
>
>
> <component id="outputSender" service="my:outputSender"
> class="org.servicemix.components.jms.JmsSenderComponent">
> <property name="template">
> <bean class="org.springframework.jms.core.JmsTemplate">
> <property name="connectionFactory">
> <ref local="jmsConnectionFactory"/>
> </property>
> <property name="defaultDestinationName" value="TestTopic"/>
> <property name="pubSubDomain" value="true"/>
> </bean>
> </property>
> </component>
>
>
> <!-- just to demonstrate that we are sending messages, lets trace the
> messages we receive -->
> <component id="jmsTrace" service="my:jmsTrace"
> class="org.servicemix.components.jms.JmsInUsingJCABinding"
> destinationService="my:trace">
> <property name="jcaContainer" ref="jencks"/>
> <property name="activationSpec">
> <bean class="org.activemq.ra.ActiveMQActivationSpec">
> <property name="destination" value="TestTopic"/>
> <property name="destinationType" value="javax.jms.Topic"/>
> </bean>
> </property>
> </component>
>
> <component id="trace" service="my:trace"
> class="org.servicemix.components.util.TraceComponent"/>
> </components>
> </container>
>
>
> <!-- the JCA container -->
> <bean id="jencks" class="org.jencks.JCAContainer" singleton="true">
>
> <!-- lets use the default configuration of work manager and transaction
> manager-->
> <property name="bootstrapContext">
> <bean class="org.jencks.factory.BootstrapContextFactoryBean">
> <property name="threadPoolSize" value="25"/>
> </bean>
> </property>
>
> <!-- the JCA Resource Adapter -->
> <property name="resourceAdapter">
> <bean id="activeMQResourceAdapter"
> class="org.activemq.ra.ActiveMQResourceAdapter" singleton="true">
> <property name="serverUrl" value="${jms.jndiProviderUrl}"/>
> </bean>
> </property>
> </bean>
>
> <!--
> <!-- message broker -->
> <bean id="broker" class="org.activemq.spring.BrokerFactoryBean">
> <property name="config" value="classpath:activemq.xml"/>
> </bean>
>
> -->
>
> <bean id="transactionManager"
> class="org.jencks.factory.TransactionManagerFactoryBean"/>
>
> <!--
> <bean id="jmsFactory" class="org.activemq.pool.PooledConnectionFactory">
> <property name="connectionFactory">
> <bean class="org.activemq.ActiveMQConnectionFactory">
> <property name="brokerURL">
> <value>tcp://localhost:61616</value>
> </property>
> </bean>
> </property>
> </bean>
> -->
> </beans>
>
>
>
>
> Selon Sami Dalouche <[EMAIL PROTECTED]>:
>
> > Hi,
> >
> > OK, so in order to use the extensions, which spring jar do I need ?
> > the -dev or -dev-2 that you provide ? or both ?
> >
> > Regards,
> > sami dalouche
> >
> > Selon James Strachan <[EMAIL PROTECTED]>:
> >
> > > Sami Dalouche wrote:
> > > >
> > > > Hi,
> > > >
> > > > I'd like to embed serviceMix and JBI components using Spring.
> > > >
> > > > However, it looks like there are 2 ways of doing it :
> > > > - the standard Spring way, which should work without any problem, but
> > isn't
> > > as
> > > > pleasant as the other way
> > > > - the ServiceMix's way, which uses a slightly modified Spring config
> > file.
> > > >
> > > > However, I don't understand how Spring can understand this
> configuration
> > > file.
> > > > If I add such a file to the list of my Spring files (in a WAR), it
> won't
> > > > understand the container, components, etc tags.
> > > > Is there some additional component to deploy inside the Spring context
> > that
> > > will
> > > > understand these tags ?
> > > > Or do I have to use a modified version of spring ?
> > >
> > > The current extended XML mechanism uses a snapshot of the Spring CVS
> > > repository which has the XML extension feature.
> > >
> > > Unfortunately this has never been officially released yet - the Spring
> > > folks have not yet decided how/when to support custom XML extension in
> > > Spring.
> > >
> > > So to avoid depending on a custom version of Spring, we're gonna move
> > > the XML extension code into a sister project (http://gbean.org/) so we
> > > will have GBean versions of the common Spring classes (like
> > > ClassPathXmlApplicationContext etc) which will understand extensible XML
> > > for Spring.
> > >
> > > For more background on this see...
> > >
> > > http://radio.weblogs.com/0112098/2005/06/10.html#a527
> > >
> > >
> > > --
> > >
> > > James
> > > -------
> > > http://radio.weblogs.com/0112098/
> > >
> > >
> >
> >
> >
> >
> > ----------------------------------------------------------------
> > This message was sent using IMP, the Internet Messaging Program.
> >
> >
>
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.