[JBoss jBPM] - Missing (config) files starters kit?
by Johan.Parent
Hi all,
Our sys. admin. pointed out to me that the Websale demo code repeatedly looks for files which are not present. This of course create additional work at the fs level. The JVM is constantly calling stat() for the missing files. So the sys. admin. is not very happy with this...
You can see this below (where ENOENT means that the entry/file do not exist):
| stat64("/tmp/jBPMtest/conf/process.examples/META-INF/services/org.apache.xerces.xni.parser.XMLParserConfiguration",
| 0xFFBFB828) Err#2 ENOENT
| /1:
| stat64("/tmp/jBPMtest/conf/config.files/META-INF/services/org.apache.xerces.xni.parser.XMLParserConfiguration",
| 0xFFBFB828) Err#2 ENOENT
| /1:
| stat64("/tmp/jBPMtest/conf/resources/META-INF/services/org.apache.xerces.xni.parser.XMLParserConfiguration",
| 0xFFBFB828) Err#2 ENOENT
| /1: stat64("/usr/j2se/jre/lib/jaxp.properties", 0xFFBFD318) Err#2 ENOENT
| /1: stat64("/tmp/jBPMtest/classes/META-INF/services/javax.xml.parsers.SAXParserFactory",
| 0xFFBFCB00) Err#2 ENOENT
| /1:
| stat64("/tmp/jBPMtest/conf/process.examples/META-INF/services/javax.xml.parsers.SAXParserFactory",
| 0xFFBFCB00) Err#2 ENOENT
| /1:
| stat64("/tmp/jBPMtest/conf/config.files/META-INF/services/javax.xml.parsers.SAXParserFactory",
| 0xFFBFCB00) Err#2 ENOENT
| /1: stat64("/tmp/jBPMtest/conf/resources/META-INF/services/javax.xml.parsers.SAXParserFactory",
| 0xFFBFCB00) Err#2 ENOENT
| /1: stat64("/usr/j2se/jre/lib/xerces.properties", 0xFFBFCA58) Err#2 ENOENT
| /1:
| stat64("/tmp/jBPMtest/classes/META-INF/services/org.apache.xerces.xni.parser.XMLParserConfiguration",
| 0xFFBFC170) Err#2 ENOENT
| ...
|
I've copied some of the dirs from the starters kit in order to centralize the files a bit. But except for the new location the files and dir. structure correspond to that of the starters kit. Is my classpath wrong or are these files (or maybe just one) missing?
Best regards,
Johan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4018906#4018906
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4018906
19Â years, 2Â months
[Security & JAAS/JBoss] - Re: Latest JAAS Tutorial for Database communication
by smeaggie
don't know about jGuard, but this is JAAS with database login (a real quicky tho, feel free to ask more).
1) setup the connection to the database. put a "database-ds.xml" file in the deploy directory wich contains something like:
| <datasources>
| <local-tx-datasource>
| <jndi-name>exampleDS</jndi-name>
| <connection-url>jdbc:postgresql://127.0.0.1:5432/example</connection-url>
| <driver-class>org.postgresql.Driver</driver-class>
| <user-name>ex</user-name>
| <password>_______</password>
| <min-pool-size>5</min-pool-size>
| <max-pool-size>20</max-pool-size>
| <metadata>
| <type-mapping>PostgreSQL 7.2</type-mapping>
| </metadata>
| </local-tx-datasource>
| </datasources>
|
make sure you enter the correct driver, connection string etc. Now open login-config.xml in the server's conf/ directory. you need to define a security domain here. add this to the file:
| <application-policy name = "exampleDomain">
| <authentication>
| <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required">
| <module-option name = "unauthenticatedIdentity">guest</module-option>
| <module-option name = "dsJndiName">java:/exampleDS</module-option>
| <module-option name = "principalsQuery">SELECT PASSWD FROM USERS WHERE USERID=?</module-option>
| <module-option name = "rolesQuery">SELECT ROLEID, 'Roles' FROM ROLES WHERE USERID=?</module-option>
| </login-module>
| </authentication>
| </application-policy>
|
note the definition "exampleDomain" and how the dsJndiName is set to java:/exampleDS. exampleDS comes from the database connection definition above! the two queries in this file mean the following: the principalsQuery should return the password of the user where userid is the name the user entered in the login form. The rolesQuery must return all roles associated with the username. So it's time to create two tables in your database, with at least this info:
| table USERS
| +-------------------------------------+
| | userid | passwd |
| +-------------------------------------+
| | test | secret |
| +-------------------------------------+
|
| table ROLES
| +-------------------------------------+
| | userid | roleid |
| +-------------------------------------+
| | test | admin |
| | test | manager |
| +-------------------------------------+
|
(don't mind the ascii art)
we've created a user "test" with the password "secret" and the roles "admin" and "manager".
time to secure the web application, open up jboss-web.xml (from the WEB-INF directory) and put this in it:
| <?xml version="1.0" encoding="UTF-8"?>
| <jboss-web>
| <security-domain>java:/jaas/exampleDomain</security-domain>
| <context-root>/example</context-root>
| </jboss-web>
|
this sets the security domain for the web application to "exampleDomain" wich is declared in the login-config.xml above! jboss now knows wich login module configuration applies to this application.
now edit web.xml (also in the WEB-INF directory) and add this:
| <security-constraint>
| <display-name>manager</display-name>
| <web-resource-collection>
| <web-resource-name>manager_pages</web-resource-name>
| <description/>
| <url-pattern>/manager/*</url-pattern>
| <http-method>GET</http-method>
| <http-method>POST</http-method>
| <http-method>HEAD</http-method>
| <http-method>PUT</http-method>
| <http-method>OPTIONS</http-method>
| <http-method>TRACE</http-method>
| <http-method>DELETE</http-method>
| </web-resource-collection>
| <auth-constraint>
| <description/>
| <role-name>manager</role-name>
| </auth-constraint>
| <user-data-constraint>
| <description/>
| <transport-guarantee>NONE</transport-guarantee>
| </user-data-constraint>
| </security-constraint>
|
| <security-constraint>
| <display-name>admin</display-name>
| <web-resource-collection>
| <web-resource-name>admin_pages</web-resource-name>
| <description/>
| <url-pattern>/admin/*</url-pattern>
| <http-method>GET</http-method>
| <http-method>POST</http-method>
| <http-method>HEAD</http-method>
| <http-method>PUT</http-method>
| <http-method>OPTIONS</http-method>
| <http-method>TRACE</http-method>
| <http-method>DELETE</http-method>
| </web-resource-collection>
| <auth-constraint>
| <description/>
| <role-name>admin</role-name>
| </auth-constraint>
| <user-data-constraint>
| <description/>
| <transport-guarantee>NONE</transport-guarantee>
| </user-data-constraint>
| </security-constraint>
|
| <login-config>
| <auth-method>FORM</auth-method>
| <realm-name>example</realm-name>
| <form-login-config>
| <form-login-page>/login.html</form-login-page>
| <form-error-page>/login_error.html</form-error-page>
| </form-login-config>
| </login-config>
|
| <security-role>
| <description/>
| <role-name>admin</role-name>
| </security-role>
| <security-role>
| <description/>
| <role-name>manager</role-name>
| </security-role>
|
this defines two security constraints: one for everything behind /manager (where only users with the "manager" role are allowed) and one for admins, everything behind /admin.
the login pages (login.html and login-error.html) should look like this:
| <html>
| <body>
| <form action="j_security_check" method="post">
| <input type="text" name="j_username"><br>
| <input type="password" name="j_password"><br>
| <input type="submit" value="login">
| </form>
| </body>
| </html>
|
hope this helps!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4018900#4018900
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4018900
19Â years, 2Â months
[JBoss Seam] - outject problem
by laxu
I already (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=101517) had asked this in this forum and I could not solve the problem yet. Here I have downsized my dummy app to even simpler and it still cannot outject. I must be missing or misunderstanding something fundamental.
I have the entity bean Organization:
@Entity
| @Name("organization")
| public class Organization implements Serializable {
|
| @TableGenerator(name="organizationGenerator")
| @Id
| @GeneratedValue(strategy=GenerationType.TABLE,generator="organizationGenerator")
| private Long id;
|
| private String name;
| private String description,address;
| private boolean deleted=false;
|
| @Temporal(TemporalType.DATE)
| private Date startUpDate;
| public Organization() {
| name="unnamed";
| }
|
| public Long getId() {
| return this.id;
| }
|
| public void setId(Long id) {
| this.id = id;
| }
|
| @Override
| public int hashCode() {
| int hash = 0;
| hash += (this.id != null ? this.id.hashCode() : 0);
| return hash;
| }
|
| @Override
| public boolean equals(Object object) {
| // TODO: Warning - this method won't work in the case the id fields are not set
| if (!(object instanceof Organization)) {
| return false;
| }
| Organization other = (Organization)object;
| if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false;
| return true;
| }
|
| @Override
| public String toString() {
| return "[id=" + id + ":"+ name +"]";
| }
|
| ... standart getters and setters follow ...
|
A stateful session bean
| @Stateful
| @Name("testAction")
| public class TestActionBean implements TestActionLocal {
|
| @Out
| Organization organization;
|
| public TestActionBean() {}
|
| @Begin
| public String go(){
| organization=new Organization();
| organization.setName("Tester");
| return "org";
| }
|
| @End
| public String stop(){
| return "test";
| }
|
| @Remove @Destroy
| void destroy(){}
| }
one initial page, only for calling the action bean:
test.xhtml
| <?xml version='1.0' encoding='UTF-8' ?>
| <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| template="listTemplate.xhtml">
|
| <ui:define name="content">
| <h:form>
| <h:commandButton value="Go" action="#{testAction.go}" />
| </h:form>
| </ui:define>
|
| </ui:composition>
|
and another one that is navigated when "org" is returned:
org.xhtml
| <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| template="listTemplate.xhtml" >
|
| <ui:define name="content">
| <h:form>
| <h:outputLabel value="Name:" /> <h:inputText value="#{organization.name}"/>
| </h:form>
| </ui:define>
|
|
| </ui:composition>
I construct a new "Organization" at the method "go" and set its "name" property to "tester". I expect it to show up in the "org.xhtml", but instead "unnamed" shows up, which is assigned in the default constructor of "Organization". The instance I assigned at the "go" method is ignored and another instance is outjected.
Where am I wrong?
Regards,
Levent
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4018895#4018895
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4018895
19Â years, 2Â months