Note that there are some explanatory texts on larger screens.

plurals
  1. POTesting glassfish EJB with standard se application
    text
    copied!<p><em><strong>Context #1 :</em></strong></p> <p>A glassfish 3.1 server on my pc.</p> <p>A simple ejb depoyed on the server.</p> <p>In eclipse (same pc) :</p> <pre><code>public class App { public static void main(String[] args) throws Exception { Properties p = new Properties(); p.setProperty("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory"); String jndiname = "java:global/simpleEjb"; Context context = new InitialContext(p); System.out.println(daoService.sayHello()); } </code></pre> <p>}</p> <p>In my pom.xml :</p> <pre><code> &lt;dependency&gt; &lt;groupId&gt;org.glassfish.appclient&lt;/groupId&gt; &lt;artifactId&gt;gf-client&lt;/artifactId&gt; &lt;version&gt;3.1&lt;/version&gt; &lt;scope&gt;system&lt;/scope&gt; &lt;systemPath&gt;C:\Java\glassfish3\glassfish\lib\gf-client.jar&lt;/systemPath&gt; &lt;/dependency&gt; </code></pre> <p>and it's working.</p> <p><em><strong>The real context :</em></strong></p> <p>Glassfish is running on an ubuntu server on another machine.</p> <p>So in my app :</p> <pre><code> Properties p = new Properties(); p.setProperty("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory"); p.setProperty("org.omg.CORBA.ORBInitialHost","10.12.3.93"); p.setProperty("org.omg.CORBA.ORBInitialPort","3700"); </code></pre> <ul> <li>If I leave my local server running : It's calling the ejb on my local server !!</li> <li>If I stop my local server : No exceptions but my app never ends (hanging on the lookup - even after waiting for more than 10 minutes).</li> </ul> <p>I also tried modifying my pom.xml replacing the previous dependency with :</p> <pre><code> &lt;dependency&gt; &lt;groupId&gt;org.glassfish.appclient&lt;/groupId&gt; &lt;artifactId&gt;gf-client&lt;/artifactId&gt; &lt;version&gt;3.1&lt;/version&gt; &lt;type&gt;pom&lt;/type&gt; &lt;scope&gt;compile&lt;/scope&gt; &lt;exclusions&gt; &lt;exclusion&gt; &lt;artifactId&gt;tools&lt;/artifactId&gt; &lt;groupId&gt;com.sun&lt;/groupId&gt; &lt;/exclusion&gt; &lt;exclusion&gt; &lt;groupId&gt;org.eclipse.persistence&lt;/groupId&gt; &lt;artifactId&gt;org.eclipse.persistence.core&lt;/artifactId&gt; &lt;/exclusion&gt; &lt;/exclusions&gt; &lt;/dependency&gt; </code></pre> <p>and adding :</p> <pre><code>&lt;repositories&gt; &lt;repository&gt; &lt;id&gt;EclipseLink&lt;/id&gt; &lt;url&gt;http://download.eclipse.org/rt/eclipselink/maven.repo&lt;/url&gt; &lt;/repository&gt; &lt;/repositories&gt; </code></pre> <p>But same results ...</p> <p>I'm going to become mad ... I don't understand what's happening.</p> <p>If I try changing the host ip :</p> <pre><code>Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 10.12.3.94; port: 3700 </code></pre>
 

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