well I assure you I made it working yesterday this way. list jndi is highly dependent on the provider and I wouldn't rely on it.
If you handle to reproduce it (maybe with ant just letting us running ant tomcat && ant tomee then just doing a GET on an url?) we could check what's your issue. Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2014/1/13 mauro2java2011 <[email protected]>: > escuse me but not work . > I have tried to list all jndi into a servelt that is deployed on tomee with > the same war that contain the EJB .(i.e. server side ) . > I get : > > > Servlet Servlet2 at /Ejbsutomee > contesto remoto=javax.naming.InitialContext@9a4b70 java.lang.String . > > javax.naming.Context openejb > > org.apache.openejb.core.ivm.naming.BusinessRemoteReference > UserBusinessRemote > > org.apache.openejb.core.ivm.naming.BusinessRemoteReference > DeployerBusinessRemote > > org.apache.openejb.core.ivm.naming.BusinessRemoteReference > ConfigurationInfoBusinessRemote > > javax.naming.Context global > > javax.naming.Context openejb > > javax.naming.Context openejb > > org.apache.openejb.core.ivm.naming.BusinessRemoteReference > User!org.apache.openejb.assembler.util.User > > org.apache.openejb.core.ivm.naming.BusinessRemoteReference > Deployer!org.apache.openejb.assembler.Deployer > > org.apache.openejb.core.ivm.naming.BusinessRemoteReference > ConfigurationInfo!org.apache.openejb.assembler.classic.cmd.ConfigurationInfo > > javax.naming.Context Ejbsutomee > > org.apache.openejb.core.ivm.naming.BusinessRemoteReference > Mauroejb!mauro.ejb.MauroInterfacciaejb > > org.apache.openejb.core.ivm.naming.ObjectReference MEJB > > org.apache.openejb.core.ivm.naming.BusinessRemoteReference MauroejbRemote > > -------------------------------------------------------------------------- > > but if i deploy the same servlet at tomcat client and i run it i get only: > > Servlet Servlet2 at /tomcat_ejb_client_tomee > contesto remoto=javax.naming.InitialContext@122d9c java.lang.String . > > javax.naming.Context openejb > > org.apache.openejb.core.ivm.naming.BusinessRemoteReference > UserBusinessRemote > > > -------------------------------------------------------------------------------------- > > the method tha i used for print on screen the jndi tree context it is: > > private static final void listContext(Context ctx ,String indent,PrintWriter > out){ > try{ > NamingEnumeration list=ctx.listBindings(""); > while(list.hasMore()){ > Binding item =(Binding)list.next(); > String className= item.getClassName(); > String name= item.getName(); > out.println(""+indent+className+" "+name); > > //MIA > out.println("<br/><br/>"); > Object o=item.getObject(); > if(o instanceof javax.naming.Context){ > > listContext((Context)o, indent+" ", out);} > } > > } > catch(NamingException ex){ > ex.printStackTrace(out); > } > } > > ---------------------------------- > > i have also try into tomee the servlet from ejb-examples - > i have deployed with the same war into the server side with ejb > > /** > * > * Licensed to the Apache Software Foundation (ASF) under one or more > * contributor license agreements. See the NOTICE file distributed with this > * work for additional information regarding copyright ownership. The ASF > * licenses this file to You under the Apache License, Version 2.0 (the > * "License"); you may not use this file except in compliance with the > License. > * You may obtain a copy of the License at > * > * http://www.apache.org/licenses/LICENSE-2.0 > * > * Unless required by applicable law or agreed to in writing, software > * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT > * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the > * License for the specific language governing permissions and limitations > under > * the License. > */ > package org.superbiz.servlet; > > import javax.naming.Context; > import javax.naming.InitialContext; > import javax.naming.NameClassPair; > import javax.naming.NamingException; > import javax.servlet.ServletException; > import javax.servlet.ServletOutputStream; > import javax.servlet.http.HttpServlet; > import javax.servlet.http.HttpServletRequest; > import javax.servlet.http.HttpServletResponse; > import java.io.IOException; > import java.util.Collections; > import java.util.Map; > import java.util.TreeMap; > > public class JndiServlet extends HttpServlet { > > protected void doGet(HttpServletRequest request, HttpServletResponse > response) throws ServletException, IOException { > response.setContentType("text/plain"); > ServletOutputStream out = response.getOutputStream(); > > Map<String, Object> bindings = new TreeMap<String, > Object>(String.CASE_INSENSITIVE_ORDER); > try { > Context context = (Context) new > InitialContext().lookup("java:comp/"); > addBindings("", bindings, context); > } catch (NamingException e) { > throw new ServletException(e); > } > > out.println("JNDI Context:"); > for (Map.Entry<String, Object> entry : bindings.entrySet()) { > if (entry.getValue() != null) { > out.println(" " + entry.getKey() + "=" + entry.getValue()); > } else { > out.println(" " + entry.getKey()); > } > } > } > > private void addBindings(String path, Map<String, Object> bindings, > Context context) { > try { > for (NameClassPair pair : Collections.list(context.list(""))) { > String name = pair.getName(); > String className = pair.getClassName(); > if > ("org.apache.naming.resources.FileDirContext$FileResource".equals(className)) > { > bindings.put(path + name, "<file>"); > } else { > try { > Object value = context.lookup(name); > if (value instanceof Context) { > Context nextedContext = (Context) value; > bindings.put(path + name, ""); > addBindings(path + name + "/", bindings, > nextedContext); > } else { > bindings.put(path + name, value); > } > } catch (NamingException e) { > // lookup failed > bindings.put(path + name, "ERROR: " + > e.getMessage()); > } > } > } > } catch (NamingException e) { > bindings.put(path, "ERROR: list bindings threw an exception: " + > e.getMessage()); > } > } > } > > > --------------------------- > i get: > > JNDI Context: > BeanManager=org.apache.webbeans.container.InjectableBeanManager@23a8ef > ComponentName=Ejbsutomee > env= > env/comp= > env/comp/BeanManager=ERROR: Name "Resource/comp/BeanManager" not found. > env/comp/ComponentName=Ejbsutomee > > env/comp/TransactionManager=org.apache.geronimo.transaction.manager.GeronimoTransactionManager@192d7d0 > > env/comp/TransactionSynchronizationRegistry=org.apache.geronimo.transaction.manager.GeronimoTransactionManager@192d7d0 > env/comp/Validator=ERROR: Name "Resource/comp/Validator" not found. > env/comp/ValidatorFactory=ERROR: Name "Resource/comp/ValidatorFactory" not > found. > env/module= > env/module/ModuleName=Ejbsutomee > HandleDelegate=ERROR: No HandleDelegate registered with the OpenEJB system > ORB=ERROR: No ORB registered with the OpenEJB system > Resources= > Resources/index.jsp=<file> > Resources/META-INF= > Resources/META-INF/context.xml=<file> > Resources/META-INF/MANIFEST.MF=<file> > Resources/WEB-INF= > Resources/WEB-INF/classes= > Resources/WEB-INF/classes/.netbeans_automatic_build=<file> > Resources/WEB-INF/classes/.netbeans_update_resources=<file> > Resources/WEB-INF/classes/mauro= > Resources/WEB-INF/classes/mauro/ejb= > Resources/WEB-INF/classes/mauro/ejb/Mauroejb.class=<file> > Resources/WEB-INF/classes/mauro/ejb/MauroInterfacciaejb.class=<file> > Resources/WEB-INF/classes/mauro/srv= > Resources/WEB-INF/classes/mauro/srv/Servlet2.class=<file> > Resources/WEB-INF/classes/org= > Resources/WEB-INF/classes/org/superbiz= > Resources/WEB-INF/classes/org/superbiz/servlet= > Resources/WEB-INF/classes/org/superbiz/servlet/JndiServlet.class=<file> > Resources/WEB-INF/web.xml=<file> > > TransactionManager=org.apache.geronimo.transaction.manager.GeronimoTransactionManager@192d7d0 > > TransactionSynchronizationRegistry=org.apache.geronimo.transaction.manager.GeronimoTransactionManager@192d7d0 > > UserTransaction=org.apache.geronimo.transaction.manager.GeronimoTransactionManager@192d7d0 > Validator=org.apache.bval.jsr303.ClassValidator@1201ad7 > ValidatorFactory=org.apache.bval.jsr303.ApacheValidatorFactory@c25346 > > --------------- > but i have looked the java:comp/ on tomee and i have get the resul above. > > but i have noted: > > JNDI Context: > BeanManager=org.apache.webbeans.container.InjectableBeanManager@23a8ef > ComponentName=Ejbsutomee > env= > env/comp= > env/comp/BeanManager=ERROR: Name "Resource/comp/BeanManager" not found. > env/comp/ComponentName=Ejbsutomee > > env/comp/TransactionManager=org.apache.geronimo.transaction.manager.GeronimoTransactionManager@192d7d0 > > env/comp/TransactionSynchronizationRegistry=org.apache.geronimo.transaction.manager.GeronimoTransactionManager@192d7d0 > * env/comp/Validator=ERROR: Name "Resource/comp/Validator" not found. > env/comp/ValidatorFactory=ERROR: Name "Resource/comp/ValidatorFactory" not > found. > env/module= > env/module/ModuleName=Ejbsutomee > HandleDelegate=ERROR: No HandleDelegate registered with the OpenEJB system > ORB=ERROR: No ORB registered with the OpenEJB system* > > ..... > no ORB registred?? > ----------------------------------------- > > last i have into the tomee to list the context: java:global/ > > and i have get (from the servlet deployed on tomee and not into tomcat > client) > > JNDI Context: > Ejbsutomee= > > Ejbsutomee/Mauroejb=proxy=mauro.ejb.MauroInterfacciaejb;deployment=Mauroejb;pk=null > > Ejbsutomee/Mauroejb!mauro.ejb.MauroInterfacciaejb=proxy=mauro.ejb.MauroInterfacciaejb;deployment=Mauroejb;pk=null > moviefun= > > moviefun/MoviesBean=proxy=org.superbiz.moviefun.MoviesBean;deployment=MoviesBean;pk=null > > moviefun/MoviesBean!org.superbiz.moviefun.MoviesBean=proxy=org.superbiz.moviefun.MoviesBean;deployment=MoviesBean;pk=null > movies-complete= > openejb= > > openejb/MEJB=proxy=javax.management.j2ee.Management;deployment=MEJB;pk=null > > openejb/MEJB!javax.management.j2ee.ManagementHome=proxy=javax.management.j2ee.Management;deployment=MEJB;pk=null > openejb/openejb= > > openejb/openejb/ConfigurationInfo=proxy=org.apache.openejb.assembler.classic.cmd.ConfigurationInfo;deployment=openejb/ConfigurationInfo;pk=null > > openejb/openejb/ConfigurationInfo!org.apache.openejb.assembler.classic.cmd.ConfigurationInfo=proxy=org.apache.openejb.assembler.classic.cmd.ConfigurationInfo;deployment=openejb/ConfigurationInfo;pk=null > > openejb/openejb/Deployer=proxy=org.apache.openejb.assembler.Deployer;deployment=openejb/Deployer;pk=null > > openejb/openejb/Deployer!org.apache.openejb.assembler.Deployer=proxy=org.apache.openejb.assembler.Deployer;deployment=openejb/Deployer;pk=null > > openejb/openejb/User=proxy=org.apache.openejb.assembler.util.User;deployment=openejb/User;pk=null > > openejb/openejb/User!org.apache.openejb.assembler.util.User=proxy=org.apache.openejb.assembler.util.User;deployment=openejb/User;pk=null > simple-singleton= > > simple-singleton/ComponentRegistry=proxy=org.superbiz.registry.ComponentRegistry;deployment=ComponentRegistry;pk=null > > simple-singleton/ComponentRegistry!org.superbiz.registry.ComponentRegistry=proxy=org.superbiz.registry.ComponentRegistry;deployment=ComponentRegistry;pk=null > > simple-singleton/PropertyRegistry=proxy=org.superbiz.registry.PropertyRegistry;deployment=PropertyRegistry;pk=null > > simple-singleton/PropertyRegistry!org.superbiz.registry.PropertyRegistry=proxy=org.superbiz.registry.PropertyRegistry;deployment=PropertyRegistry;pk=null > > ................................... > > > > > > > > -- > View this message in context: > http://openejb.979440.n4.nabble.com/call-ejb-remote-not-work-help-me-tp4666948p4667138.html > Sent from the OpenEJB User mailing list archive at Nabble.com.
