0 Replies Latest reply on Sep 20, 2012 7:07 AM by Alessandro Dionisi

    Missing authentication parameters in default change sets

    Alessandro Dionisi Newbie

      Hi all,

      I've created a simple package called 'plx' and the changeset URL is http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/plx/LATEST/ChangeSet.xml

       

      The ChangeSet.xml contains:

       

      <change-set xmlns='http://drools.org/drools-5.0/change-set'

          xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'

          xs:schemaLocation='http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd' >

          <add>

               <resource source='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/plx/LATEST' type='PKG' />

          </add>

      </change-set>

       

      When I try to access the change set with the KnowledgeAgent (via spring configuration) I receive a 401 error (unauthorized):

       

      java.lang.RuntimeException: KnowledgeAgent exception while trying to deserialize KnowledgeDefinitionsPackage 

                at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:787)

                at org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:1094)

                at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:835)

                at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:675)

                at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:206)

                at org.drools.container.spring.beans.KnowledgeAgentBeanFactory.afterPropertiesSet(KnowledgeAgentBeanFactory.java:91)

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

                at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)

                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)

                at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)

                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)

                at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:591)

                at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)

                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)

                at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)

                at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)

                at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)

                at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4205)

                at org.apache.catalina.core.StandardContext.start(StandardContext.java:4704)

                at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

                at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)

                at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

                at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)

                at org.apache.catalina.core.StandardService.start(StandardService.java:525)

                at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)

                at org.apache.catalina.startup.Catalina.start(Catalina.java:595)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)

                at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

      Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/plx/LATEST

                at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)

                at org.drools.io.impl.UrlResource.grabStream(UrlResource.java:210)

                at org.drools.io.impl.UrlResource.getInputStream(UrlResource.java:146)

                at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:750)

                ... 34 more

       

      This is the spring configuration:

       

      <drools:kagent kbase="kbase" id="kagent">


      <drools:resources>



      <drools:resource type="CHANGE_SET" basic-authentication="enabled" password="admin" username="admin" source="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/plx/LATEST/ChangeSet.xml"/>




      </drools:resources>


      </drools:kagent>

       

      The problem seem related to the ChangeSet.xml that doesn't contain authentication attributes. Is this normal?