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
"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
<?xml version="1.0" encoding="UTF-8"?>
<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/...
<add>
<resource
source="http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST"
type="PKG" basicAuthentication="enabled" username="admin"
password="admin" />
</add>
</change-set>
With this change I dont have error, but the variable 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
----- Original Message -----
From: kachaps4u
Sent: 01/08/12 05:54 PM
To: rules-users(a)lists.jboss.org
Subject: Re: [rules-users] FactType returns null when creating a java client on Eclipse
invoking a rule in Guvnor
http://drools.46999.n3.nabble.com/urlResource-applyChangeset-and-authenti...
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-...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________ rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users