Announcement Announcement Module
Collapse
No announcement yet.
Help on basic EJB lookup configuration on glassfish 3.1 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help on basic EJB lookup configuration on glassfish 3.1

    Hi, please consider my ejb-jar.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd" version="3.1">
      <display-name>BatchOverrideEJB</display-name>
      <ejb-client-jar>BatchOverrideEJBClient.jar</ejb-client-jar>
    </ejb-jar>
    this was created by STS IDE when i was creating EAR and EJB projects... Following is how i access the bean from context
    Code:
    Properties p = new Properties();
    p.put("org.omg.CORBA.ORBInitialHost","localhost");
    p.put("org.omg.CORBA.ORBInitialPort","3700");
    InitialContext ctx = new InitialContext(p);
    
    ic = new InitialContext(p);
    
    BatchOverrideManagerRemote batchOverrideRemote = 
    	(BatchOverrideManagerRemote) ic.lookup("java:comp/env/BatchOverrideEJB");
    error:
    Code:
    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 za.co.sanlam.batchovveride.test.BatchOverrideTester.main(BatchOverrideTester.java:33)
    i then tried to changed the ejb-jar.xml
    Code:
    <ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd" version="3.1">
    	<enterprise-beans>
    		<session>
    			<ejb-name>BatchOverrideEJB</ejb-name>
    			<ejb-class>com.test.ejb.BatchOverrideManagerBean</ejb-class>
    			<ejb-local-ref>
    				<ejb-ref-name>BatchOverrideEJB</ejb-ref-name>
    				<ejb-ref-type>Session</ejb-ref-type>
    				<local>com.test.batchoverridemanager.ejb.BatchOverrideManagerLocal</local>
    				<ejb-link>BatchOverrideEJB.jar#BatchOverrideEJB</ejb-link>
    			</ejb-local-ref>
    		</session>
    	</enterprise-beans>
    </ejb-jar
    error i get
    Code:
    java.lang.RuntimeException: Error while binding JNDI name za.co.sanlam.epsilon.commoncomponent.service.batchoverridemanager.ejb.BatchOverrideManagerRemote#za.co.sanlam.epsilon.commoncomponent.service.batchoverridemanager.ejb.BatchOverrideManagerRemote for EJB : BatchOverrideEJB
    	at com.sun.ejb.containers.BaseContainer.initializeHome(BaseContainer.java:1550)
    	at com.sun.ejb.containers.StatelessSessionContainer.initializeHome(StatelessSessionContainer.java:202)
    	at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:167)
    	at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:234)
    	at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:290)
    	at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:101)
    	at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186)
    	at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:249)
    	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
    	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
    	at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
    	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
    	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067)
    	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
    	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247)
    	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
    	at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:465)
    	at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:222)
    	at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
    	at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
    	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
    	at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
    	at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
    	at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
    	at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    	at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    	at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    	at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    	at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    	at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    	at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    	at java.lang.Thread.run(Thread.java:662)
    Caused by: javax.naming.NameAlreadyBoundException: Use rebind to override
    	at com.sun.enterprise.naming.impl.TransientContext.doBindOrRebind(TransientContext.java:333)
    	at com.sun.enterprise.naming.impl.TransientContext.bind(TransientContext.java:268)
    	at com.sun.enterprise.naming.impl.SerialContextProviderImpl.bind(SerialContextProviderImpl.java:98)
    	at com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.bind(LocalSerialContextProviderImpl.java:99)
    	at com.sun.enterprise.naming.impl.SerialContext.bind(SerialContext.java:672)
    	at com.sun.enterprise.naming.impl.SerialContext.bind(SerialContext.java:689)
    	at javax.naming.InitialContext.bind(InitialContext.java:404)
    	at javax.naming.InitialContext.bind(InitialContext.java:404)
    	at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.publishObject(GlassfishNamingManagerImpl.java:208)
    	at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.publishObject(GlassfishNamingManagerImpl.java:189)
    	at com.sun.ejb.containers.BaseContainer$JndiInfo.publish(BaseContainer.java:5608)
    	at com.sun.ejb.containers.BaseContainer.initializeHome(BaseContainer.java:1535)
    	... 35 more
    Am not quite sure what am doing wrong
Working...
X