При подключении к Cassandra потоковый процессор WSO2 выдает ошибку - PullRequest
0 голосов
/ 10 марта 2019

Я пытаюсь подключить свое приложение сиддхи к хранилищу данных кассандры, следуя инструкциям, приведенным в примере программы, приведенной в редакторе.Я скачал datastax java jar (Osgi), поместил его в папку WSO2 / lib и теперь запустил приложение.Теперь я получаю сообщение об ошибке

> [2019-03-10_16-41-17_549] ERROR {org.wso2.siddhi.core.table.Table} - Error on 'Store-cassandra'. . Error while connecting to Table 'SweetProductionTable'. (Encoded)
java.lang.NullPointerException
    at org.wso2.extension.siddhi.store.cassandra.CassandraEventTable.connect(CassandraEventTable.java:443)
    at org.wso2.siddhi.core.table.Table.connectWithRetry(Table.java:388)
    at org.wso2.siddhi.core.SiddhiAppRuntime.startWithoutSources(SiddhiAppRuntime.java:401)
    at org.wso2.siddhi.core.SiddhiAppRuntime.start(SiddhiAppRuntime.java:376)
    at org.wso2.carbon.siddhi.editor.core.internal.DebugRuntime.start(DebugRuntime.java:68)
    at org.wso2.carbon.siddhi.editor.core.internal.DebugProcessorService.start(DebugProcessorService.java:37)
    at org.wso2.carbon.siddhi.editor.core.internal.EditorMicroservice.start(EditorMicroservice.java:588)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.wso2.msf4j.internal.router.HttpMethodInfo.invokeResource(HttpMethodInfo.java:187)
    at org.wso2.msf4j.internal.router.HttpMethodInfo.invoke(HttpMethodInfo.java:143)
    at org.wso2.msf4j.internal.MSF4JHttpConnectorListener.dispatchMethod(MSF4JHttpConnectorListener.java:218)
    at org.wso2.msf4j.internal.MSF4JHttpConnectorListener.lambda$onMessage$57(MSF4JHttpConnectorListener.java:129)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

[2019-03-10_16-41-17_551] ERROR {org.wso2.siddhi.core.SiddhiAppRuntime} - Error starting Siddhi App 'Store-cassandra', triggering shutdown process. null (Encoded)

Ниже приведен соответствующий код

define stream SweetProductionStream (id int, name string);

@Store(type='cassandra' , cassandra.host='localhost' ,keyspace='production')
@index('uid')
@primaryKey('uid') 
define table SweetProductionTable (uid int, name string);

/* Inserting event into the cassandra keyspace */
@info(name='query1')
from SweetProductionStream
select SweetProductionStream.id as uid, SweetProductionStream.name
insert into SweetProductionTable;

, а ниже приведены инструкции, приведенные в примере

Prerequisites:
    1) Ensure that Cassandra version 3 or above is installed on your machine. 
    2) Add the DataStax Java driver into {WSO2_SP_HOME}/lib as follows:
           a) Download the DataStax Java driver from: http://central.maven.org/maven2/com/datastax/cassandra/cassandra-driver-core/3.3.2/cassandra-driver-core-3.3.2.jar
           b) Use the "jartobundle" tool in {WSO2_SP_Home}/bin to extract and convert the above JARs into OSGi bundles.
            For Windows: <SP_HOME>/bin/jartobundle.bat <PATH_OF_DOWNLOADED_JAR> <PATH_OF_CONVERTED_JAR>
            For Linux: <SP_HOME>/bin/jartobundle.sh <PATH_OF_DOWNLOADED_JAR> <PATH_OF_CONVERTED_JAR>
            Note: The driver given in the above link is a OSGi bundled one. Please skip this step if the jar is already OSGi bunbled.
           c) Copy the converted bundles to the {WSO2_SP_Home}/lib directory.
    3) Create a keyspace named 'production' in Cassanndra store.
    4) In the store configuration of this application, replace 'username' and 'password' values with your Cassandra credentials.
    5) Save this sample.

Executing the Sample:
    1) Start the Siddhi application by clicking on 'Run'.
    2) If the Siddhi application starts successfully, the following message is shown on the console
        * Store-cassandra.siddhi - Started Successfully!

    Note:
    If you want to edit this application while it's running, stop the application, make your edits and save the application, and then start it again. 

Testing the Sample:
    1) Simulate single events:
        a) Click on 'Event Simulator' (double arrows on left tab) and click 'Single Simulation'
        b) Select 'Store-cassandra' as 'Siddhi App Name' and select 'searchSweetProductionStream' as 'Stream Name'.
        c) Provide attribute values, and then click Send.
    2) Send at least one event where the name matches a name value in the data you previously inserted into the SweetProductionTable. This will satisfy the 'on' condition of the join query.
    3) Optionally, send events to the other corresponding streams to add, delete, update, insert, and search events.

    Notes:
    - After a change in the store, you can use the search stream to see whether the operation is successful.
    - The Primary Key constraint in SweetProductionTable is disabled, because the name cannot be used as a PrimaryKey in a ProductionTable.
    - You can use Siddhi functions to create a unique ID for the received events, which can then be used to apply the Primary Key constraint on the data store records. (http://wso2.github.io/siddhi/documentation/siddhi-4.0/#function)

Viewing the Results:
    See the output for raw materials on the console. You can use searchSweetProductionStream to check for inserted, deleted, and updated events.

*/

Заранее спасибо.

1 Ответ

0 голосов
/ 11 марта 2019

пожалуйста, предоставьте свои учетные данные Cassandra (имя пользователя и пароль).Например: @store (type = 'cassandra', cassandra.host = 'localhost', имя пользователя = 'cassandra', пароль = 'cassandra', пространство ключей = 'production', column.family = 'SweetProductionTable')

Пожалуйста, обратитесь к этому образцу. Магазин Сиддхи Касссандра

...