I have a standalone client that I do not want to deploy on my Glassfish server. With the client I want to post message via the Point to Point communication pattern. I found this great tutorial, which uses annotations I cannot use because I have a standalone client. I found the following solution on stackoverflow:
Context jndiContext;
private ConnectionFactory connectionFactory;
private static Queue queue;
public TweetSender() throws NamingException{
jndiContext = new InitialContext();
connectionFactory = (ConnectionFactory) jndiContext.lookup("JMS/KwetterConnectionFactory");
queue = (Queue) jndiContext.lookup("JMS/KwetterQueue");
}
I also found out that I had to import some libraries from the glassfish directory. So I did:
I get the following error:
javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterprise.naming.impl.SerialInitContextFactory [Root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.impl.SerialInitContextFactory]
What am I doing wrong?
EDIT
I found a temporary solution for the problem though I feel it's not the right one (I think I might get problems when I want to migrate the project. I removed the libraries which I retrieved from the Glassfish lib folder and added them using the "Absolute path".