1 Reply Latest reply on May 14, 2014 4:01 AM by Mauricio Salatino

    Using Kie in Google App Engine

    Anousack Virakone Newbie

      Hi,

       

      Is there anyway to get Kie 6.0  to run with Google AppEngine?  I know there's a solution with Red Piranha, https://code.google.com/p/red-piranha/wiki/ModifyDroolsRunInGoogleAppEngine, out there that works with Drools 5.5.0, but I kinda do want to use the new PHREAK algorithm that 6.0 uses and I'm not sure that the solution from red piranha will work with 6.0.  Anyways here's my stack trace when I try to run the following code in App Engine devserver.

       

      Thanks,

      Eric

       

      public class Account

      {

        private int balance;

       

       

        public Account()

        {

        super();

        }

       

       

        public Account(int balance)

        {

        super();

        this.balance = balance;

        }

       

       

        /**

        * @return the balance

        */

        public int getBalance()

        {

        return balance;

        }

       

       

        /**

        * @param balance

        *            the balance to set

        */

        public void setBalance(int balance)

        {

        this.balance = balance;

        }

       

       

        public void withdraw(int money)

        {

        balance -= money;

        }

      }

      public class SampleBusinessObject extends BaseBusinessObject

      {

        public void testDrools()

        {

        KieServices kieServices = KieServices.Factory.get();

        KieContainer kContainer = kieServices.getKieClasspathContainer();

        KieSession kSession = kContainer.newKieSession();

       

        Account account = new Account(200);

        FactHandle accountFact = kSession.insert(account);

        kSession.fireAllRules();

       

        account.withdraw(250);

        kSession.update(accountFact, account);

        kSession.fireAllRules();

        }

      }

       

      [INFO] May 13, 2014 9:24:24 PM com.google.apphosting.utils.jetty.JettyLogger warn

      [INFO] WARNING: /rest/mock/testDrools

      [INFO] java.lang.NoClassDefFoundError: sun.reflect.ReflectionFactory is a restricted class. Please see the Google  App Engine developer's guide for more details.

      [INFO] at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)

      [INFO] at com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.<init>(Sun14ReflectionProvider.java:61)

      [INFO] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

      [INFO] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

      [INFO] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

      [INFO] at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

      [INFO] at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance_(Runtime.java:127)

      [INFO] at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:148)

      [INFO] at com.thoughtworks.xstream.core.JVM.bestReflectionProvider(JVM.java:241)

      [INFO] at com.thoughtworks.xstream.XStream.<init>(XStream.java:438)

      [INFO] at com.thoughtworks.xstream.XStream.<init>(XStream.java:381)

      [INFO] at com.thoughtworks.xstream.XStream.<init>(XStream.java:356)

      [INFO] at org.drools.compiler.kproject.models.KieModuleModelImpl$kModuleMarshaller.<init>(KieModuleModelImpl.java:133)

      [INFO] at org.drools.compiler.kproject.models.KieModuleModelImpl$kModuleMarshaller.<init>(KieModuleModelImpl.java:132)

      [INFO] at org.drools.compiler.kproject.models.KieModuleModelImpl.<clinit>(KieModuleModelImpl.java:130)

      [INFO] at java.lang.Class.forName0(Native Method)

      [INFO] at java.lang.Class.forName(Class.java:190)

      [INFO] at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70)

      [INFO] at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:64)

      [INFO] at org.drools.compiler.kie.builder.impl.ClasspathKieProject.discoverKieModules(ClasspathKieProject.java:72)

      [INFO] at org.drools.compiler.kie.builder.impl.ClasspathKieProject.init(ClasspathKieProject.java:63)

      [INFO] at org.drools.compiler.kie.builder.impl.KieContainerImpl.<init>(KieContainerImpl.java:77)

      [INFO] at org.drools.compiler.kie.builder.impl.KieServicesImpl.getKieClasspathContainer(KieServicesImpl.java:64)

      [INFO] at com.paradoxai.yummy.businessobjects.SampleBusinessObject.testDrools(SampleBusinessObject.java:20)

      [INFO] at com.paradoxai.yummy.service.MockDataService.testDrools(MockDataService.java:31)

      [INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      [INFO] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      [INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      [INFO] at java.lang.reflect.Method.invoke(Method.java:606)

      [INFO] at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115)

      [INFO] at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)

      [INFO] at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)

      [INFO] at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)

      [INFO] at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)

      [INFO] at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

      [INFO] at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)

      [INFO] at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

      [INFO] at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)

      [INFO] at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)

      [INFO] at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)

      [INFO] at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)

      [INFO] at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)

      [INFO] at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)

      [INFO] at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)

      [INFO] at org.codehaus.enunciate.modules.jersey.EnunciateJerseyServletContainer.service(EnunciateJerseyServletContainer.java:250)

      [INFO] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

      [INFO] at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)

      [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)

      [INFO] at org.codehaus.enunciate.webapp.HTTPRequestContextFilter.doFilter(HTTPRequestContextFilter.java:36)

      [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

      [INFO] at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)

      [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

      [INFO] at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:127)

      [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

      [INFO] at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)

      [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

      [INFO] at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)

      [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

      [INFO] at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)

      [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

      [INFO] at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)

      [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

      [INFO] at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)

      [INFO] at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)

      [INFO] at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)

      [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

      [INFO] at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)

      [INFO] at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)

      [INFO] at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)

      [INFO] at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)

      [INFO] at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)

      [INFO] at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:98)

      [INFO] at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

      [INFO] at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:487)

      [INFO] at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

      [INFO] at org.mortbay.jetty.Server.handle(Server.java:326)

      [INFO] at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)

      [INFO] at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)

      [INFO] at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)

      [INFO] at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)

      [INFO] at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)

      [INFO] at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)

      [INFO] at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)