[Messaging, JMS & JBossMQ] - Not able to configure HTTPS jboss-4.2.2.GA for sending mess
by subrata_jboss
Hi folks,
I have two client program.
SenderHTTPQueue.java
import java.util.Properties;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.ObjectMessage;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class SenderHTTPQueue {
String url_;
String name_;
Connection conn = null;
Session session = null;
Destination queue = null;
public static long count;
public String LOG_CHANNEL_ID = "SenderHTTPQueue";
public SenderHTTPQueue(String url, String name) throws JMSException,
NamingException {
url_ = url;
name_ = name;
System.out.println("Inside constructor SenderHTTPQueue()");
this.initializeSender();
}
private void initializeSender() throws JMSException, NamingException {
Properties env = new Properties();
env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.naming.HttpNamingContextFactory");
env.setProperty(Context.PROVIDER_URL, url_);
try {
System.out.println("Before Initializing context");
Context ctx = new InitialContext(env);
System.out.println("Created InitialContext, env= " + env);
// looking up JMS connection factory over HTTP
ConnectionFactory connectionFactory = (ConnectionFactory) ctx
.lookup("/HTTPConnectionFactory");
System.out.println("connectionFactory= "
+ connectionFactory.toString());
queue = (Destination) ctx.lookup(name_);
conn = connectionFactory.createConnection();
session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
System.out.println("Done");
} catch (Exception e) {
e.printStackTrace();
}
}
public void send(String text) throws JMSException, NamingException {
// System.out.println(text);
// Send a text msg
MessageProducer producer = session.createProducer(queue);
Message m = session.createTextMessage(text);
// System.out.println(" sending message in send");
producer.send(m);
producer.close();
}
/*
* public void send(DataObject obj) throws JMSException, NamingException {
* MessageProducer producer = session.createProducer(queue);
*
* ObjectMessage m = session.createObjectMessage();
*
* ((ObjectMessage)m).setObject ((java.io.Serializable)obj);
*
* producer.send(m);
*
* producer.close(); }
*/
public void disconnect() throws JMSException {
if (conn != null) {
conn.stop();
}
if (session != null) {
session.close();
}
if (conn != null) {
conn.close();
}
}
public String getTopicName() {
return name_;
}
public String getTopicURL() {
return url_;
}
public static void main(String args[]) {
System.out.println("Starting SenderHTTPQueue");
long startTime = System.currentTimeMillis();
long endTime;
int tempCount = 0;
int timeCount = 0;
try {
SenderHTTPQueue queue = new SenderHTTPQueue(
"http://192.168.114.86:8080/invoker/JNDIFactory",
"queue/examplequeue2");
for (int i = 0; i < 10; i++) {
// System.out.println("creating message ");
queue
.send("Message sending "
+ i);
endTime = System.currentTimeMillis();
if ((endTime - startTime) >= 60000) {
timeCount++;
startTime = endTime;
System.out.println("Records sent in this minute:"
+ tempCount);
System.out.println("Total records sent in " + timeCount
+ " Minute: " + count);
tempCount = 0;
}
tempCount++;
count++;
}
System.out.println("Total number of records sent :" + count);
} catch (JMSException e) {
e.printStackTrace();
} catch (NamingException e) {
e.printStackTrace();
}
}
}
Listener.java
package com.facetime.jms.test;
import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.Properties;
import java.util.Queue;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.ObjectMessage;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueReceiver;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.jms.MessageListener;
public class Listener implements MessageListener {
String url_;
String name_;
Connection conn = null;
Session session = null;
Destination queue = null;
DataOutputStream outputStream;
ArrayList list = null;
long count = 0;
public Listener(String url, String name) {
super();
try {
outputStream = new DataOutputStream(
new FileOutputStream("data.txt"));
} catch (Exception e) {
System.out.println("Error in opening the file");
}
url_ = url;
name_ = name;
list = new ArrayList();
try {
this.initializeListener();
} catch (Exception e) {
// System.out.println("Error creating listener: " + e);
e.printStackTrace();
}
}
private void initializeListener() throws JMSException, NamingException {
Properties env = new Properties();
env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.naming.HttpNamingContextFactory");
env.setProperty(Context.PROVIDER_URL, url_);
Context ctx = new InitialContext(env);
QueueConnectionFactory connectionFactory = (QueueConnectionFactory) ctx
.lookup("HTTPConnectionFactory");
System.out
.println("connectionFactory= " + connectionFactory.toString());
queue = (Destination) ctx.lookup(name_);
conn = connectionFactory.createConnection();
session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageConsumer recv = session.createConsumer(queue);
recv.setMessageListener(this);
conn.start();
}
public void onMessage(Message msg) {
try {
TextMessage t = null;
if (msg instanceof TextMessage) {
t = (TextMessage) msg;
System.out.println(count++ + ") " + t.getText());
// outputStream.writeChars(t.getText() + "\n");
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void disconnect() throws JMSException {
if (conn != null) {
conn.stop();
}
if (session != null) {
session.close();
}
if (conn != null) {
conn.close();
}
}
public long getCount() {
return count;
}
public static void main(String args[]) {
System.out.println("Starting JMS Listener");
Listener listener = new Listener(
"http://192.168.114.86:8080/invoker/JNDIFactory",
"queue/examplequeue2");
try {
Thread.sleep(60 * 60 * 1000);
} catch (Exception e) {
System.out.println("Error sleeping: " + e);
e.printStackTrace();
}
System.out.println("Total records read: " + listener.getCount());
try {
listener.disconnect();
} catch (Exception e) {
System.out.println("Error terminating listener JMS objects: " + e);
e.printStackTrace();
}
System.out.println("Done listening");
}
}
Now i am able to send receive message using http request.
I want to change it such a way that it works with https
what i did :
1) changed server.xml to change connector as
<Connector port="8443" address="192.168.114.86" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="D:\server\jboss-4.2.2.GA\server\default\deploy\jms\conf\keystore"
keystorePass="subrata"
2) and jndi url as https://192.168.114.86:8080/invoker/JNDIFactorySSL
but it not working !
Any help will be great !
I am trying to do simple https using key file and password by changing
connector in server.xml , but it is also not working !
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134742#4134742
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134742
18 years, 1 month
[JBoss Portal] - Re: Accessing Nested Pages More Than One Level Down
by dsulliva
Ok the parser doesn't like tabs...let's try this one more time.
>>
Well my post didn't come out the way I thought I wrote it...the parser must of ate it.
Maybe I am having a browser issue but I only see menu nesting accessibilty to to one level.
Because the portal lets me nest pages. When I hover over the top level page say home I see a drop down with the pages that fall under that.
When I move down to the 1st page under the top level page I would expect to see and arrow and then a drop down for pages that fall under page1. This is what I want to see but don't see.
Top Level Page
..........................Page1
.....................................Page1a
.....................................Page1b
..........................Page2
..........................Page3
>From above I'm looking for Page1a. You may be saying that Page1a should be visible when hovering over Page1, but I don't see anything in my browser using firefox??
>>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134733#4134733
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134733
18 years, 1 month
[JBossCache] - ClassCastException: java.util.TreeSet: while trying to attac
by bahata
Hi
I am getting the exception ClassCastException: java.util.TreeSet , for
the code "cache.attach("datamodel",dataModel);" I am using JBossCache 'Habanero' 2.0.0.GA. Kindly help! It is a blocking condition for our project!
-----------------------------------------------------------------------------------
Code:
String configFile = "resource/replSync-service.xml";
PojoCache cache = PojoCacheFactory.createCache(configFile);
cache.start();
Object obj=cache.find("datamodel");
DataModel dataModel;
if(obj!=null)
{
dataModel=(DataModel) obj;
}
else
{
dataModel= new DataModel();
DatabaseController.loadFromDatabase(dataModel, loadDates);
cache.attach("datamodel",dataModel);
}
----------------------------------------------------------------------------------
Exception in thread "main" java.lang.ClassCastException: java.util.TreeSet
at java.util.TreeMap.compare(Unknown Source)
at java.util.TreeMap.getEntry(Unknown Source)
at java.util.TreeMap.remove(Unknown Source)
at java.util.TreeSet.remove(Unknown Source)
at org.jboss.cache.pojo.impl.CollectionClassHandler.checkSetRecursion(CollectionClassHandler.java:230)
at org.jboss.cache.pojo.impl.CollectionClassHandler.put(CollectionClassHandler.java:193)
at org.jboss.cache.pojo.impl.PojoCacheDelegate.putObjectII(PojoCacheDelegate.java:174)
at org.jboss.cache.pojo.impl.PojoCacheImpl.putObject(PojoCacheImpl.java:136)
at org.jboss.cache.pojo.impl.PojoCacheImpl.org$jboss$cache$pojo$impl$PojoCacheImpl$attach$aop(PojoCacheImpl.java:115)
at org.jboss.cache.pojo.impl.PojoCacheImpl.attach(PojoCacheImpl.java)
at org.jboss.cache.pojo.impl.AdvisedPojoHandler.put(AdvisedPojoHandler.java:141)
at org.jboss.cache.pojo.impl.PojoCacheDelegate.putObjectII(PojoCacheDelegate.java:170)
at org.jboss.cache.pojo.impl.PojoCacheImpl.putObject(PojoCacheImpl.java:136)
at org.jboss.cache.pojo.impl.PojoCacheImpl.org$jboss$cache$pojo$impl$PojoCacheImpl$attach$aop(PojoCacheImpl.java:101)
at org.jboss.cache.pojo.impl.PojoCacheImpl.attach(PojoCacheImpl.java)
at org.jboss.cache.pojo.impl.PojoCacheImpl.attach(PojoCacheImpl.java:93)
at ft.oots.controller.ServerController.loadDataModel(ServerController.java:227)
at ft.oots.controller.SynchronizationController.loadDataModel(SynchronizationController.java:62)
at ft.oots.Application.(Application.java:130)
at ft.oots.Application.main(Application.java:522)
09:47:13,312 INFO Thread-8 CacheImpl.internalStop() - stop(): closing the channel
09:47:13,437 INFO Thread-8 CacheImpl.internalStop() - stop(): stopping the dispatcher
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134728#4134728
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134728
18 years, 1 month