This content has been marked as final.
Show 1 reply
-
1. Re: Swing application using EJB3
fowlks Dec 4, 2006 9:28 PM (in response to ilan)You still need an application server, the tomcat web server can be disabled if you'd like in the default server configuration by deleting the tomcat sar directory. You'll need to build your ejb jar and deploy it as normal. Then connect to it using the following client application example.
package com.example.web.Test.client; import javax.naming.Context; import java.util.*; import com.example.web.jList.ejb.*; import com.example.web.jList.ejb.entity.*; public class TestClient { public static Context getInitialContext() throws javax.naming.NamingException { return new javax.naming.InitialContext(); } /** * @param args */ public static void main(String[] args) { try { Context jndiContext = getInitialContext(); jndiContext.addToEnvironment("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); jndiContext.addToEnvironment("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); jndiContext.addToEnvironment("java.naming.provider.url","localhost"); /* You'll need to change this part to obtain your deployed SessionBean */ LoginService loginService = (LoginService) jndiContext.lookup("LoginBean/remote"); } catch (Exception e ) { e.printStackTrace(); System.out.printf( e.getMessage()); } } }