Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot instantiate initialcontext on standalone client
    primarykey
    data
    text
    <p>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 <a href="http://www.packtpub.com/article/setting-glassfish-jms-and-working-message-queues" rel="nofollow noreferrer">this</a> great tutorial, which uses annotations I cannot use because I have a standalone client. I found the following solution on stackoverflow:</p> <pre><code>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"); } </code></pre> <p>I also found out that I had to import some libraries from the glassfish directory. So I did: <img src="https://i.stack.imgur.com/h3F5F.jpg" alt="Project properties"></p> <p>I get the following error:</p> <pre><code>javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterprise.naming.impl.SerialInitContextFactory [Root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.impl.SerialInitContextFactory] </code></pre> <p>What am I doing wrong?</p> <p>EDIT</p> <p>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".</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload