i have problems with setting up JMS. I tried using Active MQ and OpenJMS but the same error occurs. Iam clueless on how to solve it:
When i execute this:
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Hashtable;
public class Main {
public static void main(String[] args) throws NamingException {
Hashtable properties = new Hashtable();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.exolab.jms.jndi.InitialContextFactory");
properties.put(Context.PROVIDER_URL, "tcp://localhost:3035/");
Context context = new InitialContext(properties);
}
}
I get this error:
Exception in thread "main" javax.naming.NoInitialContextException: Cannot instantiate class: org.exolab.jms.jndi.InitialContextFactory [Root exception is java.lang.ClassNotFoundException: org.exolab.jms.jndi.InitialContextFactory]
After some googling i think the problem is that a jar is not in the right classpath, but all the answers already assume that i know which jar and where to store it, but this is not the case here.
Which Jar are they talking about? Where can i get it? Where do i need to store it?
Iam using IntelliJ btw. Could you point me in the right direction?
ActiveMQ is working (http://localhost:8161/ shows webpage of ActiveMQ)
Here are my steps on how i created the project: File -> New Project -> Java -> SDK1.8 -> Next -> Next -> Project Name: Test -> Right click src folder -> New -> Java Class -> Name: Main -> Paste code from above -> Run -> Error
EDIT: for all the people having the same errors: OpenJMS comes with a libfolder. Install these libraries and it should work