[JNDI and Naming] - Re: Using JNDI to connect to Websphere MQ, without hardcoded info
by Stuart Clayton
Stuart Clayton [http://community.jboss.org/people/stuartclayton22] created the discussion
"Re: Using JNDI to connect to Websphere MQ, without hardcoded info"
To view the discussion, visit: http://community.jboss.org/message/620767#620767
--------------------------------------------------------------
I have exactly the same problem with incoming MDBs (receive messages from MQ), with the same versions of JBoss and MQ. I think maybe I have made a little progress by following the http://community.jboss.org/docs/DOC-12944 http://community.jboss.org/wiki/HowToConfigureEJB3MDBsForIBMWebsphereMQ hint for creating an "aop domain". [Added while creating: problem solved.]
This "domain" contains all the context (host, port etc) that we currently have either in the annotations, the ejb-jar.xml or the jboss.xml (there seems to be no difference between the last two files, as far as where the activationSpecs are for queue MDBs). This "domain" arranges for yet another ( ! ) set of "activationSpec annotations" to be injected into the MDB class code, but indirectly instead of having to put annotations explicity in the class source. Here is what the additional code in the JBoss deploy/ejb3-interceptors-aop.xml file looks like (note that the @org.jboss.annotation.ejb.DefaultActivationSpecs ({ ... stuff has to be on one line, without CRLFs ):
The MDB declaration now looks like this:
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "messagingType", propertyValue = "javax.jms.MessageListener"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") })
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
@ResourceAdapter(value = "wmq.jmsra.rar")
@AspectDomain("IBMMQ Message Driven Bean")
public class ReadMQAgent implements MessageListener {
The ejb-jar.xml now looks like this:
<ejb-jar xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance" xmlns=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee" xmlns:ejb=" http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
<enterprise-beans>
<message-driven>
<ejb-name>ReadMQAgent</ejb-name>
<ejb-class>com.fleetboard.agw.calculator.msgproc.impl.ReadMQAgent</ejb-class>
<activation-config>
<activation-config-property>
<activation-config-property-name>useJNDI</activation-config-property-name>
<activation-config-property-value>false</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>Q1</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
</ejb-jar>
In the AOP "domain" declaration from the link given above, the annotation class is specified as @org.jboss.annotation.ejb.DefaultActivationSpecs. Somewhere (can't find it now) there was a user comment on this example, pointing out that the class should be @org.jboss.ejb3.annotation.DefaultActivationSpecs.After I changed this accordingly, the whole business finally worked. Before this last change, I was getting an MQ error about "Q1" not being defined.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620767#620767]
Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[jBPM] - Re: jbpm5:Failed to set process variables
by Tommy Cheng
Tommy Cheng [http://community.jboss.org/people/tomcheng76] created the discussion
"Re: jbpm5:Failed to set process variables"
To view the discussion, visit: http://community.jboss.org/message/620497#620497
--------------------------------------------------------------
Same here.
After tracing the code, i found that the kruntime changed to null suddenly...
kruntime is set previously. but it changed to null when calling getProcess()
To test it:
Add the following to org.jboss.bpm.console.server.ProcessMgmtFacade.java in jbpm-gwt-console-server
@POST
@Consumes("multipart/form-data")
@Path("instance/{id}/data")
public Response setInstanceData(
@Context
HttpServletRequest request,
@PathParam("id")
String instanceId
)
{
try {
ServletFileUpload upload = new ServletFileUpload();
FileItemIterator fileIterator = upload.getItemIterator(request);
while (fileIterator.hasNext()) {
FileItemStream item = fileIterator.next();
log.info("Setting Process instance data: Content-Type: " + item.getContentType() + " Name: " + item.getFieldName());
Map<String, Object> data = new HashMap<String, Object>();
if (item.getContentType() == null){
String s = IOUtils.toString(item.openStream());
data.put(item.getFieldName(), s);
} else {
File f = File.createTempFile("file-", "");
IOUtils.copy(item.openStream(), new FileOutputStream(f));
data.put(item.getFieldName(), f.getCanonicalPath());
}
getProcessManagement().setInstanceData(instanceId, data);
}
} catch (Exception e) {
log.info("cannot set instance data", e);
}
ProcessInstanceRef instance = getProcessManagement().getProcessInstance(instanceId);
return createJsonResponse(instance);
}
then post something to gwt-console-server/rs/process/instance/{yourinstanceid}/data
NullPointerException @ setInstanceData
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620497#620497]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[EJB3] - Persistence provider creating new table even with update option
by Mitesh pandey
Mitesh pandey [http://community.jboss.org/people/mtshpandey] created the discussion
"Persistence provider creating new table even with update option"
To view the discussion, visit: http://community.jboss.org/message/620678#620678
--------------------------------------------------------------
Hi All,
I am using hibernate as my persistence provider and postgre as my DB.
My persistence.xml looks like below
<persistence-unit name="titan" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:PostgresDS</jta-data-source>
<class>com.domain.Cabin</class>
<class>com.domain.Customer</class>
<class>com.domain.Address</class>
<properties>
<property name="hibernate.dialect" value= "org.hibernate.dialect.PostgreSQLDialect" />
<property name="*hibernate.hbm2ddl.auto*" value="*update*" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
<property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/Entity"/>
<property name="hibernate.connection.username" value="*****"/>
<property name="hibernate.connection.password" value="****"/>
</properties>
</persistence-unit>
I have table Cabin, Customer and Address under my table Entity. When i deploy my jar and start the server , again a new table is created as cabin, customer and address. :0 I thought with value = "update" for hibernate.hbm2ddl.auto, it should not create any table and should only update the data.
When i deleted the table from DB, then there was no table found message when the jboss is up. I don't want to duplicate the tables.
What could be the issue ?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620678#620678]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months