geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: java.lang.ClassNotFoundException: org.apache.activemq.jndi.ActiveMQInitialContextFactory
Date Mon, 19 Jan 2009 07:33:33 GMT
adding the activemq-core jar to the classpath should fix this error.   
then....

I assume you are using a plain java program rather than a javaee  
application client.  In this case you should not expect to access the  
java:comp/env context but should refer to the activemq documentation  
on how to use their jndi setup.  I also don't think the openejb  
property will be helpful.



http://activemq.apache.org/jndi-support.html

If you are using a javaee app client let us know.

thanks
david jencks

On Jan 18, 2009, at 10:35 PM, viola.lu wrote:

>
> HI, axiez:
>
> Have you added activemq-core-****.jar (which contains
> org.apache.activemq.jndi.ActiveMQInitialContextFactory)  under
> $G_Dir\org\apache\activemq\activemq-core\ to your classpath and  
> buildpath?
>
> Thanks.
> Viola.Lu
>
>
> axiez wrote:
>>
>> I have the following sample code and jndi.properties file:
>> import javax.jms.*;
>> import javax.naming.InitialContext;
>> import java.util.*;
>> import java.io.*;
>> public class LogClient {
>>    public static void main(String[] args) throws Exception {
>>        Properties p = new Properties();
>>        p.load(new FileInputStream("jndi.properties"));
>>        p.put("openejb.authentication.realmName","geronimo-admin");
>>        InitialContext ctx = new InitialContext(p);
>>        TopicConnectionFactory factory = (TopicConnectionFactory)
>> ctx.lookup("java:comp/env/jms/DefaultActiveMQConnectionFactory");
>>        TopicConnection connection = factory.createTopicConnection();
>>        TopicSession session = connection.createTopicSession(false,
>> Session.AUTO_ACKNOWLEDGE);
>>        Topic topic = (Topic)ctx.lookup("java:comp/env/jms/Topic");
>>        TopicPublisher publisher = session.createPublisher(topic);
>>        TextMessage msg = session.createTextMessage();
>>        msg.setText("This is a test message");
>>        publisher.send(msg);
>>        publisher.close();
>>        System.out.println("Message published. Please check  
>> application
>> server's console to see the response from MDB");
>>    }
>> }
>>
>> jndi.properties file:
>> java 
>> .naming 
>> .factory 
>> .initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
>> java.naming.provider.url=tcp://localhost:61616
>> java.naming.security.principal=system
>> java.naming.security.credentials=manager
>>
>> I ran the program after successful compilation. Error message is:
>> Exception in thread "main" javax.naming.NoInitialContextException:  
>> Cannot
>> instantiate class:  
>> org.apache.activemq.jndi.ActiveMQInitialContextFactory
>> [Root exception is java.lang.ClassNotFoundException:
>> org.apache.activemq.jndi.ActiveMQInitialContextFactory]
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/java.lang.ClassNotFoundException%3A-org.apache.activemq.jndi.ActiveMQInitialContextFactory-tp21537474s134p21537612.html
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Mime
View raw message