[jBPM] - GraphSession.findLatestProcessDefinition() returns wrong value
by Michael Holtzman
Michael Holtzman [http://community.jboss.org/people/michaelholtzman] created the discussion
"GraphSession.findLatestProcessDefinition() returns wrong value"
To view the discussion, visit: http://community.jboss.org/message/568662#568662
--------------------------------------------------------------
Greetings. We are having a problem deploying process instances. It seems that findLatestProcessDefinition() is returning null, even when there are clearly entries in JBPM_PROCESSDEFINITION with the same name.
This is causing all sorts of problems:
- Deploying a process definition keeps inserting multiple entries into JBPM_PROCESSDEFINITION with version = 1
- Attempting to instantiate a definition fails (definition not found error) because no process definition object is returned for the name.
- Etc.
This happens sporadically across multiple schemas and platforms (Oracle and SqlServer). Typically some definitions will work OK and others will fail with this error.
We are running jBPM 3.1.2 with some local mods. Thanx for any advice.
Here is the underlying query:
public ProcessDefinition findLatestProcessDefinition(String name) {
ProcessDefinition processDefinition = null;
try {
Query query = session.getNamedQuery("GraphSession.findLatestProcessDefinitionQuery");
query.setString("name", name);
query.setMaxResults(1);
processDefinition = (ProcessDefinition) query.uniqueResult();
} catch (Exception e) {
e.printStackTrace(); log.error(e);
jbpmSession.handleException();
throw new JbpmException("couldn't find process definition '" + name + "'", e);
}
return processDefinition;
}
<query name="GraphSession.findLatestProcessDefinitionQuery">
<![CDATA[
select pd
from org.jbpm.graph.def.ProcessDefinition as pd
where pd.name = :name
order by pd.version desc
]]>
</query>
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/568662#568662]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 1 month
[EJB 3.0] - Adjust / reduce MDB bean pool
by Alexander Hartner
Alexander Hartner [http://community.jboss.org/people/ejb3workshop] created the discussion
"Adjust / reduce MDB bean pool"
To view the discussion, visit: http://community.jboss.org/message/568627#568627
--------------------------------------------------------------
I am trying to reduce the MDB bean pool to limit the concurrency of my application. I know I can do this via the ActivationSpecification as well as via the deployment descriptor. However I would like to do this outside the EAR file and be able to adjust it at the application server level. I have found the suggestion to edit maxSize=5 in ejb3-interceptors-aop.xml.
>
> <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))">
>
> <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
>
> </bind>
>
> <bind pointcut="execution(public * *->*(..))">
>
> <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
>
> <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
>
> <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
>
> <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
>
> <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/>
>
> </bind>
>
> <annotation expr="!class((a)org.jboss.annotation.ejb.PoolClass)">
>
> @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.StrictMaxPool.class, maxSize=5, timeout=10000)
>
> </annotation>
>
> </domain>
> <domain name="Message Driven Bean">
> <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))">
> <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
> </bind>
> <bind pointcut="execution(public * *->*(..))">
> <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
> <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
> <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
> <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
> <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/>
> </bind>
> <annotation expr="!class((a)org.jboss.annotation.ejb.PoolClass)">
> @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.StrictMaxPool.class, maxSize=5, timeout=10000)
> </annotation>
> </domain>
>
Yet this resulted the following exception:
> javax.ejb.EJBException: Failed to acquire the pool semaphore, strictTimeout=10000
> at org.jboss.ejb3.StrictMaxPool.get(StrictMaxPool.java:122)
> at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
> at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
> at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:249)
> at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:268)
> at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:138)
> at $Proxy158.onMessage(Unknown Source)
> at org.jboss.resource.adapter.jms.inflow.JmsServerSession.onMessage(JmsServerSession.java:178)
> at org.jboss.jms.client.container.ClientConsumer.callOnMessageStatic(ClientConsumer.java:160)
> at org.jboss.jms.client.container.SessionAspect.handleRun(SessionAspect.java:831)
> at org.jboss.aop.advice.org.jboss.jms.client.container.SessionAspect14.invoke(SessionAspect14.java)
> at org.jboss.jms.client.delegate.ClientSessionDelegate$run_N8003352271541955702.invokeNext(ClientSessionDelegate$run_N8003352271541955702.java)
> at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
> at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
> at org.jboss.jms.client.delegate.ClientSessionDelegate$run_N8003352271541955702.invokeNext(ClientSessionDelegate$run_N8003352271541955702.java)
> at org.jboss.jms.client.delegate.ClientSessionDelegate.run(ClientSessionDelegate.java)
> at org.jboss.jms.client.JBossSession.run(JBossSession.java:199)
> at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:237)
> at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
> at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
> at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:756)
> at java.lang.Thread.run(Thread.java:619)
Further reading brought me on to this link : http://community.jboss.org/docs/DOC-9334 http://community.jboss.org/wiki/ConfigJBossMDB as well as other forum posts which suggests adding *<strictTimeout>forever</strictTimeout>* to conf/standardjboss.xml as in:
> <container-configuration>
> <container-name>Standard Message Driven Bean</container-name>
> <call-logging>false</call-logging>
> <invoker-proxy-binding-name>message-driven-bean</invoker-proxy-binding-name>
> <container-interceptors>
> <interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
> <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
> <interceptor>org.jboss.ejb.plugins.RunAsSecurityInterceptor</interceptor>
> <!-- CMT -->
> <interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
> <interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
> <interceptor transaction="Container">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
> <!-- BMT -->
> <interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
> <interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT</interceptor>
> <interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
> <interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
> </container-interceptors>
> <instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
> <instance-cache></instance-cache>
> <persistence-manager></persistence-manager>
> <container-pool-conf>
> <MaximumSize>100</MaximumSize>
> <strictTimeout>forever</strictTimeout>
> </container-pool-conf>
> </container-configuration>
Any suggestion on how I to change the pool size used for MDBs using JBoss 4.2.3 correctly.
Kind regards
Alex
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/568627#568627]
Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 1 month
[Beginner's Corner] - FORM-based declarative authentication against MySQL realm
by RS Prasad
RS Prasad [http://community.jboss.org/people/rsprasad] modified the document:
"FORM-based declarative authentication against MySQL realm"
To view the document, visit: http://community.jboss.org/docs/DOC-16020
--------------------------------------------------------------
This article is about FORM-Based authentication for jboss for securing admin related pages.
The attached web application uses declarative authentication against mysql security realm.
Add following *security-constraint* section to *web.xml*:
<security-constraint>
<display-name>require valid user</display-name>
<web-resource-collection>
<web-resource-name>internal application</web-resource-name>
<!-- secure only admin pages-->
<url-pattern>/admin/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<!--Admin pages secured only for admin-->
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
Add following *login-config* section to *web.xml*:
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/loginInvalid.jsp</form-error-page>
</form-login-config>
</login-config>
Find and replace following realm config section in <JBOSS_HOME>\server\default\deploy\jbossweb.sar\*server.xml*:
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/jaasrealm"
connectionName="root"
connectionPassword=""
userTable="users"
userNameCol="user_name"
userCredCol="user_pass"
userRoleTable="user_roles"
roleNameCol="role_name" />
>From the above, realm requires DB Class name, DB Driver class, DB URL,
DB name, DB username, DB password and
userTable is users,
userNameCol is user_name,
userRoleTable is user_roles,
userCredCol is user_pass and
roleNameCol is role_name
Setting up security realm:
Have mysql running.
mysql> create database jaasrealm;
mysql> use jaasrealm;
mysql> create table users (
user_name varchar(15) not null primary key,
user_pass varchar(15) not null
);
mysql> create table user_roles (
user_name varchar(15) not null,
role_name varchar(15) not null,
primary key (user_name, role_name)
);
mysql> insert into users values('hari','good');
mysql> insert into users values('hara','better');
mysql> insert into user_roles values('hari','usergroup');
mysql> insert into user_roles values('hara','admin');
Ensure mysql driver in JBoss classpath, browser setting for cookies and modify JBossIPAddress in links in JSPs.
Deploy the application after extracting it to JBOSS_HOME/server/default/deploy/.
Reach the application at URL: http://%3cjbossipaddress%3e:8080/auth/index.jsp http://<JBossIPAddress>:8080/auth/index.jsp
The first two links are to user pages that require no authentication.
The last two links are to admin pages which require authentication.
Clicking on admin links will cause login.jsp to be displayed as configured by login-config section of web.xml.
The pages are authenticated by j_security_check with textboxes for j_username and j_password.
A j_security_check servlet reserved by JBoss for authentication handles the request and the security-constraints associated with it.
On successful authentication, the secured admin page will be displayed.
On unsuccessful authentication, loginInvalid.jsp as configured by login-config section of web.xml will be displayed.
Thanks
Saravana Prasad
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-16020]
Create a new document in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
14 years, 1 month