You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by JS75 <je...@aboveE.com> on 2008/02/01 04:16:47 UTC

Exception : factory:java.io.IOException

Dear All:
Now I need to implement two requirements with MQ4.1.
1. Start my embedded broker with cofig.xml file.
2. Use MS SQL Server instead of default derby.

And here is my activeMQ.xml (I put it in C disk)
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
   
    http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<!-- START SNIPPET: example -->
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.org/config/1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.org/config/1.0
http://activemq.apache.org/schema/activemq-core.xsd
  http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">

  <!-- Allows us to use system properties as variables in this configuration
file -->
  <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
  
  <broker xmlns="http://activemq.org/config/1.0" brokerName="localhost"
dataDirectory="C://data">
  
    <!-- Destination specific policies using destination names or wildcards
-->
    <destinationPolicy>
      <policyMap>
        <policyEntries>

          <policyEntry topic="FOO.>" producerFlowControl="false"
memoryLimit="1mb">
            <dispatchPolicy>
              <strictOrderDispatchPolicy/>
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy/>
            </subscriptionRecoveryPolicy>
          </policyEntry>

        </policyEntries>
      </policyMap>
    </destinationPolicy>


    <!-- The transport connectors ActiveMQ will listen to -->
    <transportConnectors>
       <transportConnector name="openwire" uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
       <transportConnector name="ssl"     uri="ssl://localhost:61617"/>
       <transportConnector name="stomp"   uri="stomp://localhost:61613"/>
       <transportConnector name="xmpp"    uri="xmpp://localhost:61222"/>
    </transportConnectors>

    <!-- The store and forward broker networks ActiveMQ will listen to -->
    <networkConnectors>
      <!-- by default just auto discover the other brokers -->
      <networkConnector name="default-nc" uri="multicast://default"/>
      <!--
      <networkConnector name="host1 and host2"
uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
      -->
    </networkConnectors>


    <!-- Use the following if you wish to configure the journal with JDBC
-->
    <!--
    <persistenceAdapter>
        <journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.base}/activemq-data"  dataSource="#postgres-ds"/>
    </persistenceAdapter>
    -->

    <!-- Or if you want to use pure JDBC without a journal -->
    
    <persistenceAdapter>
        <jdbcPersistenceAdapter dataSource="#mssql-ds"/>
    </persistenceAdapter>
   
   
    <!--  Use the following to set the broker memory limit
	<systemUsage>
	            <systemUsage>
		            <memoryUsage>
	    	            	<memoryUsage limit="10 mb" percentUsageMinDelta="20"/>
		            </memoryUsage>
		            <tempUsage>
	    	            	<tempUsage limit="100 mb"/>
		            </tempUsage>
		            <storeUsage>
	    	            	<storeUsage limit="1 gb" name="foo"/>
		            </storeUsage>
	            </systemUsage>
	    </systemUsage>
   -->
    
    <!-- Use the following to configure how ActiveMQ is exposed in JMX
    <managementContext>
       <managementContext connectorPort="1099"
jmxDomainName="org.apache.activemq"/>
    </managementContext>
    -->

  </broker>

  <!--
    ** Lets deploy some Enterprise Integration Patterns inside the ActiveMQ
Message Broker
    ** For more details see
    **
    ** http://activemq.apache.org/enterprise-integration-patterns.html
    -->
  <camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">

    <!-- You can use a <package> element for each root package to search for
Java routes -->
    <package>org.foo.bar</package>

    <!-- You can use Spring XML syntax to define the routes here using the
<route> element -->
    <route>
      <from uri="activemq:example.A"/>
      <to uri="activemq:example.B"/>
    </route>
  </camelContext>



  <!-- lets create a command agent to respond to message based admin
commands on the ActiveMQ.Agent topic -->
  <commandAgent xmlns="http://activemq.org/config/1.0"/>


  <!-- An embedded servlet engine for serving up the Admin console -->
  <jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
    <connectors>
      <nioConnector port="8161" />
    </connectors>

    <handlers>
      <webAppContext contextPath="/admin"
resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true" />
      <webAppContext contextPath="/demo"
resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true" />
    </handlers>
  </jetty>
 

<!-- MSSQL DataSource Sample Setup --> 

  <bean id="mssql-ds" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close"> 
    <property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/> 
    <property name="url" value="jdbc:sqlserver://mySQLDB:1433"/> 
    <property name="username" value="admin"/> 
    <property name="password" value="admin"/>
    <property name="databaseName" value="test"/>
    <property name="createDatabase" value="create"/> 
  </bean>

</beans>
<!-- END SNIPPET: example -->

And I start my embedded broker as :
broker = BrokerFactory.createBroker(new URI("file:C://activeMQ.xml"));

Strangely, I got exception below, but my application works successfully?!
(default broker setting?)

java.io.IOException: Could load file factory:java.io.IOException: Could not
find factory class for resource:
META-INF/services/org/apache/activemq/broker/file
	at
org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:25)
	at
org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:43)
	at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:56)
	at com.aboveE.powerProcess.util.MQHelper.startBroker(MQHelper.java:65)
	at com.aboveE.powerProcess.event.queue.TestMain.<init>(TestMain.java:25)
	at com.aboveE.powerProcess.event.queue.TestMain.main(TestMain.java:54)
Caused by: java.io.IOException: Could not find factory class for resource:
META-INF/services/org/apache/activemq/broker/file
	at
org.apache.activemq.util.FactoryFinder.doFindFactoryProperies(FactoryFinder.java:90)
	at
org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:58)
	at
org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:47)
	at
org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:41)
	... 4 more

Have I forgotten any tag in configure xml or lib into my application ?

There is another main factor about performance and persisitency.
FAQ replies that changing db may reduce performance, however, could I do
something in case to maintain the performance? (Just as the same as derby,
possible?)

Thank you all~:-)

Sincerely,
Jean
-- 
View this message in context: http://www.nabble.com/Exception-%3A-factory%3Ajava.io.IOException-tp15219903s2354p15219903.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Exception : factory:java.io.IOException

Posted by Gary Tully <ga...@gmail.com>.
should you not be using the xbean broker factory:
xbean:file://...

see: http://activemq.apache.org/broker-xbean-uri.html


2009/11/30 KameshBathina <ka...@gmail.com>

>
> Hello Jean,
>
> I am also facing same issue when I try to start embedded broker with config
> file URI. Please let me know whether you able to resolve the problem.
>
> Thanks and Regards,
> Kamesh
>
>
> JS75 wrote:
> >
> > Dear All:
> > Now I need to implement two requirements with MQ4.1.
> > 1. Start my embedded broker with cofig.xml file.
> > 2. Use MS SQL Server instead of default derby.
> >
> > And here is my activeMQ.xml (I put it in C disk)
> > <!--
> >     Licensed to the Apache Software Foundation (ASF) under one or more
> >     contributor license agreements.  See the NOTICE file distributed with
> >     this work for additional information regarding copyright ownership.
> >     The ASF licenses this file to You under the Apache License, Version
> > 2.0
> >     (the "License"); you may not use this file except in compliance with
> >     the License.  You may obtain a copy of the License at
> >
> >     http://www.apache.org/licenses/LICENSE-2.0
> >
> >     Unless required by applicable law or agreed to in writing, software
> >     distributed under the License is distributed on an "AS IS" BASIS,
> >     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> > implied.
> >     See the License for the specific language governing permissions and
> >     limitations under the License.
> > -->
> > <!-- START SNIPPET: example -->
> > <beans
> >   xmlns="http://www.springframework.org/schema/beans"
> >   xmlns:amq="http://activemq.org/config/1.0"
> >   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >   xsi:schemaLocation="http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> >   http://activemq.org/config/1.0
> > http://activemq.apache.org/schema/activemq-core.xsd
> >   http://activemq.apache.org/camel/schema/spring
> > http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
> >
> >   <!-- Allows us to use system properties as variables in this
> > configuration file -->
> >   <bean
> >
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
> >
> >   <broker xmlns="http://activemq.org/config/1.0" brokerName="localhost"
> > dataDirectory="C://data">
> >
> >     <!-- Destination specific policies using destination names or
> > wildcards -->
> >     <destinationPolicy>
> >       <policyMap>
> >         <policyEntries>
> >
> >           <policyEntry topic="FOO.>" producerFlowControl="false"
> > memoryLimit="1mb">
> >             <dispatchPolicy>
> >               <strictOrderDispatchPolicy/>
> >             </dispatchPolicy>
> >             <subscriptionRecoveryPolicy>
> >               <lastImageSubscriptionRecoveryPolicy/>
> >             </subscriptionRecoveryPolicy>
> >           </policyEntry>
> >
> >         </policyEntries>
> >       </policyMap>
> >     </destinationPolicy>
> >
> >
> >     <!-- The transport connectors ActiveMQ will listen to -->
> >     <transportConnectors>
> >        <transportConnector name="openwire" uri="tcp://localhost:61616"
> > discoveryUri="multicast://default"/>
> >        <transportConnector name="ssl"     uri="ssl://localhost:61617"/>
> >        <transportConnector name="stomp"   uri="stomp://localhost:61613"/>
> >        <transportConnector name="xmpp"    uri="xmpp://localhost:61222"/>
> >     </transportConnectors>
> >
> >     <!-- The store and forward broker networks ActiveMQ will listen to
> -->
> >     <networkConnectors>
> >       <!-- by default just auto discover the other brokers -->
> >       <networkConnector name="default-nc" uri="multicast://default"/>
> >       <!--
> >       <networkConnector name="host1 and host2"
> > uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
> >       -->
> >     </networkConnectors>
> >
> >
> >     <!-- Use the following if you wish to configure the journal with JDBC
> > -->
> >     <!--
> >     <persistenceAdapter>
> >         <journaledJDBC journalLogFiles="5"
> > dataDirectory="${activemq.base}/activemq-data"
> > dataSource="#postgres-ds"/>
> >     </persistenceAdapter>
> >     -->
> >
> >     <!-- Or if you want to use pure JDBC without a journal -->
> >
> >     <persistenceAdapter>
> >         <jdbcPersistenceAdapter dataSource="#mssql-ds"/>
> >     </persistenceAdapter>
> >
> >
> >     <!--  Use the following to set the broker memory limit
> >       <systemUsage>
> >                   <systemUsage>
> >                           <memoryUsage>
> >                               <memoryUsage limit="10 mb"
> percentUsageMinDelta="20"/>
> >                           </memoryUsage>
> >                           <tempUsage>
> >                               <tempUsage limit="100 mb"/>
> >                           </tempUsage>
> >                           <storeUsage>
> >                               <storeUsage limit="1 gb" name="foo"/>
> >                           </storeUsage>
> >                   </systemUsage>
> >           </systemUsage>
> >    -->
> >
> >     <!-- Use the following to configure how ActiveMQ is exposed in JMX
> >     <managementContext>
> >        <managementContext connectorPort="1099"
> > jmxDomainName="org.apache.activemq"/>
> >     </managementContext>
> >     -->
> >
> >   </broker>
> >
> >   <!--
> >     ** Lets deploy some Enterprise Integration Patterns inside the
> > ActiveMQ Message Broker
> >     ** For more details see
> >     **
> >     ** http://activemq.apache.org/enterprise-integration-patterns.html
> >     -->
> >   <camelContext id="camel"
> > xmlns="http://activemq.apache.org/camel/schema/spring">
> >
> >     <!-- You can use a <package> element for each root package to search
> > for Java routes -->
> >     <package>org.foo.bar</package>
> >
> >     <!-- You can use Spring XML syntax to define the routes here using
> the
> > <route> element -->
> >     <route>
> >       <from uri="activemq:example.A"/>
> >       <to uri="activemq:example.B"/>
> >     </route>
> >   </camelContext>
> >
> >
> >
> >   <!-- lets create a command agent to respond to message based admin
> > commands on the ActiveMQ.Agent topic -->
> >   <commandAgent xmlns="http://activemq.org/config/1.0"/>
> >
> >
> >   <!-- An embedded servlet engine for serving up the Admin console -->
> >   <jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
> >     <connectors>
> >       <nioConnector port="8161" />
> >     </connectors>
> >
> >     <handlers>
> >       <webAppContext contextPath="/admin"
> > resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true" />
> >       <webAppContext contextPath="/demo"
> > resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true" />
> >     </handlers>
> >   </jetty>
> >
> >
> > <!-- MSSQL DataSource Sample Setup -->
> >
> >   <bean id="mssql-ds" class="org.apache.commons.dbcp.BasicDataSource"
> > destroy-method="close">
> >     <property name="driverClassName"
> > value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
> >     <property name="url" value="jdbc:sqlserver://mySQLDB:1433"/>
> >     <property name="username" value="admin"/>
> >     <property name="password" value="admin"/>
> >     <property name="databaseName" value="test"/>
> >     <property name="createDatabase" value="create"/>
> >   </bean>
> >
> > </beans>
> > <!-- END SNIPPET: example -->
> >
> > And I start my embedded broker as :
> > broker = BrokerFactory.createBroker(new URI("file:C://activeMQ.xml"));
> >
> > Strangely, I got exception below, but my application works successfully?!
> > (default broker setting?)
> >
> > java.io.IOException: Could load file factory:java.io.IOException: Could
> > not find factory class for resource:
> > META-INF/services/org/apache/activemq/broker/file
> >       at
> >
> org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:25)
> >       at
> >
> org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:43)
> >       at
> >
> org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:56)
> >       at
> com.aboveE.powerProcess.util.MQHelper.startBroker(MQHelper.java:65)
> >       at
> com.aboveE.powerProcess.event.queue.TestMain.<init>(TestMain.java:25)
> >       at
> com.aboveE.powerProcess.event.queue.TestMain.main(TestMain.java:54)
> > Caused by: java.io.IOException: Could not find factory class for
> resource:
> > META-INF/services/org/apache/activemq/broker/file
> >       at
> >
> org.apache.activemq.util.FactoryFinder.doFindFactoryProperies(FactoryFinder.java:90)
> >       at
> > org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:58)
> >       at
> > org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:47)
> >       at
> >
> org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:41)
> >       ... 4 more
> >
> > Have I forgotten any tag in configure xml or lib into my application ?
> >
> > There is another main factor about performance and persisitency.
> > FAQ replies that changing db may reduce performance, however, could I do
> > something in case to maintain the performance? (Just as the same as
> derby,
> > possible?)
> >
> > Thank you all~:-)
> >
> > Sincerely,
> > Jean
> >
>
> --
> View this message in context:
> http://old.nabble.com/Exception-%3A-factory%3Ajava.io.IOException-tp15219903p26571002.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Re: Exception : factory:java.io.IOException

Posted by KameshBathina <ka...@gmail.com>.
Hello Jean,

I am also facing same issue when I try to start embedded broker with config
file URI. Please let me know whether you able to resolve the problem.

Thanks and Regards,
Kamesh


JS75 wrote:
> 
> Dear All:
> Now I need to implement two requirements with MQ4.1.
> 1. Start my embedded broker with cofig.xml file.
> 2. Use MS SQL Server instead of default derby.
> 
> And here is my activeMQ.xml (I put it in C disk)
> <!--
>     Licensed to the Apache Software Foundation (ASF) under one or more
>     contributor license agreements.  See the NOTICE file distributed with
>     this work for additional information regarding copyright ownership.
>     The ASF licenses this file to You under the Apache License, Version
> 2.0
>     (the "License"); you may not use this file except in compliance with
>     the License.  You may obtain a copy of the License at
>    
>     http://www.apache.org/licenses/LICENSE-2.0
>    
>     Unless required by applicable law or agreed to in writing, software
>     distributed under the License is distributed on an "AS IS" BASIS,
>     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
>     See the License for the specific language governing permissions and
>     limitations under the License.
> -->
> <!-- START SNIPPET: example -->
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:amq="http://activemq.org/config/1.0"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.org/config/1.0
> http://activemq.apache.org/schema/activemq-core.xsd
>   http://activemq.apache.org/camel/schema/spring
> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
> 
>   <!-- Allows us to use system properties as variables in this
> configuration file -->
>   <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
>   
>   <broker xmlns="http://activemq.org/config/1.0" brokerName="localhost"
> dataDirectory="C://data">
>   
>     <!-- Destination specific policies using destination names or
> wildcards -->
>     <destinationPolicy>
>       <policyMap>
>         <policyEntries>
> 
>           <policyEntry topic="FOO.>" producerFlowControl="false"
> memoryLimit="1mb">
>             <dispatchPolicy>
>               <strictOrderDispatchPolicy/>
>             </dispatchPolicy>
>             <subscriptionRecoveryPolicy>
>               <lastImageSubscriptionRecoveryPolicy/>
>             </subscriptionRecoveryPolicy>
>           </policyEntry>
> 
>         </policyEntries>
>       </policyMap>
>     </destinationPolicy>
> 
> 
>     <!-- The transport connectors ActiveMQ will listen to -->
>     <transportConnectors>
>        <transportConnector name="openwire" uri="tcp://localhost:61616"
> discoveryUri="multicast://default"/>
>        <transportConnector name="ssl"     uri="ssl://localhost:61617"/>
>        <transportConnector name="stomp"   uri="stomp://localhost:61613"/>
>        <transportConnector name="xmpp"    uri="xmpp://localhost:61222"/>
>     </transportConnectors>
> 
>     <!-- The store and forward broker networks ActiveMQ will listen to -->
>     <networkConnectors>
>       <!-- by default just auto discover the other brokers -->
>       <networkConnector name="default-nc" uri="multicast://default"/>
>       <!--
>       <networkConnector name="host1 and host2"
> uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
>       -->
>     </networkConnectors>
> 
> 
>     <!-- Use the following if you wish to configure the journal with JDBC
> -->
>     <!--
>     <persistenceAdapter>
>         <journaledJDBC journalLogFiles="5"
> dataDirectory="${activemq.base}/activemq-data" 
> dataSource="#postgres-ds"/>
>     </persistenceAdapter>
>     -->
> 
>     <!-- Or if you want to use pure JDBC without a journal -->
>     
>     <persistenceAdapter>
>         <jdbcPersistenceAdapter dataSource="#mssql-ds"/>
>     </persistenceAdapter>
>    
>    
>     <!--  Use the following to set the broker memory limit
> 	<systemUsage>
> 	            <systemUsage>
> 		            <memoryUsage>
> 	    	            	<memoryUsage limit="10 mb" percentUsageMinDelta="20"/>
> 		            </memoryUsage>
> 		            <tempUsage>
> 	    	            	<tempUsage limit="100 mb"/>
> 		            </tempUsage>
> 		            <storeUsage>
> 	    	            	<storeUsage limit="1 gb" name="foo"/>
> 		            </storeUsage>
> 	            </systemUsage>
> 	    </systemUsage>
>    -->
>     
>     <!-- Use the following to configure how ActiveMQ is exposed in JMX
>     <managementContext>
>        <managementContext connectorPort="1099"
> jmxDomainName="org.apache.activemq"/>
>     </managementContext>
>     -->
> 
>   </broker>
> 
>   <!--
>     ** Lets deploy some Enterprise Integration Patterns inside the
> ActiveMQ Message Broker
>     ** For more details see
>     **
>     ** http://activemq.apache.org/enterprise-integration-patterns.html
>     -->
>   <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> 
>     <!-- You can use a <package> element for each root package to search
> for Java routes -->
>     <package>org.foo.bar</package>
> 
>     <!-- You can use Spring XML syntax to define the routes here using the
> <route> element -->
>     <route>
>       <from uri="activemq:example.A"/>
>       <to uri="activemq:example.B"/>
>     </route>
>   </camelContext>
> 
> 
> 
>   <!-- lets create a command agent to respond to message based admin
> commands on the ActiveMQ.Agent topic -->
>   <commandAgent xmlns="http://activemq.org/config/1.0"/>
> 
> 
>   <!-- An embedded servlet engine for serving up the Admin console -->
>   <jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
>     <connectors>
>       <nioConnector port="8161" />
>     </connectors>
> 
>     <handlers>
>       <webAppContext contextPath="/admin"
> resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true" />
>       <webAppContext contextPath="/demo"
> resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true" />
>     </handlers>
>   </jetty>
>  
> 
> <!-- MSSQL DataSource Sample Setup --> 
> 
>   <bean id="mssql-ds" class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close"> 
>     <property name="driverClassName"
> value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/> 
>     <property name="url" value="jdbc:sqlserver://mySQLDB:1433"/> 
>     <property name="username" value="admin"/> 
>     <property name="password" value="admin"/>
>     <property name="databaseName" value="test"/>
>     <property name="createDatabase" value="create"/> 
>   </bean>
> 
> </beans>
> <!-- END SNIPPET: example -->
> 
> And I start my embedded broker as :
> broker = BrokerFactory.createBroker(new URI("file:C://activeMQ.xml"));
> 
> Strangely, I got exception below, but my application works successfully?!
> (default broker setting?)
> 
> java.io.IOException: Could load file factory:java.io.IOException: Could
> not find factory class for resource:
> META-INF/services/org/apache/activemq/broker/file
> 	at
> org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:25)
> 	at
> org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:43)
> 	at
> org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:56)
> 	at com.aboveE.powerProcess.util.MQHelper.startBroker(MQHelper.java:65)
> 	at com.aboveE.powerProcess.event.queue.TestMain.<init>(TestMain.java:25)
> 	at com.aboveE.powerProcess.event.queue.TestMain.main(TestMain.java:54)
> Caused by: java.io.IOException: Could not find factory class for resource:
> META-INF/services/org/apache/activemq/broker/file
> 	at
> org.apache.activemq.util.FactoryFinder.doFindFactoryProperies(FactoryFinder.java:90)
> 	at
> org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:58)
> 	at
> org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:47)
> 	at
> org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:41)
> 	... 4 more
> 
> Have I forgotten any tag in configure xml or lib into my application ?
> 
> There is another main factor about performance and persisitency.
> FAQ replies that changing db may reduce performance, however, could I do
> something in case to maintain the performance? (Just as the same as derby,
> possible?)
> 
> Thank you all~:-)
> 
> Sincerely,
> Jean
> 

-- 
View this message in context: http://old.nabble.com/Exception-%3A-factory%3Ajava.io.IOException-tp15219903p26571002.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Exception : factory:java.io.IOException

Posted by ttmdev <jo...@ttmsolutions.com>.
Can't help you re the exception you're getting. However, I do suggest that if
you do not require the jetty servlet engine, that you comment it out of your
embedded broker's xml cfg file. Not running the servlet engine really cuts
down on the overall total number of threads created by the jvm and also
helps cut down on memory usage. Also comment out the command agent and camel
context if those are also not required.  - Joe



JS75 wrote:
> 
> Dear All:
> Now I need to implement two requirements with MQ4.1.
> 1. Start my embedded broker with cofig.xml file.
> 2. Use MS SQL Server instead of default derby.
> 
> And here is my activeMQ.xml (I put it in C disk)
> <!--
>     Licensed to the Apache Software Foundation (ASF) under one or more
>     contributor license agreements.  See the NOTICE file distributed with
>     this work for additional information regarding copyright ownership.
>     The ASF licenses this file to You under the Apache License, Version
> 2.0
>     (the "License"); you may not use this file except in compliance with
>     the License.  You may obtain a copy of the License at
>    
>     http://www.apache.org/licenses/LICENSE-2.0
>    
>     Unless required by applicable law or agreed to in writing, software
>     distributed under the License is distributed on an "AS IS" BASIS,
>     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
>     See the License for the specific language governing permissions and
>     limitations under the License.
> -->
> <!-- START SNIPPET: example -->
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:amq="http://activemq.org/config/1.0"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.org/config/1.0
> http://activemq.apache.org/schema/activemq-core.xsd
>   http://activemq.apache.org/camel/schema/spring
> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
> 
>   <!-- Allows us to use system properties as variables in this
> configuration file -->
>   <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
>   
>   <broker xmlns="http://activemq.org/config/1.0" brokerName="localhost"
> dataDirectory="C://data">
>   
>     <!-- Destination specific policies using destination names or
> wildcards -->
>     <destinationPolicy>
>       <policyMap>
>         <policyEntries>
> 
>           <policyEntry topic="FOO.>" producerFlowControl="false"
> memoryLimit="1mb">
>             <dispatchPolicy>
>               <strictOrderDispatchPolicy/>
>             </dispatchPolicy>
>             <subscriptionRecoveryPolicy>
>               <lastImageSubscriptionRecoveryPolicy/>
>             </subscriptionRecoveryPolicy>
>           </policyEntry>
> 
>         </policyEntries>
>       </policyMap>
>     </destinationPolicy>
> 
> 
>     <!-- The transport connectors ActiveMQ will listen to -->
>     <transportConnectors>
>        <transportConnector name="openwire" uri="tcp://localhost:61616"
> discoveryUri="multicast://default"/>
>        <transportConnector name="ssl"     uri="ssl://localhost:61617"/>
>        <transportConnector name="stomp"   uri="stomp://localhost:61613"/>
>        <transportConnector name="xmpp"    uri="xmpp://localhost:61222"/>
>     </transportConnectors>
> 
>     <!-- The store and forward broker networks ActiveMQ will listen to -->
>     <networkConnectors>
>       <!-- by default just auto discover the other brokers -->
>       <networkConnector name="default-nc" uri="multicast://default"/>
>       <!--
>       <networkConnector name="host1 and host2"
> uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
>       -->
>     </networkConnectors>
> 
> 
>     <!-- Use the following if you wish to configure the journal with JDBC
> -->
>     <!--
>     <persistenceAdapter>
>         <journaledJDBC journalLogFiles="5"
> dataDirectory="${activemq.base}/activemq-data" 
> dataSource="#postgres-ds"/>
>     </persistenceAdapter>
>     -->
> 
>     <!-- Or if you want to use pure JDBC without a journal -->
>     
>     <persistenceAdapter>
>         <jdbcPersistenceAdapter dataSource="#mssql-ds"/>
>     </persistenceAdapter>
>    
>    
>     <!--  Use the following to set the broker memory limit
> 	<systemUsage>
> 	            <systemUsage>
> 		            <memoryUsage>
> 	    	            	<memoryUsage limit="10 mb" percentUsageMinDelta="20"/>
> 		            </memoryUsage>
> 		            <tempUsage>
> 	    	            	<tempUsage limit="100 mb"/>
> 		            </tempUsage>
> 		            <storeUsage>
> 	    	            	<storeUsage limit="1 gb" name="foo"/>
> 		            </storeUsage>
> 	            </systemUsage>
> 	    </systemUsage>
>    -->
>     
>     <!-- Use the following to configure how ActiveMQ is exposed in JMX
>     <managementContext>
>        <managementContext connectorPort="1099"
> jmxDomainName="org.apache.activemq"/>
>     </managementContext>
>     -->
> 
>   </broker>
> 
>   <!--
>     ** Lets deploy some Enterprise Integration Patterns inside the
> ActiveMQ Message Broker
>     ** For more details see
>     **
>     ** http://activemq.apache.org/enterprise-integration-patterns.html
>     -->
>   <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> 
>     <!-- You can use a <package> element for each root package to search
> for Java routes -->
>     <package>org.foo.bar</package>
> 
>     <!-- You can use Spring XML syntax to define the routes here using the
> <route> element -->
>     <route>
>       <from uri="activemq:example.A"/>
>       <to uri="activemq:example.B"/>
>     </route>
>   </camelContext>
> 
> 
> 
>   <!-- lets create a command agent to respond to message based admin
> commands on the ActiveMQ.Agent topic -->
>   <commandAgent xmlns="http://activemq.org/config/1.0"/>
> 
> 
>   <!-- An embedded servlet engine for serving up the Admin console -->
>   <jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
>     <connectors>
>       <nioConnector port="8161" />
>     </connectors>
> 
>     <handlers>
>       <webAppContext contextPath="/admin"
> resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true" />
>       <webAppContext contextPath="/demo"
> resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true" />
>     </handlers>
>   </jetty>
>  
> 
> <!-- MSSQL DataSource Sample Setup --> 
> 
>   <bean id="mssql-ds" class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close"> 
>     <property name="driverClassName"
> value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/> 
>     <property name="url" value="jdbc:sqlserver://mySQLDB:1433"/> 
>     <property name="username" value="admin"/> 
>     <property name="password" value="admin"/>
>     <property name="databaseName" value="test"/>
>     <property name="createDatabase" value="create"/> 
>   </bean>
> 
> </beans>
> <!-- END SNIPPET: example -->
> 
> And I start my embedded broker as :
> broker = BrokerFactory.createBroker(new URI("file:C://activeMQ.xml"));
> 
> Strangely, I got exception below, but my application works successfully?!
> (default broker setting?)
> 
> java.io.IOException: Could load file factory:java.io.IOException: Could
> not find factory class for resource:
> META-INF/services/org/apache/activemq/broker/file
> 	at
> org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:25)
> 	at
> org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:43)
> 	at
> org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:56)
> 	at com.aboveE.powerProcess.util.MQHelper.startBroker(MQHelper.java:65)
> 	at com.aboveE.powerProcess.event.queue.TestMain.<init>(TestMain.java:25)
> 	at com.aboveE.powerProcess.event.queue.TestMain.main(TestMain.java:54)
> Caused by: java.io.IOException: Could not find factory class for resource:
> META-INF/services/org/apache/activemq/broker/file
> 	at
> org.apache.activemq.util.FactoryFinder.doFindFactoryProperies(FactoryFinder.java:90)
> 	at
> org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:58)
> 	at
> org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:47)
> 	at
> org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:41)
> 	... 4 more
> 
> Have I forgotten any tag in configure xml or lib into my application ?
> 
> There is another main factor about performance and persisitency.
> FAQ replies that changing db may reduce performance, however, could I do
> something in case to maintain the performance? (Just as the same as derby,
> possible?)
> 
> Thank you all~:-)
> 
> Sincerely,
> Jean
> 

-- 
View this message in context: http://www.nabble.com/Exception-%3A-factory%3Ajava.io.IOException-tp15219903s2354p15276368.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.