[JBoss Messaging] - JBoss Settings for MDB Client ?
by shptlucky
shptlucky [http://community.jboss.org/people/shptlucky] created the discussion
"JBoss Settings for MDB Client ?"
To view the discussion, visit: http://community.jboss.org/message/603174#603174
--------------------------------------------------------------
I have made message driven bean.
I have made a producer class.
I am using Netbeans
Producer Class is sending message to local host and i am recieving it.
but i am not getting settings to be done for remote connection.
I am striving for last three weeks on it. Please anyone help and tell me what settings is required on client side or server for Remote JMS message retrieving. Code is here under:
*For Sending*
package com;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.jms.TopicConnectionFactory;
import javax.jms.TopicConnection;
import javax.jms.TopicSession;
import javax.jms.TopicPublisher;
import javax.jms.Topic;
import javax.jms.TextMessage;
import javax.jms.Session;
import javax.jms.JMSException;
/**
* <p>Simple JMS client, publish text messages to testTopic Topic.
* </p>
*
* <p><b>NOTE</b>This code is a showcase only. It may not provide
* a stable production example.</p>
* @author Peter Antman
* @version $Revision: 3.1 $
*/
public class NewClass {
/**
* Topic connection, hold on to this so you may close it.
*/
TopicConnection topicConnection;
/**
* Topic session, hold on to this so you may close it.
* Also used to create messages.
*/
TopicSession topicSession;
/**
* Use this to publish messages.
*/
TopicPublisher topicPublisher;
/**
* Destination where to publish.
*/
Topic topic;
/**
* Sets up all the JMS fixtures.
*
* Use close() when finished with object.
*
* @param factoryJNDI name of the topic connection factory to look up.
* @param topicJNDI name of the topic destination to look up
*/
public NewClass(String factoryJNDI, String topicJNDI)
throws JMSException, NamingException {
// Populate with needed properties
Hashtable props = new Hashtable();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL, "192.168.1.218:1099");
props.put("java.naming.rmi.security.manager", "yes");
props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
// Get the initial context with given properties
Context context = new InitialContext(props);
System.out.println(factoryJNDI);
// Get the initial context
// Context context = new InitialContext();
// Get the connection factory
TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup("java:/XAConnectionFactory");
// Create the connection
topicConnection = topicFactory.createTopicConnection();
// Create the session
topicSession = topicConnection.createTopicSession(
// No transaction
false,
// Auto ack
Session.AUTO_ACKNOWLEDGE);
// Look up the destination
topic = (Topic) context.lookup(topicJNDI);
// Create a publisher
topicPublisher = topicSession.createPublisher(topic);
}
/**
* Publish the given String as a JMS message to the testTopic topic.
*/
public void publish(String msg) throws JMSException {
// Create a message
TextMessage message = topicSession.createTextMessage();
message.setText(msg);
// Publish the message
topicPublisher.publish(topic, message);
}
/**
* Close session and connection.
* When done, no publishing is possible any more.
*/
public void close() throws JMSException {
topicSession.close();
topicConnection.close();
}
/**
* Run an example publishing 10 messages to testTopic.
* Only works up to and including JBoss 2.4.0
*/
public static void main(String[] args) {
try {
// Create the HelloPublisher, giving it the name of the
// TopicConnection Factory and the Topic destination to
// use in lookup.
NewClass publisher = new NewClass("ConnectionFactory","topic/testTopic1");
// Publish 10 messages
for (int i = 1; i < 11; i++) {
String msg = "Hello World no. " + i;
System.out.println("Publishing message: " + msg);
publisher.publish(msg);
}
// Close down your publisher
publisher.close();
}
catch (Exception ex)
{
System.err.println("An exception occurred while testing HelloPublisher: " + ex);
ex.printStackTrace();
}
}
} // HelloPublisher
*MDB For reciving on Client End*
package com;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
@MessageDriven(mappedName = "topic/testTopic",
activationConfig = {
@ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/testTopic"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "NonDurable"),
@ActivationConfigProperty(propertyName = "clientId", propertyValue = "DrivenBean6"),
@ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "DrivenBean6")
})
public class DrivenBean implements MessageListener {
public DrivenBean() {
}
TextMessage tx=null;
public void onMessage(Message message)
{
tx=(TextMessage) message;
try {
System.out.println("Driven Bean -> " + tx.getText());
} catch (JMSException ex) {
}
System.out.println("Hello");
}
}
What Settings are required so that i could send message to client end.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/603174#603174]
Start a new discussion in JBoss Messaging at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 11 months
[jBPM] - Re: IdentityService
by Dámaris Suárez
Dámaris Suárez [http://community.jboss.org/people/dhamaris] created the discussion
"Re: IdentityService"
To view the discussion, visit: http://community.jboss.org/message/603178#603178
--------------------------------------------------------------
How did you have configured your IdentityService? I cannot even initialize mine!
I'm currently using jbpm 4.4 and I put this in my configuration:
<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration>
<!-- <import resource="jbpm.default.cfg.xml" /> -->
<import resource="jbpm.tx.spring.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />
<import resource="jbpm.jobexecutor.cfg.xml" />
<script-manager default-expression-language="juel"
default-script-language="juel"
read-contexts="execution, environment, process-engine, spring"
write-context="">
<script-language name="juel"
factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
</script-manager>
<transaction-context>
<object class="identitySession" />
</transaction-context>
<hibernate-session current="true" />
</jbpm-configuration>
And in my applicationContext-process.xml I added a IdentityService bean to try to make sure it initialized:
<bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />
<bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />
Nevertheless, everytime I debug my IdentityService object is null...
Any ideas?
Thanks!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/603178#603178]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 11 months
[Datasource Configuration] - Unable to get managed connection for jdbc
by titang
titang [http://community.jboss.org/people/titang] created the discussion
"Unable to get managed connection for jdbc"
To view the discussion, visit: http://community.jboss.org/message/602594#602594
--------------------------------------------------------------
Hi everybody,
I have been searching how to solve my problem but I can't find any solution. I am quite sure I must have forgotten something but I don't know what. So I guess I need some help unfortunaltely.
So I am having the following exceptions when I try to deploy my application:
ERROR org.rhq.core.pc.inventory.InventoryManager org.rhq.core.pc.inventory.InventoryManager Call to getAvailablity() on ResourceComponent for Resource[id=-49, type=Service Binding Manager, key=ServiceBindingManager, name=Service Binding Manager, parent=JBoss AS 6 (default)] failed.: org.rhq.core.pc.inventory.TimeoutException: Call to org.rhq.plugins.jbossas5.serviceBinding.ManagerComponent.getAvailability() org.rhq.plugins.jbossas5.serviceBinding.ManagerComponent.getAvailability() with args [] timed out. Invocation thread will be interrupted
2011-04-28 18:09:01,309 ERROR http://community.jboss.org/message/602594#602594 Unable to get managed connection for jdbc (ResourceContainer.invoker.nonDaemon-1) org.jboss.util.NestedSQLException: Unable to get managed connection for jdbc/test; - nested throwable: (javax.resource.ResourceException: Unable to get managed connection for jdbc/test)
I am focusing on the second error but the first one may be the cause of the SQL Exception. I could not find any information on the first exception and have absolutely no idea which part of my app raises this exception.
The second error appears when I use this code:
DataSource ds = (DataSource)((Context)(new InitialContext()).lookup("java:/comp/env")).lookup("jdbc/test");
final Connection conn = ds.getConnection();
In order to declare my data source (an Oracle 10g database), I used the following files:
oracle-ds.xml:
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/test</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:oracle:thin:@test-oracle:1521:test</connection-url>
<!--
Here are a couple of the possible OCI configurations.
For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.92...
<connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url>
or
<connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url>
Clearly, its better to have TNS set up properly.
-->
<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<user-name>test</user-name>
<password>test</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
jboss-web.xml:
<jboss-web>
<!-- A security domain that restricts access
<security-domain>java:/jaas/JBossWS</security-domain>
-->
<context-root>test</context-root>
<resource-ref>
<res-ref-name>jdbc/test</res-ref-name>
<!--res-type>javax.sql.DataSource</res-type-->
<jndi-name>jdbc/test</jndi-name>
</resource-ref>
</jboss-web>
web.xml:
<resource-ref>
<description>Oracle data source</description>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>
No other resources are declared. The oracle datasource is up in the admin-console.
If you have any idea, thank you. If there are any informations lacking, tell me, I will add them as soon as possible. Thank you
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/602594#602594]
Start a new discussion in Datasource Configuration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 11 months
[jBPM] - jBPM 4.x suspend/Resume
by Tony D
Tony D [http://community.jboss.org/people/pushpak1981] created the discussion
"jBPM 4.x suspend/Resume"
To view the discussion, visit: http://community.jboss.org/message/603136#603136
--------------------------------------------------------------
I have some processes which are having java activity nodes which are refering to EJB's. My Process.jpdl.xml file has only one async node during the start. As per the docs a new transaction is started at every a sync node so in my case my entire workflow will be processes into a single Thread (transaction). If suppose i call a jboss shutdown in while the process is execution then goes into an error state.
Is there any way in which i can suspend the current Process instance and then again start when the server is started ? i.e. wait for the process instance to complete the current activity and then go to suspend and then again continue from the next activity when again server is started.
I tried by getExecutionService().endProcessInstance("processinstanceid", Execution.STATE_SUSPENDED); But was not suspending the process.
Any Help would be highly appreciated.
Thanks.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/603136#603136]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 11 months
[Beginner's Corner] - setting up JBoss with SEAM
by Mike Quin
Mike Quin [http://community.jboss.org/people/sanfran0201] created the discussion
"setting up JBoss with SEAM"
To view the discussion, visit: http://community.jboss.org/message/599941#599941
--------------------------------------------------------------
Hi,
I have a very simple SEAM example (shown below) that is not working.
I'm very new to JBoss and hibernate and SEAM and all that stuff. I have been reading http://docs.jboss.org/seam/2.2.0.GA/reference/en-US/html/ http://docs.jboss.org/seam/2.2.0.GA/reference/en-US/html/
I don't want to run seam-gen on my jboss-5.1.0. I just need a simple and straightforward instructions on how to setup jboss 5.1 with SEAM and to run this extremely simple helloworld example. However if seam-gen is absolutely required (which sounds irrational), then please confirm and I'll use it.
Any help is appreciated.
Thank you
Mike
I'm deploying org.jboss.seam-jboss-seam-2.1.0.SP1.jar inside my ear.
I have also attached the server.log file if that would help.
public class InjectionServlet extends HttpServlet {
* @In(value=InjectableComponent.NAME, create = true, required = true)*
* private InjectableComponent injectableComponent;*
public void service(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Hello World Seam Servlet!</title>");
out.println("</head>");
out.println("<body>");
if (injectableComponent == null) {
out.println("Injection not working.");
} else {
out.println(injectableComponent.getTitle());
}
out.println("</body>");
out.println("</html>");
}
}
package com.example.bean;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
*@Name("injectableComponent")*
*(a)Scope(ScopeType.EVENT)*
public class InjectableComponent {
public static final String NAME = "injectableComponent";
public InjectableComponent() {
}
@Create
public void init() {
System.out.println("Good Morning.");
}
public String getTitle() {
return "Hello World.";
}
}
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="2.5"
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/web-app_2_5.xsd">
<!-- Seam -->
* <listener>*
* <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>*
* </listener>*
<servlet>
<servlet-name>InjectionServlet</servlet-name>
<servlet-class>com.example.ui.InjectionServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>InjectionServlet</servlet-name>
<url-pattern>/ioc</url-pattern>
</servlet-mapping>
</web-app>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE application PUBLIC
"-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
"http://java.sun.com/dtd/application_1_3.dtd">
<application>
<display-name>EJB3</display-name>
<module>
<ejb>Simple-server.jar</ejb>
</module>
<module>
<web>
<web-uri>Simple-web.war</web-uri>
<context-root>/seam</context-root>
</web>
</module>
</application>
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/599941#599941]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 11 months