[JBoss Messaging] - Can I externalize user, password and destination?
by Gunnar Bostrom
Gunnar Bostrom [http://community.jboss.org/people/gunnarbos] created the discussion
"Can I externalize user,password and destination?"
To view the discussion, visit: http://community.jboss.org/message/559087#559087
--------------------------------------------------------------
Hi,
I'm using 1.4.3.GA Messaging to listen to a JMS queue.
It works fine but I need to externalize user, password and destination from my application.
I use declarative style like this
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destination", propertyValue = "DEST"),
@ActivationConfigProperty(propertyName = "user", propertyValue = "USER"),
@ActivationConfigProperty(propertyName = "password", propertyValue = "PWD"),
.....
}
public class MDB implements MessageListener {
How can we put the values in an external file so we don't need to make code changes for different environments?
Regard
Gunnar
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/559087#559087]
Start a new discussion in JBoss Messaging at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 1 month
[EJB 3.0] - Problem with @OneToMany annotation
by dsf qsdf
dsf qsdf [http://community.jboss.org/people/ezza3im] created the discussion
"Problem with @OneToMany annotation"
To view the discussion, visit: http://community.jboss.org/message/559054#559054
--------------------------------------------------------------
Hello
I have a problem with EJB project which contains the @OneToMany annotation.
The EJB Entities are "User" and "Privilege". A "Privilege" has many "User".
Here is the source of my EJB Entities:
[CODE]
package entities;
import java.io.Serializable;
import java.sql.Date;
import java.util.Collection;
import javax.persistence.*;
@Entity
public class User implements Serializable {
@Id
@Column(name = "UserID")
private int UserID;
private String password;
private String login;
private String Name;
private String gender;
private String Phone;
private String Email;
private String Address;
private int isActive;
private Date lastLoginTime;
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name = "Privilege_idPrivilege")
private Privilege privilege;
public User() {
super();
// TODO Auto-generated constructor stub
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getPhone() {
return Phone;
}
public void setPhone(String phone) {
Phone = phone;
}
public String getEmail() {
return Email;
}
public void setEmail(String email) {
Email = email;
}
public String getAddress() {
return Address;
}
public void setAddress(String address) {
Address = address;
}
public int getIsActive() {
return isActive;
}
public void setIsActive(int isActive) {
this.isActive = isActive;
}
public void setLogin(String login) {
this.login = login;
}
public String getLogin() {
return login;
}
public int getUserID() {
return UserID;
}
public void setUserID(int userID) {
UserID = userID;
}
public void setLastLoginTime(Date lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
public Date getLastLoginTime() {
return lastLoginTime;
}
public Privilege getPrivilege() {
return privilege;
}
public void setPrivilege(Privilege privilege) {
this.privilege = privilege;
}
}
[/CODE]
et
[CODE]
package entities;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.*;
@Entity
public class Privilege implements Serializable{
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int idPrivilege ;
private int Level ;
@OneToMany
private Collection<User> users = new ArrayList<User>();
public int getIdPrivilege() {
return idPrivilege;
}
public void setIdPrivilege(int idPrivilege) {
this.idPrivilege = idPrivilege;
}
public int getLevel() {
return Level;
}
public void setLevel(int level) {
Level = level;
}
public Collection<User> getUsers() {
return users;
}
public void setUsers(Collection<User> users) {
this.users = users;
}
}
[/CODE]
In the test application I get the following error message (given that the test app: GestionDeStockClient and "search_user" is a method of the EJB Session that returns User):
[CODE]Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at $Proxy0.search_user(Unknown Source)
at com.et.GestionDeStockClient.main(GestionDeStockClient.java:30)
[COLOR="Red"]Caused by: java.lang.ClassNotFoundException: [/COLOR][Ljava.lang.StackTraceElement;
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:50)
at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:139)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readArray(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128)
at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:279)
at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
at org.jboss.remoting.Client.invoke(Client.java:525)
at org.jboss.remoting.Client.invoke(Client.java:488)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
... 2 more
[/CODE]
thanks
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/559054#559054]
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
Re: [jboss-user] [jBPM] - adding a custom service to jbpm.cfg.xml
by kelum_sv N
kelum_sv N [http://community.jboss.org/people/kelum] replied to the discussion
"adding a custom service to jbpm.cfg.xml"
To view the discussion, visit: http://community.jboss.org/message/559052#559052
--------------------------------------------------------------
HI
*Using jbpm 4.4. WITH jboss-5.1.0.GA*
1 :I am also having this kind of issue at the moment . What i have done was extended IdentitySessionImpl and created my own MyIdentitySession .and i have over right few methods createUser,createGroup what was already there in IdentitySessionImpl.
public class MyIdentitySession extends IdentitySessionImpl
{
/*
* This method will create or update a user
*
* */
public String createUser(String userName, String givenName, String familyName, String businessEmail)
{
User user = null;
try
{
user = findUserById(userName);
}
catch (Exception ex)
{
}
if (user == null)
{
user = new UserImpl(userName, givenName, familyName);
long dbid = EnvironmentImpl.getFromCurrent(DbidGenerator.class).getNextId();
((UserImpl) user).setDbid(dbid);
}
UserImpl userimpl = (UserImpl) user;
userimpl.setBusinessEmail(businessEmail);
userimpl.setFamilyName(familyName);
userimpl.setGivenName(givenName);
userimpl.setId(userName);
session.save(user);
return user.getId();
}
/*
* This method will create or modify Group
*
* */
public String createGroup(String groupName, String groupType, String parentGroupId)
{
GroupImpl group = null;
try
{
group = findGroupById(groupName);
}
catch (Exception ex)
{
}
if (group == null)
{
group = new GroupImpl();
String groupId = groupType != null ? groupType + "." + groupName : groupName;
group.setId(groupId);
long dbid = EnvironmentImpl.getFromCurrent(DbidGenerator.class).getNextId();
group.setDbid(dbid);
}
group.setName(groupName);
group.setType(groupType);
if (parentGroupId != null)
{
GroupImpl parentGroup = findGroupById(parentGroupId);
group.setParent(parentGroup);
}
session.save(group);
return group.getId();
}
public void setSession(Session session)
{
super.setSession(session);
Configuration.getProcessEngine().get()
}
}
2: Then i created new MyIdentitySessionBinding by extending WireDescriptorBinding
public class MyIdentitySessionBinding extends WireDescriptorBinding
{
public MyIdentitySessionBinding()
{
super("identity-session");
}
public Object parse(Element element, Parse parse, Parser parser)
{
ObjectDescriptor objectDescriptor = new ObjectDescriptor(MyIdentitySession.class);
objectDescriptor.addTypedInjection("session", Session.class);
return objectDescriptor;
}
}
3: Then this MyIdentitySessionBinding was registered using jbpm.user.wire.bindings.xml
<wire-bindings>
<!-- sessions -->
<binding class ="dd.ss.ss.MyIdentitySessionBinding" />
</wire-bindings>
4: Added this file inside that jbpm-service.sar which inside JBoss deploy directory .
5 : Customised jbpm.cfg.xml as bellow
<jbpm-configuration jndi-name="java:/ProcessEngine">
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.tx.jta.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.jobexecutor.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />
<transaction-context>
<object class ="aa.bb.cc.MyIdentitySession" />
</transaction-context>
</jbpm-configuration>
Whwn i try to use createUser,createGroup methods inside MyIdentitySession, it gives me NullPointer exception when accessing session[Hybranate ].
Hope there should be a configuration issue. Please assist me on this regards
Thank you
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/559052#559052]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 1 month
Re: [jboss-user] [jBPM] - adding a custom service to jbpm.cfg.xml
by kelum_sv N
kelum_sv N [http://community.jboss.org/people/kelum] replied to the discussion
"adding a custom service to jbpm.cfg.xml"
To view the discussion, visit: http://community.jboss.org/message/559050#559050
--------------------------------------------------------------
HI
*Using jbpm 4.4. WITH jboss-5.1.0.GA*
1 :I am also having this kind of issue at the moment . What i have done was extended IdentitySessionImpl and created my own MyIdentitySession .and i have over right few methods createUser,createGroup what was already there in IdentitySessionImpl.
public String createUser(String userName, String givenName, String familyName, String businessEmail)
{
User user = null;
try
{
user = findUserById(userName);
}
catch (Exception ex)
{
}
if (user == null)
{
user = new UserImpl(userName, givenName, familyName);
long dbid = EnvironmentImpl.getFromCurrent(DbidGenerator.class).getNextId();
((UserImpl) user).setDbid(dbid);
}
UserImpl userimpl = (UserImpl) user;
userimpl.setBusinessEmail(businessEmail);
userimpl.setFamilyName(familyName);
userimpl.setGivenName(givenName);
userimpl.setId(userName);
session.save(user);
return user.getId();
}
2: Then i created new MyIdentitySessionBinding by extending WireDescriptorBinding
public class MyIdentitySessionBinding extends WireDescriptorBinding
{
public IWirkfloIdentitySessionBinding()
{
super("identity-session");
}
public Object parse(Element element, Parse parse, Parser parser)
{
ObjectDescriptor objectDescriptor = new ObjectDescriptor(MyIdentitySession.class);
objectDescriptor.addTypedInjection("session", Session.class);
return objectDescriptor;
}
}
3: Then this MyIdentitySessionBinding was registered using jbpm.user.wire.bindings.xml
<wire-bindings>
<!-- sessions -->
<binding class ="dd.ss.ss.MyIdentitySessionBinding" />
</wire-bindings>
4: Added this file inside that jbpm-service.sar which inside JBoss deploy directory .
5 : Customised jbpm.cfg.xml as bellow
<jbpm-configuration jndi-name="java:/ProcessEngine">
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.tx.jta.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.jobexecutor.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />
<transaction-context>
<object class ="aa.bb.cc.MyIdentitySession" />
</transaction-context>
</jbpm-configuration>
Whwn i try to use createUser,createGroup methods inside MyIdentitySession, it gives me NullPointer exception when accessing session[Hybranate ].
Hope there should be a configuration issue. Please assist me on this regards
Thank you
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/559050#559050]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 1 month
Re: [jboss-user] [jBPM] - jBpm 4.3 service task has no optional args?
by Tim S
Tim S [http://community.jboss.org/people/tstephen] replied to the discussion
"jBpm 4.3 service task has no optional args?"
To view the discussion, visit: http://community.jboss.org/message/559043#559043
--------------------------------------------------------------
Thanks for the reply. I did upgrade to 4.4 and after a little head-scratching I realised I was encountering JBPM-2830. Your patch restored my application built on 4.3 to the point that I can start and list process instances so I'm hoping it is agreed to restore the previous behaviour.
I tried again to call a Java Service Task with an arg that is not populated at the time the service task is invoked:
<itemDefinition id="registerUserItemDef" >
<jbpm:arg>
<jbpm:object expr="#{user}" />
</jbpm:arg>
<jbpm:arg>
<jbpm:object expr="#{groups}" />
</jbpm:arg>
</itemDefinition>
...
<operation id="registerUser" name="registerUser">
and this time I get a different error:
org.jbpm.pvm.internal.wire.WireException: couldn't invoke method registerUser: couldn't create argument 1: Cannot resolve identifier 'groups'
at org.jbpm.bpmn.flownodes.JavaServiceTaskActivity.perform(JavaServiceTaskActivity.java:92)
Once again, creating a variable named groups allows the service task to be invoked successfully.
Tim
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/559043#559043]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 1 month
[JBoss Web Services] - javaTypeAdapter for Strings
by Zoli Szugyi
Zoli Szugyi [http://community.jboss.org/people/zszugyi] created the discussion
"javaTypeAdapter for Strings"
To view the discussion, visit: http://community.jboss.org/message/559042#559042
--------------------------------------------------------------
I'm trying to specify an XmlAdapter for all the String fields in our API to remove all the invalid xml characters
from the SOAP response before sending it to a client.
I've added the following to binding.xsd under globalBindings:
<javaType
name="java.lang.String" xmlType="xs:string"
parseMethod="our.package.StringAdapter.parseString"
printMethod="our.package.StringAdapter.printString"/>
When generating the client classes, the adapter class is generated and the string fields on the generated classes
get the annotation:
@XmlJavaTypeAdapter(Adapter2 .class)
protected String name;
The parseString and printString methods don't ever seem to be called though.
Is it possible to even override how strings are converted?
We're using JBoss 4.2.3
Thanks!
ps.: I've also tried specifying the XmlJavaTypeAdapter in the package-info, but that didn't have any effect. A post on these forums suggest that
JBoss 4.2.3 doesn't support this.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/559042#559042]
Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 1 month
[jBPM] - Case for using jBPM's PVM "naked"?
by Ansgar Konermann
Ansgar Konermann [http://community.jboss.org/people/akonermann] created the discussion
"Case for using jBPM's PVM "naked"?"
To view the discussion, visit: http://community.jboss.org/message/559031#559031
--------------------------------------------------------------
Hi all,
at work, our development team has created a very simple home-brew statemachine implementation to do a mixture of workflow management and simple business process management, all in plain java. This was a few years ago and met the requirements back then.
As the business process got more complicated, we are now looking into existing solutions supporting more concepts than our simplistic state machine does.
I skimmed the PVM documentation and found java classes resembling activities, nodes, transitions and the like. This looks promising, yet I'm not sure about the intended usage of PVM.
Is PVM intended to be used by developers to create process descriptions by coding in java, without using any of the XMLish or graphical "concrete syntaxes" of process modelling? If "intended to be used" is too much, would this at least be a sane, supported use case of PVM? Or is PVM altogether "under the hood" of jBPM and should not be used directly? How stable is the PVM API expected to be?
I'd be very glad if someone could shed some light on this.
Thanks in advance
Ansgar
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/559031#559031]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 1 month
[jBPM] - jbpm4.4: Exception when deleting a Deployment
by James Schappet
James Schappet [http://community.jboss.org/people/jschappet] created the discussion
"jbpm4.4: Exception when deleting a Deployment"
To view the discussion, visit: http://community.jboss.org/message/559024#559024
--------------------------------------------------------------
While trying to run the following Code:
List<ProcessDefinition> procDefs = repositoryService.createProcessDefinitionQuery().list();
for (ProcessDefinition procDef : procDefs) {
log.debug (procDef.getId() + " [" + procDef.getKey() + "] ");
}
repositoryService.deleteDeploymentCascade("CRUAPPROVAL");
I get the following
13:50:56,828 DEBUG CRUController:129 - CRUAPPROVAL-1 [CRUAPPROVAL]
13:50:56,828 DEBUG CRUController:129 - userRegistration-1 [userRegistration]
13:50:56,849 ERROR JDBCExceptionReporter:78 - ERROR: column "cruapproval" does not exist
Position: 572
Here is the full stack:
org.postgresql.util.PSQLException: ERROR: column "cruapproval" does not exist
Position: 572
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367)
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:271)
org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
org.hibernate.loader.Loader.doQuery(Loader.java:674)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
org.hibernate.loader.Loader.doList(Loader.java:2220)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
org.hibernate.loader.Loader.list(Loader.java:2099)
org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
org.jbpm.pvm.internal.query.AbstractQuery.execute(AbstractQuery.java:93)
org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.execute(ProcessDefinitionQueryImpl.java:67)
org.jbpm.pvm.internal.query.AbstractQuery.untypedList(AbstractQuery.java:67)
org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.list(ProcessDefinitionQueryImpl.java:157)
org.jbpm.pvm.internal.cmd.DeleteDeploymentCmd.execute(DeleteDeploymentCmd.java:61)
org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:50)
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:56)
org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
org.jbpm.pvm.internal.repository.RepositoryServiceImpl.deleteDeploymentCascade(RepositoryServiceImpl.java:71)
edu.uiowa.icts.superappbackend.controller.CRUController.removeProcess(CRUController.java:131)
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/559024#559024]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 1 month