Click here to Skip to main content
15,891,033 members
Home / Discussions / Java
   

Java

 
GeneralRe: Multiple strings received on TCP socket Pin
Sachin k Rajput 10-Apr-13 1:47
Sachin k Rajput 10-Apr-13 1:47 
GeneralRe: Multiple strings received on TCP socket Pin
Richard MacCutchan10-Apr-13 2:27
mveRichard MacCutchan10-Apr-13 2:27 
AnswerRe: Multiple strings received on TCP socket Pin
jschell10-Apr-13 8:36
jschell10-Apr-13 8:36 
GeneralRe: Multiple strings received on TCP socket Pin
Sachin k Rajput 10-Apr-13 20:31
Sachin k Rajput 10-Apr-13 20:31 
QuestionFile Path Problem Pin
Sachin k Rajput 9-Apr-13 22:36
Sachin k Rajput 9-Apr-13 22:36 
QuestionRe: File Path Problem Pin
Richard MacCutchan10-Apr-13 0:25
mveRichard MacCutchan10-Apr-13 0:25 
AnswerRe: File Path Problem Pin
Sachin k Rajput 10-Apr-13 0:45
Sachin k Rajput 10-Apr-13 0:45 
QuestionRead JNDI from c# Pin
Member 11184949-Apr-13 1:59
Member 11184949-Apr-13 1:59 
Hi there,
I wrote :
package Haitham

import java.io.IOException;
import java.net.URISyntaxException;
import java.rmi.RemoteException;
import java.util.Properties;
import java.util.logging.Logger;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class TracingMessages
{

public static String Send_MVRI_Messages(String qname,String msg) throws IOException, URISyntaxException {


String body="";

try
{

Context init =TracingMessages.getInitialContext();
javax.jms.Queue destination = (javax.jms.Queue) init.lookup("/queue/" +qname);
ConnectionFactory connectionFactory = (ConnectionFactory) init.lookup("ConnectionFactory");
Connection connection = connectionFactory.createConnection();//

Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

MessageProducer producer = session.createProducer(destination);


TextMessage message = session.createTextMessage();
message.setText(msg );

connection.start();
System.out.println("connect strat");
producer.send(message);

body = message.getText();

session.close();
connection.close();

}
catch (Exception e)
{
return(e.toString());
}

return body ;

}

public static Context getInitialContext () throws JMSException,NamingException,RemoteException
{
Properties prop = new Properties();
prop.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
prop.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
prop.setProperty("java.naming.provider.url", "127.0.0.1:1099");

Context context = new InitialContext(prop);
return context;
}
}

Then i converted to DLL file to send message from C# to jboss,
everything are goo,so i can send message from c# windows application to jboss server
but if i use the same DLL file inside web application i got the following error:

javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory

My question Why???
any one have an idea?
Thanks
AnswerRe: Read JNDI from c# Pin
Richard MacCutchan9-Apr-13 5:16
mveRichard MacCutchan9-Apr-13 5:16 
GeneralRe: Read JNDI from c# Pin
Member 11184949-Apr-13 8:28
Member 11184949-Apr-13 8:28 
GeneralRe: Read JNDI from c# Pin
jschell9-Apr-13 9:19
jschell9-Apr-13 9:19 
GeneralRe: Read JNDI from c# Pin
Richard MacCutchan9-Apr-13 9:40
mveRichard MacCutchan9-Apr-13 9:40 
GeneralRe: Read JNDI from c# Pin
Member 111849410-Apr-13 22:55
Member 111849410-Apr-13 22:55 
GeneralRe: Read JNDI from c# Pin
Richard MacCutchan10-Apr-13 23:14
mveRichard MacCutchan10-Apr-13 23:14 
GeneralRe: Read JNDI from c# Pin
Member 111849410-Apr-13 23:21
Member 111849410-Apr-13 23:21 
GeneralRe: Read JNDI from c# Pin
Richard MacCutchan11-Apr-13 0:38
mveRichard MacCutchan11-Apr-13 0:38 
GeneralRe: Read JNDI from c# Pin
Member 111849411-Apr-13 0:42
Member 111849411-Apr-13 0:42 
SuggestionRe: Read JNDI from c# Pin
Prasad Khandekar2-May-13 19:49
professionalPrasad Khandekar2-May-13 19:49 
QuestionJava Program to accept input from user and then display output . Pin
Aman kumar routh4-Apr-13 3:35
Aman kumar routh4-Apr-13 3:35 
AnswerRe: Java Program to accept input from user and then display output . Pin
emadrefai4-Apr-13 6:20
emadrefai4-Apr-13 6:20 
GeneralRe: Java Program to accept input from user and then display output . Pin
Aman kumar routh4-Apr-13 6:29
Aman kumar routh4-Apr-13 6:29 
AnswerRe: Java Program to accept input from user and then display output . Pin
Richard MacCutchan4-Apr-13 6:29
mveRichard MacCutchan4-Apr-13 6:29 
QuestionJAVA Pin
Member 995424830-Mar-13 8:01
professionalMember 995424830-Mar-13 8:01 
AnswerRe: JAVA Pin
Richard MacCutchan30-Mar-13 13:19
mveRichard MacCutchan30-Mar-13 13:19 
AnswerRe: JAVA Pin
Shubhashish_Mandal1-Apr-13 2:43
professionalShubhashish_Mandal1-Apr-13 2:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.