Kay,

Yes you are right regarding the source file being in classpath ,I tried 
with  with the class file and below are the snippet of the exception i am 
getting,

ARN : org.graylog2.rules.DroolsEngine - Unable to add rules due to 
compilation errors.
org.graylog2.rules.RulesCompilationException: Message [id=1, level=ERROR, 
path=r1.drl, line=1, column=0
   text=Error importing : 'etc.code.PropertiesCache']
Message [id=2, level=ERROR, path=src/main/resources/null, line=17, column=0
   text=Rule Compilation error Only a type can be imported. 
etc.code.PropertiesCache resolves to a package]
Message [id=3, level=ERROR, path=src/main/resources/null, line=25, column=0
   text=Rule Compilation error Only a type can be imported. 
etc.code.PropertiesCache resolves to a package]
Message [id=4, level=ERROR, path=r1.drl, line=33, column=0
   text=Rule Compilation error Only a type can be imported. 
etc.code.PropertiesCache resolves to a package
PropertiesCache cannot be resolved]
Message [id=5, level=ERROR, path=*src/main/resources/null*, line=9, column=0
   text=Rule Compilation error Only a type can be imported. 
etc.code.PropertiesCache resolves to a package]

 i am particularly interested in src/main/resources/null , does it mean my 
class files needs to be in src/main/resources and a rebuild of graylog 
source needs to be done for graylog to recognize my import. Kindly advice. 
Attached detailed exception trace


On Thursday, 7 April 2016 14:40:01 UTC+5:30, rajarshi bhattacharjee wrote:
>
> Hi Kay,
>
> Thanks for your prompt reply.  Please correct me if i am wrong , creating 
> a standalone jar with a compiled .class and referencing the jar file 
> through import should solve it , or i need to add it to  graylog build  as 
> per graylog plugin.I d be more inclined towards a standalone jar approach 
> but unsure whether graylog will pick it up.
>
> Regards
> Rajarshi 
>
> On Thursday, 7 April 2016 12:28:03 UTC+5:30, Kay Roepke wrote:
>>
>> Hi!
>>
>> It looks like you put the Java source file onto the classpath, which 
>> doesn't work.
>> You need to compile it as part of your build (possibly as a graylog 
>> plugin, or manually and then adding it to the classpath). The resulting 
>> file name ends with .class, not .java.
>>
>> The imports look good to me, but the error message and the classpath you 
>> posted indicate that this is the problem.
>>
>> Best regards,
>> Kay
>>
>> On Thursday, 7 April 2016 08:10:12 UTC+2, rajarshi bhattacharjee wrote:
>>>
>>>
>>>
>>> On Wednesday, 6 April 2016 15:20:32 UTC+5:30, rajarshi bhattacharjee 
>>> wrote:
>>>>
>>>>  I am actually new to graylog and frankly not quite aware of how 
>>>> graylog is triggering the drools rule engine so it might be a very simple 
>>>> question with an obvious solution which is somehow escaping me .
>>>>
>>>>
>>>>  I am  trying to improve an already existing (drl code) by invoking 
>>>> another java class , which is residing within a different directory as 
>>>> compared to my drl file. Understood that graylog doesnt allow adding other 
>>>> packages definitions(
>>>> https://github.com/Graylog2/graylog2-server/issues/1213) , so tried 
>>>> with a direct import by putting the java class in a different directory, 
>>>> but when i try to invoke this java class my drl fails with the following 
>>>> exception `Rule Compilation error : [Rule name='BPTM logs filter']
>>>> org/graylog2/rules/Rule_BPTM_logs_filter508671689.java (42:2371) : 
>>>> *PropertiesCache 
>>>> cannot be resolved*
>>>>
>>>> 2016-04-06 09:11:09,601 WARN : org.graylog2.rules.DroolsEngine - Unable 
>>>> to add rules due to compilation errors.
>>>> org.graylog2.rules.RulesCompilationException: Message [id=1, 
>>>> level=ERROR, path=r1.drl, line=30, column=0
>>>> text=Rule Compilation error PropertiesCache cannot be resolved]
>>>>
>>>> Note :PropertiesCache is my  java class and my drl file exists in 
>>>> different directories. Pretty much its not able to resolve the import and 
>>>> fails with compilation error
>>>>
>>>> Any insights would be valuable ,
>>>>
>>>
>>> Attached DRL file , along with PropertiesCache.java file (external class 
>>> i am trying to invoke)
>>>  
>>> Please advice , i am not sure whether this error is due to 
>>> environment/drools/or graylog restrictions as i m new to both drools and 
>>> graylog and just trying to improve this code from java perspective
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Graylog Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/graylog2/5902a952-a425-414d-93d6-56a3fcc09fc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
2016-04-07 09:59:00,476 INFO : org.graylog2.bootstrap.CmdLineTool - Loaded 
plugins: [Splunk Output 0.3.0 [com.graylog.splunk.output.SplunkOutputPlugin], 
Anonymous Usage Statistics 1.1.1 
[org.graylog.plugins.usagestatistics.UsageStatsPlugin]]
2016-04-07 09:59:00,563 INFO : org.graylog2.bootstrap.CmdLineTool - Running 
with JVM arguments: 
-Djava.library.path=/wls_domains/Graylog/GraylogServer/graylog-1.2.1/etc/init.d/../lib/sigar
 -Xms5g -Xmx5g -XX:NewRatio=1 -XX:PermSize=2g -XX:MaxPermSize=2g 
-XX:+ResizeTLAB -XX:+UseConcMarkSweepGC -XX:+CMSConcurrentMTEnabled 
-XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC -XX:-OmitStackTraceInFastThrow
2016-04-07 09:59:01,306 INFO : org.graylog2.shared.system.stats.SigarService - 
Failed to load SIGAR. Falling back to JMX implementations.
2016-04-07 09:59:03,534 INFO : org.graylog2.shared.buffers.InputBufferImpl - 
Message journal is enabled.
2016-04-07 09:59:03,741 INFO : kafka.log.LogManager - Loading logs.
2016-04-07 09:59:03,748 INFO : kafka.log.LogManager - Logs loading complete.
2016-04-07 09:59:03,816 INFO : kafka.log.LogManager - Created log for partition 
[messagejournal,0] in 
/wls_domains/Graylog/GraylogServer/graylog-1.2.1/etc/data/journal with 
properties {segment.index.bytes -> 1048576, file.delete.delay.ms -> 60000, 
segment.bytes -> 104857600, flush.ms -> 60000, delete.retention.ms -> 86400000, 
index.interval.bytes -> 4096, retention.bytes -> 107374182400, 
min.insync.replicas -> 0, cleanup.policy -> delete, 
unclean.leader.election.enable -> true, segment.ms -> 3600000, 
max.message.bytes -> 2147483647, flush.messages -> 1000000, 
min.cleanable.dirty.ratio -> 0.5, retention.ms -> 86400000, segment.jitter.ms 
-> 0}.
2016-04-07 09:59:03,816 INFO : org.graylog2.shared.journal.KafkaJournal - 
Initialized Kafka based journal at 
/wls_domains/Graylog/GraylogServer/graylog-1.2.1/etc/data/journal
2016-04-07 09:59:03,836 INFO : org.graylog2.shared.buffers.InputBufferImpl - 
Initialized InputBufferImpl with ring size <65536> and wait strategy 
<BlockingWaitStrategy>, running 10 parallel message handlers.
2016-04-07 09:59:13,921 ERROR: 
org.graylog2.bindings.providers.MongoConnectionProvider - Error connecting to 
MongoDB: Timed out after 10000 ms while waiting to connect. Client view of 
cluster state is {type=Unknown, servers=[{address=10.230.189.179:27017, 
type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: 
Exception opening the socket}, caused by {java.net.ConnectException: Connection 
refused}}]
2016-04-07 09:59:14,079 INFO : org.graylog2.plugin.system.NodeId - Node ID: 
node1
2016-04-07 09:59:14,393 INFO : org.elasticsearch.node - [graylog2-server] 
version[1.7.1], pid[5228], build[b88f43f/2015-07-29T09:54:16Z]
2016-04-07 09:59:14,393 INFO : org.elasticsearch.node - [graylog2-server] 
initializing ...
2016-04-07 09:59:14,463 INFO : org.elasticsearch.plugins - [graylog2-server] 
loaded [graylog-monitor], sites []
2016-04-07 09:59:16,135 INFO : org.elasticsearch.node - [graylog2-server] 
initialized
2016-04-07 09:59:16,189 INFO : org.hibernate.validator.internal.util.Version - 
HV000001: Hibernate Validator 5.1.3.Final
2016-04-07 09:59:26,274 INFO : org.graylog2.shared.buffers.ProcessBuffer - 
Initialized ProcessBuffer with ring size <65536> and wait strategy 
<BlockingWaitStrategy>.
2016-04-07 09:59:28,462 ERROR: 
org.drools.compiler.kie.builder.impl.AbstractKieModule - Unable to build 
KieBaseModel:defaultKieBase
Error importing : 'etc.code.PropertiesCache'
Rule Compilation error : [Rule name='blacklist any field pattern']
        org/graylog2/rules/Rule_blacklist_any_field_pattern1051638701.java 
(2:438) : Only a type can be imported. etc.code.PropertiesCache resolves to a 
package

Rule Compilation error : [Rule name='blacklist hostname inet mask']
        org/graylog2/rules/Rule_blacklist_hostname_inet_mask1051638701.java 
(2:438) : Only a type can be imported. etc.code.PropertiesCache resolves to a 
package

Rule Compilation error : [Rule name='BPTM logs filter']
        org/graylog2/rules/Rule_BPTM_logs_filter1028821246.java (2:438) : Only 
a type can be imported. etc.code.PropertiesCache resolves to a package
        org/graylog2/rules/Rule_BPTM_logs_filter1028821246.java (41:2409) : 
PropertiesCache cannot be resolved

Rule Compilation error : [Rule name='blacklist any field equality']
        org/graylog2/rules/Rule_blacklist_any_field_equality1425306609.java 
(2:438) : Only a type can be imported. etc.code.PropertiesCache resolves to a 
package


2016-04-07 09:59:28,463 WARN : org.graylog2.rules.DroolsEngine - Unable to add 
rules due to compilation errors.
org.graylog2.rules.RulesCompilationException: Message [id=1, level=ERROR, 
path=r1.drl, line=1, column=0
   text=Error importing : 'etc.code.PropertiesCache']
Message [id=2, level=ERROR, path=src/main/resources/null, line=17, column=0
   text=Rule Compilation error Only a type can be imported. 
etc.code.PropertiesCache resolves to a package]
Message [id=3, level=ERROR, path=src/main/resources/null, line=25, column=0
   text=Rule Compilation error Only a type can be imported. 
etc.code.PropertiesCache resolves to a package]
Message [id=4, level=ERROR, path=r1.drl, line=33, column=0
   text=Rule Compilation error Only a type can be imported. 
etc.code.PropertiesCache resolves to a package
PropertiesCache cannot be resolved]
Message [id=5, level=ERROR, path=src/main/resources/null, line=9, column=0
   text=Rule Compilation error Only a type can be imported. 
etc.code.PropertiesCache resolves to a package]

        at org.graylog2.rules.DroolsEngine.createKJar(DroolsEngine.java:232)
        at 
org.graylog2.rules.DroolsEngine.createAndDeployJar(DroolsEngine.java:194)
        at org.graylog2.rules.DroolsEngine.deployRules(DroolsEngine.java:169)
        at org.graylog2.rules.DroolsEngine.commitRules(DroolsEngine.java:147)
        at org.graylog2.rules.DroolsEngine.addRule(DroolsEngine.java:89)
        at 
org.graylog2.rules.DroolsEngine.addRulesFromFile(DroolsEngine.java:102)
        at 
org.graylog2.bindings.providers.RulesEngineProvider.<init>(RulesEngineProvider.java:45)
        at 
org.graylog2.bindings.providers.RulesEngineProvider$$FastClassByGuice$$3947f391.newInstance(<generated>)
        at 
com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
        at 
com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
        at 
com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:105)
        at 
com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
        at 
com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
        at 
com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at 
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at 
com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at 
com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
        at 
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at 
com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:61)
        at 
com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
        at 
com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
        at 
com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
        at 
com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
        at 
com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
        at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
        at 
com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
        at 
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
        at 
com.google.inject.multibindings.Multibinder$RealMultibinder.get(Multibinder.java:375)
        at 
com.google.inject.multibindings.Multibinder$RealMultibinder.get(Multibinder.java:258)
        at 
com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
        at 
com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53)
        at 
com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
        at 
com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
        at 
com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
        at 
com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
        at 
com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
        at 
com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
        at 
com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
        at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
        at 
com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
        at 
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
        at 
org.graylog2.shared.buffers.ProcessBuffer.<init>(ProcessBuffer.java:113)
        at 
org.graylog2.shared.buffers.ProcessBuffer$$FastClassByGuice$$ef94431e.newInstance(<generated>)
        at 
com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
        at 
com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
        at 
com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:105)
        at 
com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
        at 
com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
        at 
com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at 
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at 
com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at 
com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
        at 
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at 
com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
        at 
com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
        at 
com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
        at 
com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
        at 
com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
        at 
com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
        at 
com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
        at 
com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
        at 
com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
        at 
com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
        at 
com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at 
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at 
com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at 
com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
        at 
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at 
com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
        at 
com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
        at 
com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
        at 
com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
        at 
com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
        at 
com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at 
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at 
com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at 
com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
        at 
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at 
com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
        at 
com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
        at 
com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
        at 
com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
        at 
com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
        at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
        at 
com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
        at 
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
        at 
com.google.inject.multibindings.Multibinder$RealMultibinder.get(Multibinder.java:375)
        at 
com.google.inject.multibindings.Multibinder$RealMultibinder.get(Multibinder.java:258)
        at 
com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
        at 
com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53)
        at 
com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
        at 
com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
        at 
com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
        at 
com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
        at 
com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
        at 
com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
        at 
com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
        at 
com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at 
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at 
com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at 
com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
        at 
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
        at 
com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
        at 
com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
        at 
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
        at 
com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
        at 
com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
        at 
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
        at com.google.inject.Guice.createInjector(Guice.java:96)
        at 
org.graylog2.shared.bindings.Hk2GuiceBridgeJitInjector.create(Hk2GuiceBridgeJitInjector.java:60)
        at 
org.graylog2.shared.bindings.GuiceInjectorHolder.createInjector(GuiceInjectorHolder.java:32)
        at 
org.graylog2.bootstrap.CmdLineTool.setupInjector(CmdLineTool.java:349)
        at org.graylog2.bootstrap.CmdLineTool.run(CmdLineTool.java:173)
        at org.graylog2.bootstrap.Main.main(Main.java:44)
2016-04-07 09:59:28,467 WARN : 
org.graylog2.bindings.providers.RulesEngineProvider - Unable to load rules due 
to load error: /wls_domains/Graylog/GraylogServer/graylog-1.2.1/etc/graylog.drl
2016-04-07 09:59:38,497 INFO : org.graylog2.buffers.OutputBuffer - Initialized 
OutputBuffer with ring size <65536> and wait strategy <BlockingWaitStrategy>.

Reply via email to