We help IT Professionals succeed at work.

EJB JNDI lookup not working properly.

mandmtech
mandmtech asked
on
2,263 Views
Last Modified: 2013-11-24
I need some help on resolving JNDI for this simple EJB application.  It adds and subtracts numbers.
I believe you helped me resolve this problem several months ago, and I tried to follow what we did then, however I am not getting anywhere.
I also cant seem to run the program from the server

This is what I get when I run as Java app on MyEclipse8.....
Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
      at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at org.jboss01.stateless.TheClient.main(TheClient.java:30)


When I try to run it as a JBoss5 server app on MyEclipse8, it restarts the server, but I dont see any output from the application.


This is the JNDI setup I have on JBoss5:
13:29:04,069 INFO  [JBossASKernel] Created KernelDeployment for: JBOSSTutorial2.jar
13:29:04,069 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=JBOSSTutorial2.jar,name=CalculatorBean,service=EJB3
13:29:04,069 INFO  [JBossASKernel]   with dependencies:
13:29:04,069 INFO  [JBossASKernel]   and demands:
13:29:04,069 INFO  [JBossASKernel]       jboss.ejb:service=EJBTimerService
13:29:04,069 INFO  [JBossASKernel]   and supplies:
13:29:04,069 INFO  [JBossASKernel]       jndi:CalculatorBean/local-org.jboss01.stateless.CalculatorBeanLocal
13:29:04,069 INFO  [JBossASKernel]       jndi:CalculatorBean/remote
13:29:04,069 INFO  [JBossASKernel]       Class:org.jboss01.stateless.CalculatorBeanLocal
13:29:04,069 INFO  [JBossASKernel]       jndi:CalculatorBean/local
13:29:04,069 INFO  [JBossASKernel]       jndi:CalculatorBean/remote-org.jboss01.stateless.CalculatorBeanRemote
13:29:04,069 INFO  [JBossASKernel]       Class:org.jboss01.stateless.CalculatorBeanRemote
13:29:04,069 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=JBOSSTutorial2.jar,name=CalculatorBean,service=EJB3) to KernelDeployment of: JBOSSTutorial2.jar
13:29:04,069 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@e728a5{name=jboss.j2ee:jar=JBOSSTutorial2.jar,name=CalculatorBean,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
13:29:04,116 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=JBOSSTutorial2.jar,name=CalculatorBean,service=EJB3
13:29:04,116 INFO  [EJBContainer] STARTED EJB: org.jboss01.stateless.CalculatorBean ejbName: CalculatorBean
13:29:04,194 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

      CalculatorBean/remote - EJB3.x Default Remote Business Interface
      CalculatorBean/remote-org.jboss01.stateless.CalculatorBeanRemote - EJB3.x Remote Business Interface
      CalculatorBean/local - EJB3.x Default Local Business Interface
      CalculatorBean/local-org.jboss01.stateless.CalculatorBeanLocal - EJB3.x Local Business Interface





Here is the code Im using:

Client:

package org.jboss01.stateless;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.jboss01.stateless.CalculatorBeanRemote;

public class TheClient {
        public static void main(String[] args) throws Exception
         {

            Context context = new InitialContext();
            CalculatorBeanRemote calculator = (CalculatorBeanRemote) context.lookup("CalculatorBean/remote");
                       
            System.out.println(calculator.add(1, 1));
            System.out.println(calculator.subtract(1, 1));
         }
}

_____________________________________________________________________________

Session Bean:
package org.jboss01.stateless;

import javax.ejb.Stateless;

@Stateless
public class CalculatorBean implements CalculatorBeanLocal,
            CalculatorBeanRemote {
         public int add(int x, int y)
         {
              System.out.print("Doing addition:  1 + 1 ===> ");
            return x + y;
         }

         public int subtract(int x, int y)
         {
              System.out.print("Doing subtraction:  1 - 1 ===> ");
            return x - y;
         }
}

_____________________________________________________________________________

Remote Interface:
package org.jboss01.stateless;

import javax.ejb.Remote;

@Remote
public interface CalculatorBeanRemote {
        int add(int x, int y);

        int subtract(int x, int y);
}

_____________________________________________________________________________

Local Interface:
package org.jboss01.stateless;

import javax.ejb.Local;

@Local
public interface CalculatorBeanLocal {
        int add(int x, int y);

        int subtract(int x, int y);
}


_____________________________________________________________________________
Complete JBoss Startup Log:

13:28:01,831 INFO  [ServerImpl] Starting JBoss (Microcontainer)...
13:28:01,831 INFO  [ServerImpl] Release ID: JBoss [The Oracle] 5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)
13:28:01,831 INFO  [ServerImpl] Bootstrap URL: null
13:28:01,831 INFO  [ServerImpl] Home Dir: C:\jboss-5.1.0.GA
13:28:01,831 INFO  [ServerImpl] Home URL: file:/C:/jboss-5.1.0.GA/
13:28:01,831 INFO  [ServerImpl] Library URL: file:/C:/jboss-5.1.0.GA/lib/
13:28:01,846 INFO  [ServerImpl] Patch URL: null
13:28:01,846 INFO  [ServerImpl] Common Base URL: file:/C:/jboss-5.1.0.GA/common/
13:28:01,846 INFO  [ServerImpl] Common Library URL: file:/C:/jboss-5.1.0.GA/common/lib/
13:28:01,846 INFO  [ServerImpl] Server Name: default
13:28:01,846 INFO  [ServerImpl] Server Base Dir: C:\jboss-5.1.0.GA\server
13:28:01,846 INFO  [ServerImpl] Server Base URL: file:/C:/jboss-5.1.0.GA/server/
13:28:01,846 INFO  [ServerImpl] Server Config URL: file:/C:/jboss-5.1.0.GA/server/default/conf/
13:28:01,846 INFO  [ServerImpl] Server Home Dir: C:\jboss-5.1.0.GA\server\default
13:28:01,846 INFO  [ServerImpl] Server Home URL: file:/C:/jboss-5.1.0.GA/server/default/
13:28:01,846 INFO  [ServerImpl] Server Data Dir: C:\jboss-5.1.0.GA\server\default\data
13:28:01,846 INFO  [ServerImpl] Server Library URL: file:/C:/jboss-5.1.0.GA/server/default/lib/
13:28:01,846 INFO  [ServerImpl] Server Log Dir: C:\jboss-5.1.0.GA\server\default\log
13:28:01,846 INFO  [ServerImpl] Server Native Dir: C:\jboss-5.1.0.GA\server\default\tmp\native
13:28:01,846 INFO  [ServerImpl] Server Temp Dir: C:\jboss-5.1.0.GA\server\default\tmp
13:28:01,846 INFO  [ServerImpl] Server Temp Deploy Dir: C:\jboss-5.1.0.GA\server\default\tmp\deploy
13:28:02,612 INFO  [ServerImpl] Starting Microcontainer, bootstrapURL=file:/C:/jboss-5.1.0.GA/server/default/conf/bootstrap.xml
13:28:03,300 INFO  [VFSCacheFactory] Initializing VFSCache [org.jboss.virtual.plugins.cache.CombinedVFSCache]
13:28:03,315 INFO  [VFSCacheFactory] Using VFSCache [CombinedVFSCache[real-cache: null]]
13:28:03,659 INFO  [CopyMechanism] VFS temp dir: C:\jboss-5.1.0.GA\server\default\tmp
13:28:03,659 INFO  [ZipEntryContext] VFS force nested jars copy-mode is enabled.
13:28:04,800 INFO  [ServerInfo] Java version: 1.6.0_13,Sun Microsystems Inc.
13:28:04,800 INFO  [ServerInfo] Java Runtime: Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
13:28:04,800 INFO  [ServerInfo] Java VM: Java HotSpot(TM) Client VM 11.3-b02,Sun Microsystems Inc.
13:28:04,800 INFO  [ServerInfo] OS-System: Windows XP 5.1,x86
13:28:04,800 INFO  [ServerInfo] VM arguments: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:3242 -Djboss.home=C:\jboss-5.1.0.GA -Djava.library.path=C:\Program Files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin -Djava.endorsed.dirs=C:\jboss-5.1.0.GA\lib\endorsed -Xms128m -Xmx512m -XX:MaxPermSize=256m
13:28:04,847 INFO  [JMXKernel] Legacy JMX core initialized
13:28:06,909 INFO  [ProfileServiceBootstrap] Loading profile: ProfileKey@fa4dab[domain=default, server=default, name=default]
13:28:08,909 INFO  [WebService] Using RMI server codebase: http://127.0.0.1:8083/
13:28:16,144 INFO  [NativeServerConfig] JBoss Web Services - Stack Native Core
13:28:16,144 INFO  [NativeServerConfig] 3.1.2.GA
13:28:17,832 INFO  [AttributeCallbackItem] Owner callback not implemented.
13:28:20,332 INFO  [LogNotificationListener] Adding notification listener for logging mbean "jboss.system:service=Logging,type=Log4jService" to server org.jboss.mx.server.MBeanServerImpl@4d0923[ defaultDomain='jboss' ]
13:28:46,662 WARN  [MappedReferenceMetaDataResolverDeployer] Unresolved references exist in JBossWebMetaData:[#web-app:AnnotatedEJBReferenceMetaData{name=test.MyServlet/ssr,ejb-ref-type=null,link=null,ignore-dependecy=false,mapped/jndi-name=SimpleSession/remote,resolved-jndi-name=null,beanInterface=interface test.SimpleSessionRemote}]
13:28:46,709 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@5328994{vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/EJB3%20In%20Action%20Chapter%201.jar/}
13:28:46,709 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@5328994{vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/EJB3%20In%20Action%20Chapter%201.jar/}
13:28:46,709 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@30992857{vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/Eclipse8EjbProject.jar/}
13:28:46,709 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@30992857{vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/Eclipse8EjbProject.jar/}
13:28:46,709 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@29912179{vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/JBOSSTutorial2.jar/}
13:28:46,709 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@29912179{vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/JBOSSTutorial2.jar/}
13:28:46,709 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@23552227{vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/profileservice-secured.jar/}
13:28:46,709 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@23552227{vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/profileservice-secured.jar/}
13:28:46,709 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@23552227{vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/profileservice-secured.jar/}
13:28:46,709 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@23552227{vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/profileservice-secured.jar/}
13:28:50,131 INFO  [JMXConnectorServerService] JMX Connector server: service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1090/jmxconnector
13:28:50,365 INFO  [MailService] Mail Service bound to java:/Mail
13:28:54,272 WARN  [JBossASSecurityMetadataStore] WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has not had its password changed from the installation default. Please see the JBoss Messaging user guide for instructions on how to do this.
13:28:54,318 WARN  [AnnotationCreator] No ClassLoader provided, using TCCL: org.jboss.managed.api.annotation.ManagementComponent
13:28:54,459 WARN  [AnnotationCreator] No ClassLoader provided, using TCCL: org.jboss.managed.api.annotation.ManagementComponent
13:28:54,568 INFO  [TransactionManagerService] JBossTS Transaction Service (JTA version - tag:JBOSSTS_4_6_1_GA) - JBoss Inc.
13:28:54,568 INFO  [TransactionManagerService] Setting up property manager MBean and JMX layer
13:28:55,084 INFO  [TransactionManagerService] Initializing recovery manager
13:28:55,334 INFO  [TransactionManagerService] Recovery manager configured
13:28:55,334 INFO  [TransactionManagerService] Binding TransactionManager JNDI Reference
13:28:55,381 INFO  [TransactionManagerService] Starting transaction recovery manager
13:28:56,240 INFO  [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin
13:28:56,350 INFO  [Http11Protocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
13:28:56,365 INFO  [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
13:28:56,444 INFO  [StandardService] Starting service jboss.web
13:28:56,444 INFO  [StandardEngine] Starting Servlet Engine: JBoss Web/2.1.3.GA
13:28:56,537 INFO  [Catalina] Server startup in 183 ms
13:28:56,584 INFO  [TomcatDeployment] deploy, ctxPath=/web-console
13:28:58,803 INFO  [TomcatDeployment] deploy, ctxPath=/jbossws
13:28:58,912 INFO  [TomcatDeployment] deploy, ctxPath=/invoker
13:28:59,163 INFO  [RARDeployment] Required license terms exist, view vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/jboss-local-jdbc.rar/META-INF/ra.xml
13:28:59,178 INFO  [RARDeployment] Required license terms exist, view vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/jboss-xa-jdbc.rar/META-INF/ra.xml
13:28:59,225 INFO  [RARDeployment] Required license terms exist, view vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/jms-ra.rar/META-INF/ra.xml
13:28:59,272 INFO  [RARDeployment] Required license terms exist, view vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/mail-ra.rar/META-INF/ra.xml
13:28:59,303 INFO  [RARDeployment] Required license terms exist, view vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/META-INF/ra.xml
13:28:59,459 INFO  [SimpleThreadPool] Job execution threads will use class loader of thread: main
13:28:59,538 INFO  [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
13:28:59,538 INFO  [RAMJobStore] RAMJobStore initialized.
13:28:59,538 INFO  [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
13:28:59,538 INFO  [StdSchedulerFactory] Quartz scheduler version: 1.5.2
13:28:59,538 INFO  [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
13:29:00,459 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
13:29:01,866 INFO  [ServerPeer] JBoss Messaging 1.4.3.GA server [0] started
13:29:02,100 INFO  [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
13:29:02,100 INFO  [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@12d56ed started
13:29:02,131 INFO  [QueueService] Queue[/queue/ExpiryQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
13:29:02,147 INFO  [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
13:29:02,147 INFO  [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@f1413f started
13:29:02,147 INFO  [ConnectionFactoryJNDIMapper] supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support failover
13:29:02,147 INFO  [ConnectionFactoryJNDIMapper] supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support load balancing
13:29:02,147 INFO  [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
13:29:02,147 INFO  [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@fc294d started
13:29:02,147 INFO  [QueueService] Queue[/queue/DLQ] started, fullSize=200000, pageSize=2000, downCacheSize=2000
13:29:02,381 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
13:29:02,491 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=PrromoDS' to JNDI name 'java:PrromoDS'
13:29:03,225 INFO  [JBossASKernel] Created KernelDeployment for: EJB3 In Action Chapter 1.jar
13:29:03,241 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=EJB3 In Action Chapter 1.jar,name=HelloUserBean,service=EJB3
13:29:03,241 INFO  [JBossASKernel]   with dependencies:
13:29:03,241 INFO  [JBossASKernel]   and demands:
13:29:03,241 INFO  [JBossASKernel]       jboss.ejb:service=EJBTimerService
13:29:03,241 INFO  [JBossASKernel]   and supplies:
13:29:03,241 INFO  [JBossASKernel]       jndi:HelloUserBean/remote
13:29:03,241 INFO  [JBossASKernel]       Class:com.ejb3inaction.actionbazaar.buslogic.HelloUserRemote
13:29:03,241 INFO  [JBossASKernel]       jndi:HelloUserBean/remote-com.ejb3inaction.actionbazaar.buslogic.HelloUserRemote
13:29:03,241 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=EJB3 In Action Chapter 1.jar,name=HelloUserBean,service=EJB3) to KernelDeployment of: EJB3 In Action Chapter 1.jar
13:29:03,257 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@187326{name=jboss.j2ee:jar=EJB3 In Action Chapter 1.jar,name=HelloUserBean,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
13:29:03,382 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=EJB3 In Action Chapter 1.jar,name=HelloUserBean,service=EJB3
13:29:03,428 INFO  [EJBContainer] STARTED EJB: com.ejb3inaction.actionbazaar.buslogic.HelloUserBean ejbName: HelloUserBean
13:29:03,600 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

      HelloUserBean/remote - EJB3.x Default Remote Business Interface
      HelloUserBean/remote-com.ejb3inaction.actionbazaar.buslogic.HelloUserRemote - EJB3.x Remote Business Interface

13:29:03,788 INFO  [JBossASKernel] Created KernelDeployment for: Eclipse8EjbProject.jar
13:29:03,788 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=Eclipse8EjbProject.jar,name=SimpleSession,service=EJB3
13:29:03,788 INFO  [JBossASKernel]   with dependencies:
13:29:03,788 INFO  [JBossASKernel]   and demands:
13:29:03,788 INFO  [JBossASKernel]       jboss.ejb:service=EJBTimerService
13:29:03,788 INFO  [JBossASKernel]   and supplies:
13:29:03,788 INFO  [JBossASKernel]       Class:test.SimpleSessionRemote
13:29:03,788 INFO  [JBossASKernel]       jndi:SimpleSession/local-test.SimpleSessionLocal
13:29:03,788 INFO  [JBossASKernel]       jndi:SimpleSession/remote
13:29:03,788 INFO  [JBossASKernel]       jndi:SimpleSession/local
13:29:03,788 INFO  [JBossASKernel]       Class:test.SimpleSessionLocal
13:29:03,788 INFO  [JBossASKernel]       jndi:SimpleSession/remote-test.SimpleSessionRemote
13:29:03,788 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=Eclipse8EjbProject.jar,name=SimpleSession,service=EJB3) to KernelDeployment of: Eclipse8EjbProject.jar
13:29:03,788 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@b22fab{name=jboss.j2ee:jar=Eclipse8EjbProject.jar,name=SimpleSession,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
13:29:03,882 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=Eclipse8EjbProject.jar,name=SimpleSession,service=EJB3
13:29:03,882 INFO  [EJBContainer] STARTED EJB: test.SimpleSession ejbName: SimpleSession
13:29:03,913 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

      SimpleSession/remote - EJB3.x Default Remote Business Interface
      SimpleSession/remote-test.SimpleSessionRemote - EJB3.x Remote Business Interface
      SimpleSession/local - EJB3.x Default Local Business Interface
      SimpleSession/local-test.SimpleSessionLocal - EJB3.x Local Business Interface

13:29:04,069 INFO  [JBossASKernel] Created KernelDeployment for: JBOSSTutorial2.jar
13:29:04,069 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=JBOSSTutorial2.jar,name=CalculatorBean,service=EJB3
13:29:04,069 INFO  [JBossASKernel]   with dependencies:
13:29:04,069 INFO  [JBossASKernel]   and demands:
13:29:04,069 INFO  [JBossASKernel]       jboss.ejb:service=EJBTimerService
13:29:04,069 INFO  [JBossASKernel]   and supplies:
13:29:04,069 INFO  [JBossASKernel]       jndi:CalculatorBean/local-org.jboss01.stateless.CalculatorBeanLocal
13:29:04,069 INFO  [JBossASKernel]       jndi:CalculatorBean/remote
13:29:04,069 INFO  [JBossASKernel]       Class:org.jboss01.stateless.CalculatorBeanLocal
13:29:04,069 INFO  [JBossASKernel]       jndi:CalculatorBean/local
13:29:04,069 INFO  [JBossASKernel]       jndi:CalculatorBean/remote-org.jboss01.stateless.CalculatorBeanRemote
13:29:04,069 INFO  [JBossASKernel]       Class:org.jboss01.stateless.CalculatorBeanRemote
13:29:04,069 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=JBOSSTutorial2.jar,name=CalculatorBean,service=EJB3) to KernelDeployment of: JBOSSTutorial2.jar
13:29:04,069 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@e728a5{name=jboss.j2ee:jar=JBOSSTutorial2.jar,name=CalculatorBean,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
13:29:04,116 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=JBOSSTutorial2.jar,name=CalculatorBean,service=EJB3
13:29:04,116 INFO  [EJBContainer] STARTED EJB: org.jboss01.stateless.CalculatorBean ejbName: CalculatorBean
13:29:04,194 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

      CalculatorBean/remote - EJB3.x Default Remote Business Interface
      CalculatorBean/remote-org.jboss01.stateless.CalculatorBeanRemote - EJB3.x Remote Business Interface
      CalculatorBean/local - EJB3.x Default Local Business Interface
      CalculatorBean/local-org.jboss01.stateless.CalculatorBeanLocal - EJB3.x Local Business Interface

13:29:04,428 INFO  [JBossASKernel] Created KernelDeployment for: profileservice-secured.jar
13:29:04,428 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=profileservice-secured.jar,name=SecureProfileService,service=EJB3
13:29:04,428 INFO  [JBossASKernel]   with dependencies:
13:29:04,428 INFO  [JBossASKernel]   and demands:
13:29:04,428 INFO  [JBossASKernel]       jndi:SecureManagementView/remote-org.jboss.deployers.spi.management.ManagementView
13:29:04,428 INFO  [JBossASKernel]       jboss.ejb:service=EJBTimerService
13:29:04,428 INFO  [JBossASKernel]   and supplies:
13:29:04,428 INFO  [JBossASKernel]       Class:org.jboss.profileservice.spi.ProfileService
13:29:04,428 INFO  [JBossASKernel]       jndi:SecureProfileService/remote
13:29:04,428 INFO  [JBossASKernel]       jndi:SecureProfileService/remote-org.jboss.profileservice.spi.ProfileService
13:29:04,428 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=profileservice-secured.jar,name=SecureProfileService,service=EJB3) to KernelDeployment of: profileservice-secured.jar
13:29:04,428 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=profileservice-secured.jar,name=SecureDeploymentManager,service=EJB3
13:29:04,428 INFO  [JBossASKernel]   with dependencies:
13:29:04,428 INFO  [JBossASKernel]   and demands:
13:29:04,428 INFO  [JBossASKernel]       jboss.ejb:service=EJBTimerService
13:29:04,428 INFO  [JBossASKernel]   and supplies:
13:29:04,428 INFO  [JBossASKernel]       jndi:SecureDeploymentManager/remote-org.jboss.deployers.spi.management.deploy.DeploymentManager
13:29:04,428 INFO  [JBossASKernel]       Class:org.jboss.deployers.spi.management.deploy.DeploymentManager
13:29:04,428 INFO  [JBossASKernel]       jndi:SecureDeploymentManager/remote
13:29:04,428 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=profileservice-secured.jar,name=SecureDeploymentManager,service=EJB3) to KernelDeployment of: profileservice-secured.jar
13:29:04,428 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=profileservice-secured.jar,name=SecureManagementView,service=EJB3
13:29:04,428 INFO  [JBossASKernel]   with dependencies:
13:29:04,428 INFO  [JBossASKernel]   and demands:
13:29:04,428 INFO  [JBossASKernel]       jboss.ejb:service=EJBTimerService
13:29:04,428 INFO  [JBossASKernel]   and supplies:
13:29:04,428 INFO  [JBossASKernel]       jndi:SecureManagementView/remote-org.jboss.deployers.spi.management.ManagementView
13:29:04,428 INFO  [JBossASKernel]       Class:org.jboss.deployers.spi.management.ManagementView
13:29:04,428 INFO  [JBossASKernel]       jndi:SecureManagementView/remote
13:29:04,428 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=profileservice-secured.jar,name=SecureManagementView,service=EJB3) to KernelDeployment of: profileservice-secured.jar
13:29:04,444 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@9a7bf9{name=jboss.j2ee:jar=profileservice-secured.jar,name=SecureProfileService,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
13:29:04,444 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@52537b{name=jboss.j2ee:jar=profileservice-secured.jar,name=SecureDeploymentManager,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
13:29:04,444 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@461582{name=jboss.j2ee:jar=profileservice-secured.jar,name=SecureManagementView,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
13:29:04,538 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=profileservice-secured.jar,name=SecureDeploymentManager,service=EJB3
13:29:04,538 INFO  [EJBContainer] STARTED EJB: org.jboss.profileservice.ejb.SecureDeploymentManager ejbName: SecureDeploymentManager
13:29:04,553 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

      SecureDeploymentManager/remote - EJB3.x Default Remote Business Interface
      SecureDeploymentManager/remote-org.jboss.deployers.spi.management.deploy.DeploymentManager - EJB3.x Remote Business Interface

13:29:04,632 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=profileservice-secured.jar,name=SecureManagementView,service=EJB3
13:29:04,632 INFO  [EJBContainer] STARTED EJB: org.jboss.profileservice.ejb.SecureManagementView ejbName: SecureManagementView
13:29:04,647 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

      SecureManagementView/remote - EJB3.x Default Remote Business Interface
      SecureManagementView/remote-org.jboss.deployers.spi.management.ManagementView - EJB3.x Remote Business Interface

13:29:04,741 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=profileservice-secured.jar,name=SecureProfileService,service=EJB3
13:29:04,757 INFO  [EJBContainer] STARTED EJB: org.jboss.profileservice.ejb.SecureProfileServiceBean ejbName: SecureProfileService
13:29:04,772 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

      SecureProfileService/remote - EJB3.x Default Remote Business Interface
      SecureProfileService/remote-org.jboss.profileservice.spi.ProfileService - EJB3.x Remote Business Interface

13:29:05,038 INFO  [TomcatDeployment] deploy, ctxPath=/admin-console
13:29:05,210 INFO  [config] Initializing Mojarra (1.2_12-b01-FCS) for context '/admin-console'
13:29:10,820 INFO  [TomcatDeployment] deploy, ctxPath=/BrokerTool-war
13:29:11,023 INFO  [TomcatDeployment] deploy, ctxPath=/Eclipse8WebProject
13:29:11,226 INFO  [TomcatDeployment] deploy, ctxPath=/hi
13:29:11,366 INFO  [TomcatDeployment] deploy, ctxPath=/jmx-console
13:29:11,491 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
13:29:11,523 INFO  [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
13:29:11,538 INFO  [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)] Started in 1m:9s:692ms

Comment
Watch Question

Commented:
Replace the class TheClient with the code show below:

public class TheClient {
      public static void main(String[] args)
                  throws Exception {
            try {
                  Hashtable env = new Hashtable();

                  env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                  env.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
                  env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

                  Context context = new InitialContext(env);

                  CalculatorBeanRemote calculator = (CalculatorBeanRemote) context.lookup("CalculatorBean/remote");

                  System.out.println(calculator.add(1, 1));
                  System.out.println(calculator.subtract(1, 1));

            } catch (Exception ex) {
                  ex.printStackTrace();
            }
      }
}

Author

Commented:
Ha, I get this error.  I tried something like that before ioanton.  Here's the new msg:
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
      at javax.naming.InitialContext.init(InitialContext.java:223)
      at javax.naming.InitialContext.<init>(InitialContext.java:197)
      at org.jboss01.stateless.TheClient.main(TheClient.java:23)
Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:247)
      at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
      ... 4 more


Im probably missing something.......will keep looking, but any help from the experts is Most Welcome!
Thank you!
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.