[jBPM] - Re: In memory TaskClient without Mina or JMS
by Franklin Antony
Franklin Antony [http://community.jboss.org/people/frankee787] created the discussion
"Re: In memory TaskClient without Mina or JMS"
To view the discussion, visit: http://community.jboss.org/message/617173#617173
--------------------------------------------------------------
First of all, thanks a lot for all the help especially Daniele Ulrich for the patched files. After 10-12 hours night out slogging, following are my findings.
Only the patched files(jbpm-human-task-jpa-5.0.0-patched.jar) work with JTA and the default (jbpm-human-task-5.0.0.jar) doesnt work saying *java.lang.IllegalStateException: A JTA EntityManager cannot use getTransaction()*
*
*
Hence I would humbly as the authors of jBPM5 to reconsider the option of making the TaskServiceSession support JTA transactions as well.
I have been able to support the following usecase with the *Bitronix JTA implementation.*
*
*
The main serivce class is MainService
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class MainService implements IMainService {
IBusinessProcessService jbpmService;
IBusinessProcessService ourService;
public IBusinessProcessService getJbpmService() {
return jbpmService;
}
public void setJbpmService(IBusinessProcessService jbpmService) {
this.jbpmService = jbpmService;
}
public IBusinessProcessService getOurService() {
return ourService;
}
public void setOurService(IBusinessProcessService ourService) {
this.ourService = ourService;
}
public static void main(String[] args)
{
ClassPathXmlApplicationContext cp = new ClassPathXmlApplicationContext(new String[]{"jBPM-layer.xml","dao-layer.xml"});
IMainService mainService = (IMainService)cp.getBean("mainService");
mainService.doThis();
}
public void doThis()
{
getOurService().createTask(null);
getJbpmService().createTask(null);
getOurService().createTask(null);
getJbpmService().createTask(null);
if(1==1)
{
throw new RuntimeException();
}
}
}
As can be seen the MainService is something like a façade which calls two other service. One creates a record in the application database(getOurService()) and the other (getJbpmService()) creates a task/user inside the jBPM database. I have been trying to transactionalize this for quite sometime but in vain. However now its possible , but again only with the patched files.
This is ourService TXNJBPMServiceImp. Although the class name says JBPM, it has nothing to do with jBPM . Just a copy paste of a class …was so tired to give even a proper name. So, basically this is our application service which inserts a dummy testUser record in our application database.
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import org.apache.log4j.Logger;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TXNJBPMServiceImp implements IBusinessProcessService{
private static Logger log = Logger.getLogger(TXNJBPMServiceImp.class);
private EntityManagerFactory entityManagerFactory;
public EntityManagerFactory getEntityManagerFactory() {
return entityManagerFactory;
}
public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
this.entityManagerFactory = entityManagerFactory;
}
public static void main(String[] args)
{
}
@Override
public BPMTaskResponse createTask(Task task) {
System.out.println("Creating...Task!!");
EntityManager em = getEntityManagerFactory().createEntityManager();
TestUser testUser = new TestUser();
testUser.setName("TXNJBPMServiceImp");
//em.getTransaction().begin();
em.persist(testUser);
//em.getTransaction().commit();
System.out.println("Creating...Task DONE!!");
return null;
}
}
Next comes the actual jBPM service which now just creates a user in the jBPM database. As can be seen, it does nothing great. It just hacks into jBPM and gets a taskSession and creates a user. You can use the same taskSession and create Tasks, claim them, complete them etc.
import java.util.List;
import javax.persistence.EntityManagerFactory;
import org.apache.log4j.Logger;
import org.drools.SystemEventListenerFactory;
import org.jbpm.task.service.TaskService;
import org.jbpm.task.service.TaskServiceSession;
public class FinalTXNJBPMServiceImp implements IBusinessProcessService{
private static Logger log = Logger.getLogger(FinalTXNJBPMServiceImp.class);
public TaskServiceSession getTaskSession()
{
return getTaskService().createSession();
}
public TaskService getTaskService() {
return new TaskService(getEntityManagerFactory(), SystemEventListenerFactory.getSystemEventListener());
}
private EntityManagerFactory entityManagerFactory;
public EntityManagerFactory getEntityManagerFactory() {
return entityManagerFactory;
}
public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
this.entityManagerFactory = entityManagerFactory;
}
public static void main(String[] args)
{
}
@Override
public BPMTaskResponse createTask(Task task) {
TaskService taskService = new TaskService(getEntityManagerFactory(), SystemEventListenerFactory.getSystemEventListener());
TaskServiceSession taskSession = taskService.createSession();
org.jbpm.task.User aUser = new org.jbpm.task.User();
aUser.setId("DELNOW2");
taskSession.addUser(aUser);
System.out.println("Creating...Task DONE!!");
return null;
}
}
Almost there. Now the spring configuration file.
<?xml version=+"1.0"+ encoding=+"UTF-8"+?>
<beans xmlns=+"http://www.springframework.org/schema/beans"+
xmlns:xsi=+"http://www.w3.org/2001/XMLSchema-instance"+
xmlns:context=+"http://www.springframework.org/schema/context"+
xsi:schemaLocation=+"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd+
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/context/spring-context.xsd"+>
<context:property-placeholder location=+"classpath:jdbc.properties"+/>
<bean id=+"mainServiceRef"+ class=+"ae.emaratech.em.bpm.jbpm.MainService"+ >
<property name=+"jbpmService"+ ref=+"finalbusinessProcessServiceRef"+></property>
<property name=+"ourService"+ ref=+"businessProcessServiceRef"+></property>
</bean>
<bean id=+"mainService"+ class=+"org.springframework.transaction.interceptor.TransactionProxyFactoryBean"+>
<property name=+"transactionManager"+ ref=+"JtaTransactionManager"+ />
<property name=+"transactionAttributes"+>
<props>
<prop key=+"*"+>PROPAGATION_REQUIRED, -Exception</prop>
</props>
</property>
<property name=+"target"+ ref=+"mainServiceRef"+ />
</bean>
<context:annotation-config/>
<bean id=+"JtaTransactionManager"+ class=+"org.springframework.transaction.jta.JtaTransactionManager"+ >
<property name=+"transactionManager"+ ref=+"BitronixTransactionManager"+ />
<property name=+"userTransaction"+ ref=+"BitronixTransactionManager"+ />
</bean>
<bean id=+"btmConfig"+ factory-method=+"getConfiguration"+ class=+"bitronix.tm.TransactionManagerServices"+>
<property name=+"serverId"+ value=+"spring-btm"+ />
</bean>
<!-- create BTM transaction manager -->
<bean id=+"BitronixTransactionManager"+ factory-method=+"getTransactionManager"+ class=+"bitronix.tm.TransactionManagerServices"+ depends-on=+"btmConfig"+ destroy-method=+"shutdown"+ />
<bean id=+"finalbusinessProcessService"+ class=+"org.springframework.transaction.interceptor.TransactionProxyFactoryBean"+>
<property name=+"transactionManager"+ ref=+"JtaTransactionManager"+ />
<property name=+"transactionAttributes"+>
<props>
<prop key=+"*"+>PROPAGATION_REQUIRED, -Exception</prop>
</props>
</property>
<property name=+"target"+ ref=+"finalbusinessProcessServiceRef"+ />
</bean>
<bean id=+"finalbusinessProcessServiceRef"+ class=+"ae.emaratech.em.bpm.jbpm.FinalTXNJBPMServiceImp"+ >
<property name=+"entityManagerFactory"+ ref=+"entityManagerFactory"+/>
</bean>
<bean id=+"businessProcessService"+ class=+"org.springframework.transaction.interceptor.TransactionProxyFactoryBean"+>
<property name=+"transactionManager"+ ref=+"JtaTransactionManager"+ />
<property name=+"transactionAttributes"+>
<props>
<prop key=+"*"+>PROPAGATION_REQUIRED, -Exception</prop>
</props>
</property>
<property name=+"target"+ ref=+"businessProcessServiceRef"+ />
</bean>
<bean id=+"businessProcessServiceRef"+ class=+"ae.emaratech.em.bpm.jbpm.TXNJBPMServiceImp"+ >
<property name=+"entityManagerFactory"+ ref=+"ourEntityManagerFactory"+/>
</bean>
<bean id=+"userInfoImp"+ class=+"ae.emaratech.em.bpm.jbpm.DBUserInfoImp"+>
<property name=+"userDAO"+ ref=+"userDAO"+ />
</bean>
<bean id=+"entityManagerFactory"+ class=+"org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"+ depends-on=+"btmConfig"+>
<property name=+"persistenceUnitName"+ value=+"org.jbpm.task"+></property>
<property name=+"dataSource"+ ref=+"jBPMDataSource"+/>
<property name=+"persistenceXmlLocation"+ value=+"classpath:META-INF/persistence.xml"+ />
<property name=+"jpaVendorAdapter"+>
<bean class=+"org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"+>
<property name=+"database"+ value=+"MYSQL"+ />
<property name=+"showSql"+ value=+"true"+ />
<property name=+"databasePlatform"+ value=+"org.hibernate.dialect.MySQL5InnoDBDialect"+/>
</bean>
</property>
</bean>
<bean id=+"ourEntityManagerFactory"+ class=+"org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"+ depends-on=+"btmConfig"+>
<property name=+"persistenceUnitName"+ value=+"ourUnit"+></property>
<property name=+"dataSource"+ ref=+"ourDataSource"+/>
<property name=+"persistenceXmlLocation"+ value=+"classpath:META-INF/persistence.xml"+ />
<property name=+"jpaVendorAdapter"+>
<bean class=+"org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"+>
<property name=+"database"+ value=+"MYSQL"+ />
<property name=+"showSql"+ value=+"true"+ />
<property name=+"databasePlatform"+ value=+"org.hibernate.dialect.MySQL5InnoDBDialect"+/>
<property name=+"generateDdl"+ value=+"true"+/>
</bean>
</property>
</bean>
<!-- Bitronix Transaction Manager embedded configuration -->
<bean id=+"jBPMDataSource"+ class=+"bitronix.tm.resource.jdbc.PoolingDataSource"+
init-method=+"init"+ destroy-method=+"close"+>
<property name=+"uniqueName"+ value=+"java/jbpmdb"+ />
<property name=+"maxPoolSize"+ value=+"5"+ />
<property name=+"minPoolSize"+ value=+"0"+ />
<property name=+"driverProperties"+>
<props>
<prop key=+"user"+>${jdbc.jbpm.username}</prop>
<prop key=+"password"+>${jdbc.jbpm.password}</prop>
<prop key=+"url"+>${jdbc.jbpm.url}</prop>
</props>
</property>
<property name=+"className"+ value=+"com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"+ />
<property name=+"allowLocalTransactions"+ value=+"false"+ />
<property name=+"enableJdbc4ConnectionTest"+ value=+"true"+/>
</bean>
<!-- Bitronix Transaction Manager embedded configuration -->
<bean id=+"ourDataSource"+ class=+"bitronix.tm.resource.jdbc.PoolingDataSource"+ init-method=+"init"+ destroy-method=+"close"+>
<property name=+"uniqueName"+ value=+"java/emdb"+ />
<property name=+"minPoolSize"+ value=+"0"+ />
<property name=+"maxPoolSize"+ value=+"5"+ />
<property name=+"driverProperties"+>
<props>
<prop key=+"user"+>${jdbc.emdb.username}</prop>
<prop key=+"password"+>${jdbc.emdb.password}</prop>
<prop key=+"url"+>${jdbc.emdb.url}</prop>
</props>
</property>
<property name=+"className"+ value=+"com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"+ />
<property name=+"allowLocalTransactions"+ value=+"false"+ />
<property name=+"enableJdbc4ConnectionTest"+ value=+"true"+/>
</bean>
</beans>
And finally the persistence.xml file.
<?xml version=+"1.0"+ encoding=+"UTF-8"+ standalone=+"yes"+?>
<persistence version=+"1.0"+
xsi:schemaLocation=+" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd+
+http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"+
xmlns:orm=+" http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm"+
xmlns:xsi=+" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"+
xmlns=+" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence"+>
<persistence-unit name=+"org.jbpm.task"+ transaction-type=+"JTA"+>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<mapping-file>META-INF/orm.xml</mapping-file>
<class>org.jbpm.task.Attachment</class>
<class>org.jbpm.task.Content</class>
<class>org.jbpm.task.BooleanExpression</class>
<class>org.jbpm.task.Comment</class>
<class>org.jbpm.task.Deadline</class>
<class>org.jbpm.task.Comment</class>
<class>org.jbpm.task.Deadline</class>
<class>org.jbpm.task.Delegation</class>
<class>org.jbpm.task.Escalation</class>
<class>org.jbpm.task.Group</class>
<class>org.jbpm.task.I18NText</class>
<class>org.jbpm.task.Notification</class>
<class>org.jbpm.task.EmailNotification</class>
<class>org.jbpm.task.EmailNotificationHeader</class>
<class>org.jbpm.task.PeopleAssignments</class>
<class>org.jbpm.task.Reassignment</class>
<class>org.jbpm.task.Status</class>
<class>org.jbpm.task.Task</class>
<class>org.jbpm.task.TaskData</class>
<class>org.jbpm.task.SubTasksStrategy</class>
<class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
<class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
<class>org.jbpm.task.User</class>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name=+"hibernate.connection.autocommit"+ value=+"false"+ />
<property name=+"hibernate.hbm2ddl.auto"+ value=+"validate"+ />
<property name=+"hibernate.max_fetch_depth"+ value=+"3"+/>
<property name=+"hibernate.show_sql"+ value=+""+ />
<property name=+"hibernate.transaction.manager_lookup_class"+ value=+"org.hibernate.transaction.BTMTransactionManagerLookup"+/>
</properties>
</persistence-unit>
<persistence-unit name=+"ourUnit"+ transaction-type=+"JTA"+>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>ae.emaratech.em.bpm.jbpm.TestUser</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name=+"hibernate.connection.autocommit"+ value=+"false"+ />
<property name=+"hibernate.hbm2ddl.auto"+ value=+"validate"+ />
<property name=+"hibernate.max_fetch_depth"+ value=+"3"+/>
<property name=+"hibernate.show_sql"+ value=+""+ />
<property name=+"hibernate.transaction.manager_lookup_class"+ value=+"org.hibernate.transaction.BTMTransactionManagerLookup"+/>
</properties>
</persistence-unit>
</persistence>
Few notes. After changing to the patched jBPM files, the orm.xml throws error while trying to be passed. You will have to change references to “Task” in queries to “org.jbpm.task.Task”. Likewise all other objects such as I18NText, OrganizationalEntity etc.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/617173#617173]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 8 months
[Beginner's Corner] - Access to EJB ( JBoss AS 7 )
by chris81t
chris81t [http://community.jboss.org/people/chris81t] created the discussion
"Access to EJB ( JBoss AS 7 )"
To view the discussion, visit: http://community.jboss.org/message/617139#617139
--------------------------------------------------------------
Hi @all,
I hope you can help me. I'm actually new to JBoss AS.
For the first test I have written a simple HelloJBoss application:
*- HelloJBossAS7* (eclipse ear project contains the two following projects)
*- HelloJBossEJB*
contains:
ISimpleEJB.java
package de.example.ejb;
import javax.ejb.Local;
@Local
public interface ISimpleEJB {
int add(int a, int b) throws Exception;
}
SimpleEJB.java
package de.example.ejb;
import javax.ejb.Stateless;
@Stateless
public class SimpleEJB implements ISimpleEJB {
@Override
public int add(int a, int b) throws Exception {
return a + b;
}
}
*- HelloJBossJSF (2.0)*
contains
Content.java
package de.example.beans;
import java.io.Serializable;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import de.example.ejb.ISimpleEJB;
@ManagedBean
@SessionScoped
public class Content implements Serializable {
private static final long serialVersionUID = 5526381952953438091L;
private String title = "Hello JBoss AS 7 :-)";
@EJB(beanName = "SimpleEJB")
private ISimpleEJB ejb;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getVal() {
try {
return ejb.add(2, 4);
}
catch (Exception e) {
return -1;
}
}
}
content.xhtml
<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view contentType="text/html"/>
<h:head>
<title>Hello JBoss AS 7</title>
</h:head>
<h:body>
<h:outputText value="Title: #{content.title}"/>
<br/>
<br/>
<h:outputText value="Content: #{content.val}"/>
</h:body>
</html>
web.xml
jboss-web.xml
faces-config.xml
If I delete the ejb-member "ejb" in the Content class, I can deploy the EAR to the jboss and the jsf app work's fine. But if I use the "ejb" member, I will get the following deployment error:
> 23:54:13,542 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.subunit."HelloJBossAS7.ear"."HelloJBossJSF.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."HelloJBossAS7.ear"."HelloJBossJSF.war".INSTALL: Failed to process phase INSTALL of subdeployment "HelloJBossJSF.war" of deployment "HelloJBossAS7.ear"
> at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
> at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
> at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
> Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: No component found for type 'de.example.ejb.ISimpleEJB' with name SimpleEJB
> at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:68)
> at org.jboss.as.ee.component.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:187)
> at org.jboss.as.ee.component.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:154)
> at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:52)
> at org.jboss.as.ee.component.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:125)
> at org.jboss.as.ee.component.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:118)
> at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
> ... 5 more
>
>
> 23:54:13,748 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "HelloJBossAS7.ear" was rolled back with failure message {"Failed services" => {"jboss.deployment.subunit.\"HelloJBossAS7.ear\".\"HelloJBossJSF.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"HelloJBossAS7.ear\".\"HelloJBossJSF.war\".INSTALL: Failed to process phase INSTALL of subdeployment \"HelloJBossJSF.war\" of deployment \"HelloJBossAS7.ear\""},"Services with missing/unavailable dependencies" => ["jboss.naming.context.java.comp.HelloJBossAS7.HelloJBossJSF.HelloJBossJSF.ValidatorFactory missing [ jboss.naming.context.java.module.HelloJBossAS7.HelloJBossJSF ]","jboss.naming.context.java.comp.HelloJBossAS7.HelloJBossJSF.HelloJBossJSF.Validator missing [ jboss.naming.context.java.module.HelloJBossAS7.HelloJBossJSF ]"]}
> 23:54:13,755 INFO [org.jboss.as.server.deployment] (MSC service thread 1-12) Stopped deployment HelloJBossJSF.war in 7ms
> 23:54:13,757 INFO [org.jboss.as.server.deployment] (MSC service thread 1-15) Stopped deployment HelloJBossAS7.ear in 9ms
> 23:54:13,759 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"Failed services" => {"jboss.deployment.subunit.\"HelloJBossAS7.ear\".\"HelloJBossJSF.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"HelloJBossAS7.ear\".\"HelloJBossJSF.war\".INSTALL: Failed to process phase INSTALL of subdeployment \"HelloJBossJSF.war\" of deployment \"HelloJBossAS7.ear\""},"Services with missing/unavailable dependencies" => ["jboss.naming.context.java.comp.HelloJBossAS7.HelloJBossJSF.HelloJBossJSF.ValidatorFactory missing [ jboss.naming.context.java.module.HelloJBossAS7.HelloJBossJSF ]","jboss.naming.context.java.comp.HelloJBossAS7.HelloJBossJSF.HelloJBossJSF.Validator missing [ jboss.naming.context.java.module.HelloJBossAS7.HelloJBossJSF ]"]}}}
>
Is using the @EJB annotation the wrong way? Should I user instead a ServiceLocator?! I hope, someone can help me and tell me the correct way to use the SimpleEJB.
Who want's to see the whole project's, have a look the the attachment.
Thank you for support! :)
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/617139#617139]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 8 months
[JBoss Tools] - Can't start AS 7 from Eclipse 3.7
by William Hastings
William Hastings [http://community.jboss.org/people/wdhastings] created the discussion
"Can't start AS 7 from Eclipse 3.7"
To view the discussion, visit: http://community.jboss.org/message/617099#617099
--------------------------------------------------------------
I'm using the latest nightly for both AS7 and Tools 3.3. I followed the "getting started" instructions for setting up with eclipse to add a server with the AS7 Runtime profile and managed to add a server. When I try to start the server I get a "server failed to start" dialog and the following console output:
Invalid option '--configuration=default'
The option that it is complaining about is in the launch configuration > arguments tab. Here are the entries:
Program arguments:
--configuration=default
VM arguments:
-server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 "-Dorg.jboss.boot.log.file=C:/Servers/Jboss7/jboss-as-7.0.0.Final/standalone/log/boot.log" "-Dlogging.configuration=file:C:/Servers/Jboss7/jboss-as-7.0.0.Final/standalone/configuration/logging.properties" "-Djboss.home.dir=C:/Servers/Jboss7/jboss-as-7.0.0.Final"
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/617099#617099]
Start a new discussion in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 8 months
[EJB3] - How to configure EJB3 MDBs for IBM Websphere MQ
by yogananth Mahalingam
yogananth Mahalingam [http://community.jboss.org/people/yogamaha] modified the document:
"How to configure EJB3 MDBs for IBM Websphere MQ"
To view the document, visit: http://community.jboss.org/docs/DOC-12944
--------------------------------------------------------------
You do not need deployment descriptors for ejb3. The perferred method for configuring EJB3s would be with the annotations.
This is how you would define your ejb3 bean with all of the properties.
@MessageDriven( name="MyMDBName",
activationConfig =
{
@ActivationConfigProperty(propertyName="messagingType",propertyValue="javax.jms.MessageListener"),
@ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queueA"),
@ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true"),
@ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"),
@ActivationConfigProperty(propertyName = "hostName", propertyValue = "devmq1sun"),
@ActivationConfigProperty(propertyName = "queueManager", propertyValue = "DEVMQ1SUN"),
@ActivationConfigProperty(propertyName = "port", propertyValue = "1416"),
@ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT")
@ActivationConfigProperty(propertyName = "username", propertyValue = "foo")
@ActivationConfigProperty(propertyName = "password", propertyValue = "bar")
})
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
@ResourceAdapter(value = "wmq.jmsra2.rar")
You can get rid of your desployment descriptors as the annotations take their place.(ejb-jar.xml, jboss.xml). The above example uses your resource adapter and all of your activation configuration properties. I think I got them all in there. I did notice however that you are using the "wmq.jmsra2.rar" in your ejb descriptor, but your depends in the ds.xml file is using "wmq.jmsra.rar". You may want to fix that to get the dependencies correct.
*Equivalent XML settings*
If you wanted to deploy the same thing using xml files instead of annotations, your IBM adapter will be added to your jboss.xml file
<?xml version="1.0" encoding="UTF-8"?>
<jboss
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
version="3.0">
<enterprise-beans>
<message-driven>
<ejb-name>MyMDBName</ejb-name>
<resource-adapter-name>wmq.jmsra2.rar</resource-adapter-name>
</message-driven>
</enterprise-beans>
</jboss>
and your ejb-jar.xml file will look similar to this..
<?xml version="1.0"?>
<ejb-jar
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
<enterprise-beans>
<message-driven>
<ejb-name>MyMDBName</ejb-name>
<ejb-class>test.mdb.TestMDBBean</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>NotSupported</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>messagingType</activation-config-property-name>
<activation-config-property-value>javax.jms.MessageListener</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>queueA</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>useJNDI</activation-config-property-name>
<activation-config-property-value>true</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>channel</activation-config-property-name>
<activation-config-property-value>SYSTEM.DEF.SVRCONN</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>hostName</activation-config-property-name>
<activation-config-property-value>devmq1sun</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>queueManager</activation-config-property-name>
<activation-config-property-value>DEVMQ1SUN</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>port</activation-config-property-name>
<activation-config-property-value>1416</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>transportType</activation-config-property-name>
<activation-config-property-value>CLIENT</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>username</activation-config-property-name>
<activation-config-property-value>foo</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>password</activation-config-property-name>
<activation-config-property-value>bar</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
So this is how you would deploy one mdb with the queued defined as an Admin object in your ds.xml file. The useJNDI argument makes sure that the queue will be looked up in jndi. The IBM adapter takes an Admin Object as a queue and will make the appropriate arrangements to connect to it.
The next logical question would be how do I take the Activation Configuration Properties out of the mdb and
How do I take those settings and move them out to a global place where I can define them for all MDBs?
-------------------------------------------------------------------------------------------------------
JBoss EJB3's work similar to EJB2.x, but not quite. In EJB3, the file that governs the interceptors and global settings is *NOT* the standard-jboss.xml file anymore. EJB3 now uses the deploy/ejb3-interceptors-aop.xml file. The default configuration(now it's called a domain) for all MDBs is "<domain name="Message Driven Bean">".
Defining your own domains. You can define your own domains if you wish. So if you wanted to you could copy the "Message Driven Bean" domain and rename it to something like "IBMMQ Message Driven Bean". You could add a class annotation that looks like @AspectDomain("IBMMQ Message Driven Bean")
Defining Properties in the domain. Here is the domain we were talking about.
<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=30, timeout=10000)
</annotation>
</domain>
Please notice that the <annotation> tag actaully inserts a new PoolClass annotation into each MDB. This is so that you don't have to define the pool for each mdb. We are going to do the same with your other defaults. One more thing to note, the annotation expression, "<annotation expr="!class((a)org.jboss.annotation.ejb.PoolClass)">" will look to see if there is a class annotation called PoolClass. If the expression is true, then the contained PoolClass annotation is inserted. This is an important point, becuase when we put our defaults in, we can't use activationConfig, because it is already being used in the mdb. If we insert it and we already have one we will have problems. So we have to come up with another annoation to insert default activationconfig properties, called DefaultActivationSpecs. This is so that we can have some defaults along with the original activation specs that are in the mdb itself.
This would be the completed IBMMQ Message Driven Bean domain configuration.
<domain name="IBMMQ Message Driven Bean" extends="Message Driven Bean" inheritBindings="true">
<annotation expr="!class((a)org.jboss.ejb3.annotation.DefaultActivationSpecs)">
@org.jboss.ejb3.annotation.DefaultActivationSpecs ({(a)javax.ejb.ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"),
@javax.ejb.ActivationConfigProperty(propertyName = "hostName", propertyValue = "devmq1sun"),
@javax.ejb.ActivationConfigProperty(propertyName = "queueManager", propertyValue = "DEVMQ1SUN"),
@javax.ejb.ActivationConfigProperty(propertyName = "port", propertyValue = "1416"),
@javax.ejb.ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT")})
</annotation>
</domain>
+Note: All annotations must use the full class names. If you look in the EJB itself, you don't need to put the full classname because of the import. When you are injecting annotations into a class there is no import, so you must use the full classname in the ejb3-interceptors-aop.xml file.+
and your completed mdb annotations would look something like this using the new domain configuration..
@MessageDriven( name="MyMDBName",
activationConfig =
{
@ActivationConfigProperty(propertyName="messagingType",propertyValue="javax.jms.MessageListener"),
@ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queueA"),
@ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true"),
})
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
@ResourceAdapter(value = "wmq.jmsra2.rar")
@AspectDomain("IBMMQ Message Driven Bean")
References
[1] http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.... IBM outbound adapter properties
[2] http://www.ibm.com/developerworks/websphere/library/techarticles/0710_rit... IBM EJB 2.x instructions
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-12944]
Create a new document in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
14 years, 8 months
[JBoss Web Services] - Getting an exception while calling a webservice
by Srinivas Jonnalagadda
Srinivas Jonnalagadda [http://community.jboss.org/people/srinivasj74] created the discussion
"Getting an exception while calling a webservice"
To view the discussion, visit: http://community.jboss.org/message/617082#617082
--------------------------------------------------------------
Hi,
When i invole a webservice to an external provider i am getting the following exception. When i remove the JBOSS Runtime from my call path and use just JDK 1.6.24 the webservice invocation is succesful and i get the result. Weird thing is that one method of the webservice get this exception. Any help in solving the problem is hignhly appreciated.
Invoking faxQuery...
javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault code, not set
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)
at $Proxy36.faxQuery(Unknown Source)
at com.medassets.tac.service.InterFaxSender.queryFaxStatus(InterFaxSender.java:389)
at com.medassets.tac.service.InterFaxSender.main(InterFaxSender.java:440)
Caused by: java.lang.NullPointerException
at cc.interfax.FaxQuery_WrapperTypeHelper1.createWrapperObject(Unknown Source)
at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:105)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
... 3 more
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/617082#617082]
Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 8 months