If you are using maven you will need to add the dependency to your pom
file.. if not you will need to get the jar from somewhere.. like here for
example:
On Wed, Sep 11, 2013 at 11:01 AM, Moses Kalema <mkgremo20(a)gmail.com> wrote:
Where can i get?
On Wed, Sep 11, 2013 at 12:53 PM, Mauricio Salatino <salaboy(a)gmail.com>wrote:
> Ok, so the error is pretty clear: java.lang.NoClassDefFoundError:
> org/slf4j/LoggerFactory
>
> You need to add that to your class path
>
>
> On Wed, Sep 11, 2013 at 10:51 AM, Moses Kalema <mkgremo20(a)gmail.com>wrote:
>
>> In my serviceImplementation[in the server package] class in GWT RPC
>> When i try to check the execution the system doesn't run this line:
>> KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
>>
>> KnowledgeBuilder kbuilder =
>> KnowledgeBuilderFactory.newKnowledgeBuilder();
>> //inputStream =
>> this.getClass().getClassLoader().getResourceAsStream("ChangeSet.xml");
>> url= this.getClass().getClassLoader().getResource("ChangeSet.xml");
>> workingDirectory = System.getProperty("user.dir");
>> System.out.println("URL "+url);
>> file = new File(workingDirectory +"/src/ChangeSet.xml");
>> if(file.exists()){
>> System.out.println("Directory "+file.getName());
>> }
>> else{
>> System.out.println("File not seen");
>> }
>> kbuilder.add(
>> ResourceFactory.newUrlResource(url),ResourceType.CHANGE_SET);
>> if( kbuilder.hasErrors() ) {
>>
>> System.out.println( kbuilder.getErrors() );
>> System.out.println("The changeset file has errors");
>> // return;
>> }else{
>> System.out.println("The changeset has no errors");
>> }
>>
>> KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
>> System.out.println("knowledgebase has been created");
>>
>> KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent(
>> "MyAgent" );
>> // URL url = getClass().getResource("ChangeSet.xml");
>> // File file = new File(url.getPath());
>> kagent.applyChangeSet( ResourceFactory.newUrlResource(url) );
>> kbase = kagent.getKnowledgeBase();
>> ResourceFactory.getResourceChangeNotifierService().start();
>> ResourceFactory.getResourceChangeScannerService().start();
>> System.out.println("knowledge agent created");
>>
>> StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
>> System.out.println("session created");
>> FactType factType = kbase.getFactType("procnet.requisition.test",
>> "requisition");
>> try {
>> Object obj = factType.newInstance();
>> factType.set(obj, "requisitionType", requisitionType);
>> factType.set(obj, "totalCost", totalCost);
>> FactHandle objHandle = ksession.insert(obj);
>> ksession.fireAllRules();
>> System.out.println(factType.get(obj, "approvalMessage"));
>> approvalMessage = (String) factType.get(obj, "approvalMessage");
>> //System.out.println(factType.get(obj, "name"));
>> } catch (InstantiationException e) {
>> e.printStackTrace();
>> } catch (IllegalAccessException e) {
>> e.printStackTrace();
>> }
>> return approvalMessage;
>> This is the exact code i use in a normal java application and it works
>> fine,infact even when i run the class as a java application it returns the
>> approve message from guvnor.
>> I find this strange
>> This is the error am getting,
>> 02:19:43.040 [WARN] Exception while dispatching incoming RPC
>> call
>>
>> com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public
abstract com.planet.requisition.client.rules.RequisitionTemp
com.planet.requisition.client.rules.RequisitionTempService.getRequisitionDet(java.lang.String,int)'
threw an unexpected exception: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
>>
>>
>>
>>
>>
>> at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
>> at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
>> at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
>>
>>
>>
>>
>>
>> at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
>> at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>>
>>
>>
>>
>>
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
>> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
>>
>>
>>
>>
>>
>> at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
>>
>>
>>
>>
>>
>> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>> at
org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
>>
>>
>>
>>
>>
>> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>> at org.mortbay.jetty.Server.handle(Server.java:324)
>> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>> at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
>>
>>
>>
>>
>>
>> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
>> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>> at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>>
>>
>>
>>
>>
>> at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
>> Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
>> at
org.drools.util.ServiceRegistryImpl.<clinit>(ServiceRegistryImpl.java:55)
>>
>>
>>
>>
>>
>> at
org.drools.builder.KnowledgeBuilderFactory.loadServiceFactory(KnowledgeBuilderFactory.java:130)
>> at
org.drools.builder.KnowledgeBuilderFactory.getKnowledgeBuilderServiceFactory(KnowledgeBuilderFactory.java:124)
>>
>>
>>
>>
>>
>> at
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:46)
>> at com.requisition.RequisitionApproval.main(RequisitionApproval.java:35)
>> at com.requisition.TestInputStream.main(TestInputStream.java:22)
>>
>>
>>
>>
>>
>> at
com.planet.requisition.server.RequisitionTempServiceImpl.getRequisitionDet(RequisitionTempServiceImpl.java:37)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>
>>
>>
>>
>>
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
>> at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
>>
>>
>>
>>
>>
>> at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
>> at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>>
>>
>>
>>
>>
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
>> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
>>
>>
>>
>>
>>
>> at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
>>
>>
>>
>>
>>
>> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>> at
org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
>>
>>
>>
>>
>>
>> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>> at org.mortbay.jetty.Server.handle(Server.java:324)
>> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>> at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
>>
>>
>>
>>
>>
>> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
>> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>> at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>>
>>
>>
>>
>>
>> at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
>> Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
>> at java.net.URLClassLoader$1.run(Unknown Source)
>> at java.security.AccessController.doPrivileged(Native Method)
>>
>>
>>
>>
>>
>> at java.net.URLClassLoader.findClass(Unknown Source)
>> at
com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:372)
>> at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)
>>
>>
>>
>>
>>
>> at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
>> at
org.drools.util.ServiceRegistryImpl.<clinit>(ServiceRegistryImpl.java:55)
>> at
org.drools.builder.KnowledgeBuilderFactory.loadServiceFactory(KnowledgeBuilderFactory.java:130)
>>
>>
>>
>>
>>
>> at
org.drools.builder.KnowledgeBuilderFactory.getKnowledgeBuilderServiceFactory(KnowledgeBuilderFactory.java:124)
>> at
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:46)
>>
>>
>>
>>
>>
>> at com.requisition.RequisitionApproval.main(RequisitionApproval.java:35)
>> at com.requisition.TestInputStream.main(TestInputStream.java:22)
>> at
com.planet.requisition.server.RequisitionTempServiceImpl.getRequisitionDet(RequisitionTempServiceImpl.java:37)
>>
>>
>>
>>
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>>
>>
>>
>>
>>
>> at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
>> at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
>> at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
>>
>>
>>
>>
>>
>> at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>
>>
>>
>>
>>
>> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
>> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
>> at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>>
>>
>>
>>
>>
>> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
>> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>>
>>
>>
>>
>>
>> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>> at
org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
>> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>
>>
>>
>>
>>
>> at org.mortbay.jetty.Server.handle(Server.java:324)
>> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>> at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
>>
>>
>>
>>
>>
>> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
>> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>> at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>>
>>
>>
>>
>>
>> at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
>>
>>
>>
>> On Wed, Sep 11, 2013 at 11:11 AM, Mauricio Salatino
<salaboy(a)gmail.com>wrote:
>>
>>> Hi, we are using GWT and Drools in all our tooling.. For example if you
>>> take a look at the kie-wb workbench or the jbpm-console-ng they are create
>>> Knowledge Session (kie sessions) right now.
>>>
>>>
>>> On Wed, Sep 11, 2013 at 9:07 AM, Moses Kalema
<mkgremo20(a)gmail.com>wrote:
>>>
>>>> Hello everyone,
>>>> I recently started using Drools Guvnor and i find it necessary. I
>>>> create rules on Guvnor and fire the rules in a Java application and
>>>> everything is fine.
>>>> However when i try to access the rules in a GWT application,i get an
>>>> error which looks like none of the Drools code is executed.
>>>> My request is if any one has used rules n a GWT application please
>>>> help me out
>>>>
>>>> --
>>>> Moses Kalema
>>>> Bachelor Science in Computer Engineering
>>>> Software/Mobile/Embedded Systems Developer
>>>> +256773391723
>>>> +256704209937
>>>> Skype: mkgremo
>>>> Twitter: @mkgremo
>>>> "Life's Success is based on Opportunity not Chance"
>>>>
>>>>
>>>> _______________________________________________
>>>> rules-dev mailing list
>>>> rules-dev(a)lists.jboss.org
>>>>
https://lists.jboss.org/mailman/listinfo/rules-dev
>>>>
>>>
>>>
>>>
>>> --
>>> - MyJourney @
http://salaboy.com <
http://salaboy.wordpress.com>
>>> - Co-Founder @
http://www.jugargentina.org
>>> - Co-Founder @
http://www.jbug.com.ar
>>>
>>> - Salatino "Salaboy" Mauricio -
>>>
>>> _______________________________________________
>>> rules-dev mailing list
>>> rules-dev(a)lists.jboss.org
>>>
https://lists.jboss.org/mailman/listinfo/rules-dev
>>>
>>
>>
>>
>> --
>> Moses Kalema
>> Bachelor Science in Computer Engineering
>> Software/Mobile/Embedded Systems Developer
>> +256773391723
>> +256704209937
>> Skype: mkgremo
>> Twitter: @mkgremo
>> "Life's Success is based on Opportunity not Chance"
>>
>>
>> _______________________________________________
>> rules-dev mailing list
>> rules-dev(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/rules-dev
>>
>
>
>
> --
> - MyJourney @
http://salaboy.com <
http://salaboy.wordpress.com>
> - Co-Founder @
http://www.jugargentina.org
> - Co-Founder @
http://www.jbug.com.ar
>
> - Salatino "Salaboy" Mauricio -
>
> _______________________________________________
> rules-dev mailing list
> rules-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-dev
>
--
Moses Kalema
Bachelor Science in Computer Engineering
Software/Mobile/Embedded Systems Developer
+256773391723
+256704209937
Skype: mkgremo
Twitter: @mkgremo
"Life's Success is based on Opportunity not Chance"
_______________________________________________
rules-dev mailing list
rules-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev