<span style='font-family:Verdana'><span style='font-size:12px'>Hi, another comment<br /> 
<br /> 
When I try to access my own package using&nbsp;<br /> 
<br /> 
http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/mypackage/LATEST<br /> 
<br /> 
I am getting&nbsp;<br /> 
<pre> 

</pre> 
<div> 
        <pre> 
java.lang.NullPointerException</pre> 
</div> 
<div> 
        java.io.OutputStream.write(Unknown Source)</div> 
<div> 
        org.drools.guvnor.server.files.FileManagerUtils.loadBinaryPackage(FileManagerUtils.java:189)</div> 
<div> 
        
But when I try using</div> 
http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/mypackage/LATEST.drl 

I can download the drl file 

TIA 
<p style="margin:0px; padding:0px;" > 
        Ā </p> 
<blockquote style="border-left: 1px solid #CCC; padding-left: 5px; margin-left: 5px; margin-bottom: 0px; margin-top: 0px; margin-right: 0px;" type="cite"> 
        <p style="margin:0px; padding:0px;" > 
                <span style="font-family:Verdana"><span style="font-size:12px">----- Original Message -----</span></span></p> 
        <p style="margin:0px; padding:0px;" > 
                <span style="font-family:Verdana"><span style="font-size:12px">From: Andre Fonseca</span></span></p> 
        <p style="margin:0px; padding:0px;" > 
                <span style="font-family:Verdana"><span style="font-size:12px">Sent: 01/08/12 06:34 PM</span></span></p> 
        <p style="margin:0px; padding:0px;" > 
                <span style="font-family:Verdana"><span style="font-size:12px">To: Rules Users List</span></span></p> 
        <p style="margin:0px; padding:0px;" > 
                <span style="font-family:Verdana"><span style="font-size:12px">Subject: Re: [rules-users] FactType returns null when creating a java client on Eclipse invoking a rule in Guvnor</span></span></p> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">Hi Kachan, thanks for your reply! 

 I took a look in your post and tried to adapt my code, this is below: 

 # Strategy 1 
 KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("myagent"); 
 kagent.applyChangeSet(ResourceFactory.newUrlResource("http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST")); 
 KnowledgeBase kbase = kagent.getKnowledgeBase(); 
 FactType appType = kbase.getFactType("mortgages", "LoanApplication"); 

 I copied the URL&nbsp;"http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST" and past it on the browser, it downloads the file mortgages.pkg, so its correct right? 

 But executing this code I got "(null: 1, 1): Content is not allowed in prolog." 

 So I changed the line 2 to use 

 #Strategy 2 
 kagent.applyChangeSet(ResourceFactory.newClassPathResource("src/main/resources/mortgage-changeset.xml")); 

 The mortgage-charset.xml is below</span></span> 
                <div> 
                        <span style="font-family:Verdana"><span style="font-size:12px">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</span></span></div> 
                <div> 
                        <span style="font-family:Verdana"><span style="font-size:12px">&lt;change-set xmlns="http://drools.org/drools-5.0/change-set"</span></span></div> 
                <div> 
                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp; xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"</span></span></div> 
                <div> 
                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp; 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"&gt;</span></span></div> 
                <div> 
                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp; &lt;add&gt;</span></span></div> 
                <div> 
                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp; &nbsp; &lt;resource source="http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST"</span></span></div> 
                <div> 
                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp; &nbsp; &nbsp; &nbsp; type="PKG" basicAuthentication="enabled" username="admin" password="admin" /&gt;</span></span></div> 
                <div> 
                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp; &lt;/add&gt;</span></span></div> 
                <div> 
                        <span style="font-family:Verdana"><span style="font-size:12px">&lt;/change-set&gt;</span></span></div> 
                <span style="font-family:Verdana"><span style="font-size:12px">With this change I dont have error, but the variable&nbsp;appType returns null again. 

 The point here is, I am using Guvnor with guest user (no authentication) this could be the problem? 
 The URL from Strategy1 is corrected, I tested it. The file in Stragety2 is corrected to, I debug it and see the file inputstream. 

 TIA</span></span> 
                <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></p> 
                <blockquote style="border-left: 1px solid #CCC; padding-left: 5px; margin-left: 5px; margin-bottom: 0px; margin-top: 0px; margin-right: 0px;" type="cite"> 
                        <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                                <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px">----- Original Message -----</span></span></span></span></p> 
                        <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                                <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px">From: kachaps4u</span></span></span></span></p> 
                        <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                                <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px">Sent: 01/08/12 05:54 PM</span></span></span></span></p> 
                        <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                                <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px">To: rules-users@lists.jboss.org</span></span></span></span></p> 
                        <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                                <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px">Subject: Re: [rules-users] FactType returns null when creating a java client on Eclipse invoking a rule in Guvnor</span></span></span></span></p> 
                        <div> 
                                <div> 
                                        <pre style="white-space: pre-wrap; word-wrap: break-word; font-size:11;white-space: pre-wrap; word-wrap: break-word; font-size:11;pre"> 
<span style="font-family:Verdana"><span style="font-size:12px"> 
http://drools.46999.n3.nabble.com/urlResource-applyChangeset-and-authentication-error-td3629051.html 

Hey, 
Please read the above and see whether it can help you. I had the same 
problem returning null. Then I stopped it and now doing in ESB to access the 
resources using its rules processor. But sometimes the above discussion can 
help you and if you have anything positive please let me know too. I was 
trying my own example in fact and not the mortgage. I think this would help 
both of us. Thank you. 



Kachan 

-- 
View this message in context: http://drools.46999.n3.nabble.com/rules-users-FactType-returns-null-when-creating-a-java-client-on-Eclipse-invoking-a-rule-in-Guvnor-tp3642559p3642609.html 
Sent from the Drools: User forum mailing list archive at Nabble.com. 
_______________________________________________ 
rules-users mailing list 
rules-users@lists.jboss.org 
https://lists.jboss.org/mailman/listinfo/rules-users</span></span></pre> 
                                </div> 
                        </div> 
                </blockquote> 
                <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></p> 
        </div> 
</blockquote> 
<p style="margin:0px; padding:0px;" > 
        Ā </p> 
</span></span>