2013-09-16 81 views
1

我有一個用於在ActiveMQ上啓動服務器的java類,我想用JMS消息傳遞來連接磨牀,所以我使用磨牀在jython中編寫客戶端代碼。當我運行的服務器,並嘗試從我的Jython客戶端發送郵件時,我收到以下錯誤:使磨牀與jython一起工作

2013-09-16 12:38:40,802 INFO home-0 : The Grinder version 3.11 
2013-09-16 12:38:40,807 INFO home-0 : Java(TM) SE Runtime Environment 1.7.0_25-b15: Java HotSpot(TM) 64-Bit Server VM (23.25-b01, mixed mode) on Mac OS X x86_64 10.8.3 
2013-09-16 12:38:40,810 INFO home-0 : time zone is EDT (-0400) 
2013-09-16 12:38:40,887 INFO home-0 : worker process 0 
2013-09-16 12:38:40,933 INFO home-0 : instrumentation agents: byte code transforming instrumenter for Jython 2.5; byte code transforming instrumenter for Java 
2013-09-16 12:38:43,771 INFO home-0 : running "http.py" using Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] 
2013-09-16 12:38:43,814 ERROR home-0 thread-0: aborting thread - {}The result of 'TestRunner()' is not callable 
net.grinder.scriptengine.jython.JythonScriptExecutionException: The result of 'TestRunner()' is not callable 
    at net.grinder.scriptengine.jython.JythonScriptEngine.createWorkerRunnable(JythonScriptEngine.java:183) ~[grinder-core-3.11.jar:na] 
    at net.grinder.engine.process.GrinderProcess$ThreadStarterImplementation$2.create(GrinderProcess.java:784) ~[grinder-core-3.11.jar:na] 
    at net.grinder.engine.process.GrinderThread.run(GrinderThread.java:90) ~[grinder-core-3.11.jar:na] 
    at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25] 
2013-09-16 12:38:43,814 INFO home-0 : start time is 1379349523814 ms since Epoch 
2013-09-16 12:38:43,817 INFO home-0 : elapsed time is 3 ms 
2013-09-16 12:38:43,817 INFO home-0 : Final statistics for this process: 
2013-09-16 12:38:43,823 INFO home-0 : 
      Tests  Errors  Mean Test Test Time TPS   
             Time (ms) Standard     
                Deviation     
                (ms)      
Totals  0   0   -   0.00   0.00   
    Tests resulting in error only contribute to the Errors column.   
    Statistics for individual tests can be found in the data file, including 
    (possibly incomplete) statistics for erroneous tests. Composite tests 
    are marked with() and not included in the totals.      

我的客戶端代碼是如下:

from net.grinder.script.Grinder import grinder 
from net.grinder.script import Test 


from com.droitfintech.core.jms.factory import JMSBuilderFactory 

log=grinder.logger 
test1=Test(1,"Log method") 
test1.record(log) 

class TestRunner: 
    def _call_(self): 
     log=grinder.logger.info 
     log("Creating queue session") 
     messageQueueName="InputQueue" 

     fileName=open('basis_USD3s6s.xml','r+').read() 


     print fileName  
     newInstance=JMSBuilderFactory.getInstance() 
     newInstance.getConnector().sendMessage(messageQueueName,fileName) 

回答

1

_call_方法重新命名爲__call__