Unable to do Guvnor Authentiation with MySQL
by Sumeet Karawal
Hi All,
I am trying to enable authentication in Guvnor using MySQL. I am using
MySQL 5.1, Guvnor 5.2 and JBoss AS 5.0.4
I searched over a lot of docs and tried to do as mentioned below :
I have created a GuvnorDB in MySQL with two tables
create table Principals(principal_id VARCHAR(64),password VARCHAR
(64));
create table roles(principal_id VARCHAR(64),user_role VARCHAR
(64),role_group VARCHAR(64));
and have entered some values accordingly (admin, admin123) and (admin,
admin, admin);
My components.xml in drools-guvnor.war is as follows :
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://jboss.com/products/seam/components"
xmlns:core="http://jboss.com/products/seam/core"
xmlns:security="http://jboss.com/products/seam/security"
xmlns:web="http://jboss.com/products/seam/web"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:transaction="http://jboss.com/products/seam/transaction"
xsi:schemaLocation="http://jboss.com/products/seam/core
http://jboss.com/products/seam/core-2.0.xsd
http://jboss.com/products/seam/security
http://jboss.com/products/seam/security-2.0.xsd
http://jboss.com/products/seam/components
http://jboss.com/products/seam/components-2.0.xsd
http://jboss.com/products/seam/web
http://jboss.com/products/seam/web-2.0.xsd
http://jboss.com/products/seam/transaction
http://jboss.com/products/seam/transaction-2.0.xsd">
<core:init transaction-management-enabled="false" />
<transaction:no-transaction />
<component name="repositoryConfiguration">
<!-- JackRabbit -->
<property name="properties">
<key>org.drools.repository.configurator</key><value>org.drools.repository.jackrabbit.JackrabbitRepositoryConfigurator</value>
</property>
</component>
<!-- SECURITY IDENTITY CONFIGURATION -->
<security:identity authenticate-method="#{authenticator.authenticate}"
jaas-config-name="mysql"/>
<!-- SECURITY AUTHORIZATION CONFIGURATION -->
<component name="org.jboss.seam.security.roleBasedPermissionResolver">
<property name="enableRoleBasedAuthorization">true</property>
</component>
</components>
I have also changed my login-config.xml accordingly and added a
application policy :
<application-policy name="mysql">
<authentication>
<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
flag="required">
<module-option name="dsJndiName">java:/MySqlDS</module-option>
<module-option name="principalsQuery">select password from principals
where principal_id=?</module-option>
<module-option name="principalsQuery">select user_role,'Roles' from roles
where principal_id=?</module-option>
</login-module>
</authentication>
</application-policy>
I have also created a mysql-ds.xml and saved it in the default/deploy
folder; its contents :
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>MySqlDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/GuvnorDB</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password></password>
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>getting an exceptiogetting
</datasources>
After all these changes, when I run guvnor and try to login, I am
getting an exception thrown at the console:
01:36:41,212 INFO [STDOUT] INFO 10-01 01:36:41,211
(SecurityServiceImpl.java:login:57) Logging in user [admin]
01:36:41,360 INFO [STDOUT] ERROR 10-01 01:36:41,357
(SecurityServiceImpl.java:login:77) Unable to login.
javax.security.auth.login.FailedLoginException: Password Incorrect/Password
Required
at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login
(UsernamePasswordLoginModule.java:213)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at javax.security.auth.login.LoginContext.invoke
(LoginContext.java:784)
at javax.security.auth.login.LoginContext.access$000
(LoginContext.java:203)
at javax.security.auth.login.LoginContext$4.run
(LoginContext.java:698)
at javax.security.auth.login.LoginContext$4.run
(LoginContext.java:696)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.invokePriv
(LoginContext.java:695)
at javax.security.auth.login.LoginContext.login
(LoginContext.java:594)
at org.jboss.seam.security.Identity.authenticate(Identity.java:335)
at org.jboss.seam.security.Identity.authenticate(Identity.java:324)
at org.drools.guvnor.server.security.SecurityServiceImpl.login
(SecurityServiceImpl.java:75)
at org.drools.guvnor.server.SecurityServiceServlet.login
(SecurityServiceServlet.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:57)......
.................
I tried a lot but not getting through on how to do this.
It would really helpful if somebody could guide me on this.
Thanks & Regards,
Sumeet
Mailto: sumeet.karawal(a)tcs.com
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
14 years, 3 months
xls decisiontable -> unable to resolve method using strict-mode
by ollem
Hello!
I'm using a knowledgeagent to point out a changeset XML which contains the
following DTABLE:
...
<resource source='file:/../templatetest.xls' type='DTABLE' />
...
when I compile I get the following error:
Unable to Analyse Expression request == "/":
[Error: unable to resolve method using strict-mode:
ultra.Default.ultra.MYHTTPD.request()]
[Near : {... request == "/" ....}]
^
[Line: 7, Column: 10] : [Rule name='print the incoming query_9']
The weird this is that MYHTTPD class is a javabean and contains getRequest
and setRequest methods.
notice that it tries a no getter method
ultra.Default.ultra.MYHTTPD.request().
If I do the same logic from a normal DRL rules file it works fine.
MYHTTPD is generated so I cannot past the source here, but it's correct and
as I mentioned working in DRL files.
this is how the XSL file looks like:
RuleSet A rules test
Import ultra.Default.ultra.MYHTTPD
RuleTable print the incoming query
CONDITION ACTION
MYHTTPD
request System.out.println($param);
Matcher Logger
/ "webserver root"
Anybody who knows what this is about?
Thanks // Olle
--
View this message in context: http://drools.46999.n3.nabble.com/xls-decisiontable-unable-to-resolve-met...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 3 months
Re: [rules-users] FactType returns null when creating a java client on Eclipse invoking a rule in Guvnor
by Andre Fonseca
Hi, another comment
When I try to access my own package using
http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/mypa...
I am getting
java.lang.NullPointerException
java.io.OutputStream.write(Unknown Source)
org.drools.guvnor.server.files.FileManagerUtils.loadBinaryPackage(FileManagerUtils.java:189)
But when I try using http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/mypa... I can download the drl file TIA
----- Original Message -----
From: Andre Fonseca
Sent: 01/08/12 06:34 PM
To: Rules Users List
Subject: Re: [rules-users] FactType returns null when creating a java client on Eclipse invoking a rule in Guvnor
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/mort...")); KnowledgeBase kbase = kagent.getKnowledgeBase(); FactType appType = kbase.getFactType("mortgages", "LoanApplication"); I copied the URL "http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/mort..." 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/mort..."
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
14 years, 3 months
Re: [rules-users] FactType returns null when creating a java client on Eclipse invoking a rule in Guvnor
by Andre Fonseca
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/mort..."));
KnowledgeBase kbase = kagent.getKnowledgeBase();
FactType appType = kbase.getFactType("mortgages", "LoanApplication");
I copied the URL "http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/mort..." 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/mort..."
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
14 years, 3 months
FactType returns null when creating a java client on Eclipse invoking a rule in Guvnor
by Andre Fonseca
Hi all,
I have imported the mortgage-sample-repository.xml to my guvnor instance. Its okey.
Then I tried to run the MortgageClientExample java class.
Everything is okey, but when I try to create the FactType
"FactType appType = kbase.getFactType("mortgages", "LoanApplication");"
I have null as the result for the appType variable.
The KnowledgeBase is okey also.
I used the same configurations of the example that comes with guvnor download.
I am in Windows with Tomcat 7.
I appreciate any help.
TIA
14 years, 3 months
答复: Concurrent rule fire
by Zhuo Li
Any comments?
发件人: Zhuo Li [mailto:milanello1998@gmail.com]
发送时间: 2012年1月8日 0:35
收件人: 'Rules Users List'
主题: Concurrent rule fire
Hi, folks,
My project will handle about 1.5 M transactions per hour using Drools and
the rules’ fire are scheduled based on business operation cycle which might
happen a few times a day. Say if I need to fire the same rule set twice at
10:00 PM and midnight. What will happen if the first execution has not
completed till midnight? Will the 2nd execution be held up till the 1st is
completed? I would assume there might still be transactions inserted into
working memory between 10:00 PM and midnight although it is very few.
My understanding is Drools will enforce only one active thread is working
for the same “then” section for data consistency. Any thoughts?
Best
Abe
14 years, 3 months
Rules, database and flow in JBRMS
by kachaps4u
I have this one scenario where the rules need to look on to a database and
see whether it matches the zipcode, state and whether that region is
eligible to do some actions. Now my BRMS is having its default repository. I
was using rule templates to show the demo with 3 states.
In the real scenario, I would need to have a larger database checking all
the requirements. My Project is having a xml database outside for user data
persistence and will be using oracle 11 g for business rules and
process(JBRMS, JBPM).
-Now where shuld I need to create the database for checking these rules?
-I assume that would be Oracle. But then where would i write the queries to
do it?
-If not should I call a java method searching in the xml database?
In my scenario, rule has to change the value of the variable and this
variable should will be input of the next rule. I was doing with uploaded
POJO JARs and the variable wasn't getting updated when each rule was fired
(i used salience to put priority) when given the URI for the resource in the
ESB. So I build the package with built in selector and created snapshots to
provide different URIs when this situation comes. It was working then.
- How can I put the rule flow in to it so that i dont want do this?
I was trying to upload .rf file but was unsuccessful. I read about the id
and rule flow group. But my upload rule flow is blank inside BRMS.
- what should i do to connect my rules to this flow?
Please help me.. thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Rules-database-and-flow-in-JBRMS-tp3642...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 3 months