开发者社区> 问答> 正文

amoeba-aladdin 运行报错?报错

环境:

 amoeba-aladdin-binary-1.0.0-BETA

 JDK7

 MYSQL5.2

问题:

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

D:\amoeba-aladdin-binary-1.0.0-BETA\bin>amoeba start
log4j:WARN log4j config load completed from file:D:\amoeba-aladdin-binary-1.0.0-
BETA\bin\..\conf\log4j.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>

展开
收起
爱吃鱼的程序员 2020-06-22 17:36:45 315 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    最好使用1.5或1.6版本的jdk

    <arel="nofollow">http://docs.hexnova.com/amoeba/index.html

    按照这里的教程来。

    好的,我先试试换成1.6版本。<imgsrc="http://www.oschina.net/js/ke/plugins/emoticons/images/81.gif"alt=""/>

    2020-06-22 17:37:02
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载