[Beginners Corner] - Re: how to create new user for durable topic subscriber lik
by sudasudheer
Thanks for your response peter johnson.
I Tried to solve using your post, but I am not able to execute the fallowing program using different user name and password (user name : jmsuser password: durable).
I found one file with name "null-persistence-service.xml", under "C:\jboss-4.2.2.GA\server\default\conf",
I have to add new user details in any xml file?
where and how to give sql commands ?
Can you give me the STEPS to create a new user(for example user name : jmsuser password: durable) ,
Can you please execute the fallowing program using username : jmsuser and password : durable
I am able to execute the fallowing program by
1) Giving john and needle as user name and password and
2) Entry in "C:\jboss-4.2.2.GA\server\default\deploy\jms\jbossmq-destinations-service.xml" file as fallows.
jbossmq-destinations-service.xml
----------------------------------
| <mbean code="org.jboss.mq.server.jmx.Topic"
| name="jboss.mq.destination:service=Topic,name=example">
| <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
| <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
| <attribute name="SecurityConf">
| <security>
| <role name="durpublisher" read="true" write="true" create="true"/>
| </security>
| </attribute>
| </mbean>
|
|
// source code
package pubsub;
import java.util.Enumeration;
import java.util.Properties;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Topic;
import javax.jms.TopicConnection;
import javax.jms.TopicConnectionFactory;
import javax.jms.TopicPublisher;
import javax.jms.TopicSubscriber;
import javax.jms.TopicSession;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class DurableTopicRecvClient {
TopicConnection conn = null;
TopicSession session = null;
Topic topic = null;
public void setupPubSub() throws JMSException, NamingException {
Properties props = new Properties();
props.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
props.setProperty("java.naming.provider.url", "localhost:1099");
Context ic = new InitialContext(props);
Object tmp = ic.lookup("ConnectionFactory");
TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
//conn = tcf.createTopicConnection("john","needle");
conn = tcf.createTopicConnection("jmsuser","durable"); // I want to pass these details , how can I do this ?
topic = (Topic) ic.lookup("topic/example");
session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
conn.start();
}
public void recvSync() throws JMSException, NamingException {
System.out.println("Begin recvSync");
// Set up the pub/sub connection, session
setupPubSub();
// Wait up to 8 seconds for the message
TopicSubscriber recv = session.createDurableSubscriber(topic,
"This is DurableSubscriber ");
Message msg = recv.receive(17000);
if (msg == null) {
System.out.println("Timed out waiting for msg");
} else {
System.out.println("DurableTopicRecvClient.recv, msgt=" + msg);
}
}
public void stop() throws JMSException {
conn.stop();
session.close();
conn.close();
}
public static void main(String args[]) throws Exception {
System.out.println("Begin DurableTopicRecvClient, now="
+ System.currentTimeMillis());
DurableTopicRecvClient client = new DurableTopicRecvClient();
client.recvSync();
client.stop();
System.out.println("End DurableTopicRecvClient");
System.exit(0);
}
}
Sudheer
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4144384#4144384
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144384
18 years, 3 months
[JBossWS] - Cannot extract schema definition?
by bsheward
Hi,
I developed a very simple web service, using wsconsume against a URL for WSDL to create a set of objects, and then the following code:
| public void runQuery( String username, String password, String query) {
| RemoteService service = new RemoteService ();
| RemotePortType rem= service.getRemotePort();
| System.out.println("Server said: " + rem.getRemoteResult( query, username, password));
| }
|
I get an Exception when instantiating the RemoteService:
| Caused by: org.jboss.ws.metadata.wsdl.WSDLException: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Cannot extract schema definition: java.io.IOException: The file
| name, directory name, or volume label syntax is incorrect
| at org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:154)
| at org.jboss.ws.metadata.umdm.ServiceMetaData.getWsdlDefinitions(ServiceMetaData.java:321)
| at org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder.buildMetaData(JAXWSClientMetaDataBuilder.java:85)
| at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.<init>(ServiceDelegateImpl.java:131)
| at org.jboss.ws.core.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:61)
| at javax.xml.ws.Service.<init>(Service.java:83)
| at com.mycom.platforms.bf.webclient.RemoteService.<init>(RelevanceService.java:40)
| at com.mycom.platforms.bf.BFRemoteServiceClient.runQuery(BigFixRelevanceServiceClient.java:27)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| ... 39 more
| Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Cannot extract schema definition: java.io.IOException: The filename, directory name, or volume label synt
| ax is incorrect
| at org.jboss.ws.tools.wsdl.WSDL11Reader.processTypes(WSDL11Reader.java:384)
| at org.jboss.ws.tools.wsdl.WSDL11Reader.processDefinition(WSDL11Reader.java:172)
| at org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:128)
| ... 59 more
| Caused by: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
| at java.io.WinNTFileSystem.createFileExclusively(Native Method)
| at java.io.File.checkAndCreate(File.java:1704)
| at java.io.File.createTempFile(File.java:1793)
| at org.jboss.ws.metadata.wsdl.xsd.SchemaUtils.getSchemaTempFile(SchemaUtils.java:535)
| at org.jboss.ws.tools.wsdl.WSDL11Reader.processSchemaInclude(WSDL11Reader.java:529)
| at org.jboss.ws.tools.wsdl.WSDL11Reader.processTypes(WSDL11Reader.java:375)
| ... 61 more
|
One potential issue I can think of is that I am calling this web service while in a Session Bean exposed as a web service.
Could anyone give me any other pointers?
Thanks,
Barry
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4144373#4144373
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144373
18 years, 3 months
[EJB 3.0] - Configuring external jms datasource with MQSeries
by jamesworourke
I'm posting here after much research into this matter.
Currently, we are using wmq.jmsra.rar resource adapter with jboss 4.2.2 successfully. Essentially, all the configuration we have is in EJB 3.0 annotations, as follows:
@MessageDriven(mappedName = "FilmMDB" activationConfig = {
| // Note: the values inside strings here with @....@ pattern are replaced by the build
| // script
| @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
| @ActivationConfigProperty(propertyName = "destination", propertyValue = "FundTransactionTopic"),
| @ActivationConfigProperty(propertyName = "channel", propertyValue = "@MDBChannel@"),
| @ActivationConfigProperty(propertyName = "hostName", propertyValue = "@MDBHostName@"),
| @ActivationConfigProperty(propertyName = "queueManager", propertyValue = "@MDBQueueManager@"),
| @ActivationConfigProperty(propertyName = "port", propertyValue = "@MDBPort@"),
| @ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT"),
| @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),
| @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "@MDBDurable@"),
| @ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "FilmSub"),
| @ActivationConfigProperty(propertyName = "clientID", propertyValue = "MyId") })
| @ResourceAdapter(value = "wmq.jmsra.rar")
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| @TransactionManagement(TransactionManagementType.BEAN)
| public class FilmMDB implements MessageListener {....}
This works for now however, the problem is, I would like to have the configuration for the queue/topic be external to the code and to the application configuration. I realize we could use a deployment descriptor, however, that would still require packaging with the ear. Ultimately, what is desirable is to configure the MDB to use a connection factory in a similar way to a datasource for db connections. I have attempted to follow the instructions here:
http://wiki.jboss.org/wiki/UsingWebSphereMQSeriesWithJBossASPart4
but with limited success. It seems that the connection factory setup is for clients and there is no way to attached a connection factory to an MDB. Is this true? Any suggestions would be greatly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4144361#4144361
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144361
18 years, 3 months