amoeba-aladdin 运行报错

发布于 2021-11-18 17:57:57 字数 12410 浏览 796 评论 3

环境:

 amoeba-aladdin-binary-1.0.0-BETA

 JDK7

 MYSQL5.2

问题:

      配置 dbServers.xml和 amoeba.xml 后,执行命令amoeba start 报错,哪里配的不对呢?:

D:amoeba-aladdin-binary-1.0.0-BETAbin>amoeba start
log4j:WARN log4j config load completed from file:D:amoeba-aladdin-binary-1.0.0-
BETAbin..conflog4j.xml
Exception in thread "main" java.lang.NullPointerException
        at com.meidusa.amoeba.route.AbstractQueryRouter.init(AbstractQueryRouter
.java:579)
        at com.meidusa.amoeba.context.ProxyRuntimeContext.initAllInitialisableBe
ans(ProxyRuntimeContext.java:331)
        at com.meidusa.amoeba.context.ProxyRuntimeContext.init(ProxyRuntimeConte
xt.java:291)
        at com.meidusa.amoeba.server.AmoebaProxyServer.main(AmoebaProxyServer.ja
va:161)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:461)

dbServers.xml文件内容 --------------------

<?xml version="1.0" encoding="gbk"?>



<!DOCTYPE amoeba:dbServers SYSTEM "dbserver.dtd">
<amoeba:dbServers xmlns:amoeba="http://amoeba.meidusa.com/">


<!-- 
Each dbServer needs to be configured into a Pool,
If you need to configure multiple dbServer with load balancing that can be simplified by the following configuration:
add attribute with name virtual = "true" in dbServer, but the configuration does not allow the element with name factoryConfig
such as 'multiPool' dbServer   
-->

<dbServer name="abstractServer" abstractive="true">

<!-- PoolableObjectFactory实现类 -->
<factoryConfig class="com.meidusa.amoeba.jdbc.JdbcConnectionFactory">

<!-- driver name, pls put mysql jdbc driver into lib folder -->
<property name="driver">
   <bean class="com.meidusa.amoeba.jdbc.DriverWrapper">
<property name="driver">
<bean class="com.mysql.jdbc.Driver"/>
</property>
</bean>
</property>

<!-- 
<property name="driver">
<bean class="com.meidusa.amoeba.jdbc.DriverWrapper">
<property name="driver">
<bean class="com.mysql.jdbc.Driver"/>
</property>
<property name="clientEncoding">gbk</property>
<property name="serverEncoding">ISO_8859_1</property>
</bean>
</property>
-->
 
<!-- jdbc url. -->
<property name="url">jdbc:mysql://127.0.0.1:3308/test</property>

<!-- url -->
<property name="properties">
<bean class="java.util.Properties">
<!-- 用于登陆mysql的用户名 -->
<property name="user">root</property>

<!-- for mysql driver -->
<property name="characterEncoding">utf8</property>
<!-- 用于登陆mysql的密码 -->


<property name="password">csicsc</property>


</bean>
</property>

</factoryConfig>

<!-- ObjectPool实现类 -->
<poolConfig class="com.meidusa.amoeba.net.poolable.PoolableObjectPool">
<property name="maxActive">200</property>
<property name="maxIdle">200</property>
<property name="minIdle">10</property>
<property name="minEvictableIdleTimeMillis">600000</property>
<property name="timeBetweenEvictionRunsMillis">600000</property>
<property name="testOnBorrow">true</property>
<property name="testWhileIdle">true</property>
</poolConfig>
</dbServer>


<dbServer name="server1"  parent="abstractServer">
<factoryConfig>
<!-- mysql ip -->
<property name="url">jdbc:mysql://172.31.6.23:3308/test</property>
</factoryConfig>
</dbServer>

<dbServer name="server2"  parent="abstractServer">
<factoryConfig>
<!-- mysql ip -->
<property name="url">jdbc:mysql://172.31.6.23:3306/test</property>
</factoryConfig>
</dbServer>

<dbServer name="multiPool" virtual="true">
<poolConfig class="com.meidusa.amoeba.server.MultipleServerPool">
<!-- Load balancing strategy: 1=ROUNDROBIN , 2=WEIGHTBASED , 3=HA-->
<property name="loadbalance">1</property>

<!-- Separated by commas,such as: server1,server2,server1 -->
<property name="poolNames">server1,server2</property>
</poolConfig>
</dbServer>

<!-- 
if you have no mysql server, _null_table_ pool can provide query response to client,
for such sql without table name: select @@sql_mode
-->
<dbServer name="_null_table_">
<!-- PoolableObjectFactory实现类 -->
<factoryConfig class="com.meidusa.amoeba.aladdin.poolable.QueryResponseObjectFactory">

<!-- driver name -->
<property name="messageHandlerRunner">com.meidusa.amoeba.aladdin.handler.MysqlMessageHandlerRunner</property>
<property name="runnerParameters">
<bean class="java.util.Properties">
<property name="xmlTable">${amoeba.home}/conf/table.xml</property>
</bean>
</property>

</factoryConfig>

<!-- ObjectPool实现类 -->
<poolConfig class="com.meidusa.amoeba.net.poolable.PoolableObjectPool">
<property name="maxActive">200</property>
<property name="maxIdle">200</property>
<property name="minIdle">10</property>
<property name="minEvictableIdleTimeMillis">600000</property>
<property name="timeBetweenEvictionRunsMillis">600000</property>
<property name="testOnBorrow">true</property>
<property name="testWhileIdle">true</property>
</poolConfig>
</dbServer>
</amoeba:dbServers>

amoeba.xml文件内容-------------------------------------------

<?xml version="1.0" encoding="gbk"?>


<!DOCTYPE amoeba:configuration SYSTEM "amoeba.dtd">
<amoeba:configuration xmlns:amoeba="http://amoeba.meidusa.com/">


<proxy>

<!-- service class must implements com.meidusa.amoeba.service.Service -->
<service name="Amoeba for Aladdin" class="com.meidusa.amoeba.net.ServerableConnectionManager">
<!-- port -->
<property name="port">8066</property>

<!-- bind ipAddress -->
<!-- 
<property name="ipAddress">127.0.0.1</property>
-->

<property name="manager">${clientConnectioneManager}</property>

<property name="connectionFactory">
<bean class="com.meidusa.amoeba.aladdin.net.AladdinClientConnectionFactory">
<property name="sendBufferSize">128</property>
<property name="receiveBufferSize">64</property>
</bean>
</property>

<property name="authenticator">
<bean class="com.meidusa.amoeba.mysql.server.MysqlClientAuthenticator">

<property name="user">root</property>

<property name="password">csicsc</property>

<property name="filter">
<bean class="com.meidusa.amoeba.server.IPAccessController">
<property name="ipFile">${amoeba.home}/conf/access_list.conf</property>
</bean>
</property>
</bean>
</property>

</service>

<!-- server class must implements com.meidusa.amoeba.service.Service -->
<service name="Amoeba Monitor Server" class="com.meidusa.amoeba.monitor.MonitorServer">
<!-- port -->
<!--  default value: random number
<property name="port">9066</property>
-->
<!-- bind ipAddress -->
<property name="ipAddress">127.0.0.1</property>
<property name="daemon">true</property>
<property name="manager">${clientConnectioneManager}</property>
<property name="connectionFactory">
<bean class="com.meidusa.amoeba.monitor.net.MonitorClientConnectionFactory"></bean>
</property>

</service>

<runtime class="com.meidusa.amoeba.mysql.context.MysqlRuntimeContext">
<!-- proxy server net IO Read thread size -->
<property name="readThreadPoolSize">20</property>

<!-- proxy server client process thread size -->
<property name="clientSideThreadPoolSize">30</property>

<!-- mysql server data packet process thread size -->
<property name="serverSideThreadPoolSize">30</property>

<!-- per connection cache prepared statement size  -->
<property name="statementCacheSize">500</property>

<!-- query timeout( default: 60 second , TimeUnit:second) -->
<property name="queryTimeout">60</property>

<property name="serverCharset">utf8</property>
</runtime>

</proxy>

<!-- 
Each ConnectionManager will start as thread
manager responsible for the Connection IO read , Death Detection
-->
<connectionManagerList>
<connectionManager name="clientConnectioneManager" class="com.meidusa.amoeba.net.MultiConnectionManagerWrapper">
<property name="subManagerClassName">com.meidusa.amoeba.net.ConnectionManager</property>
<!-- 
 default value is avaliable Processors 
<property name="processors">5</property>
-->
</connectionManager>
<connectionManager name="defaultManager" class="com.meidusa.amoeba.net.MultiConnectionManagerWrapper">
<property name="subManagerClassName">com.meidusa.amoeba.net.AuthingableConnectionManager</property>

<!-- 
 default value is avaliable Processors 
<property name="processors">5</property>
-->
</connectionManager>
</connectionManagerList>

<!-- default using file loader -->
<dbServerLoader class="com.meidusa.amoeba.context.DBServerConfigFileLoader">
<property name="configFile">${amoeba.home}/conf/dbServers.xml</property>
</dbServerLoader>

<queryRouter class="com.meidusa.amoeba.aladdin.parser.AladdinQueryRouter">
<property name="ruleLoader">
<bean class="com.meidusa.amoeba.route.TableRuleFileLoader">
<property name="ruleFile">${amoeba.home}/conf/rule.xml</property>
<property name="functionFile">${amoeba.home}/conf/ruleFunctionMap.xml</property>
</bean>
</property>
<property name="sqlFunctionFile">${amoeba.home}/conf/functionMap.xml</property>
<property name="LRUMapSize">1500</property>
<property name="defaultPool">_null_table_</property>

<!--
<property name="writePool">server1</property>
<property name="readPool">server1</property>
-->
<property name="needParse">true</property>
</queryRouter>
</amoeba:configuration>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

狼亦尘 2021-11-23 10:06:07

好的,我先试试换成1.6版本。

回眸一笑 2021-11-19 19:50:02

最好使用1.5 或1.6版本的 jdk

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文