The file is called openejb.properties and I load them with spring before instantiation of InitialContext. All parameters pass along fine, since all servers are started correctly and all ejb are instantiated also.
If I telnet to openejb I can see all the naming contexts (openejb, comp, comp/env). But connecting to it thru ejbd I only see the queue message destination bean and the stateless session bean. Also on LocalInitialContextFactory InitialContext instance(at the server side), I only see the same ejbs. I did do a breakpoint exception at nullpointer, and a bunch of nullpointerexceptions occur, a lot of them are expected too (I can tell because of comments). Maybe in version 3.1.2 something was screwed up. meetoblivion wrote: > > Sounds like an error in your jndi.properties. Based on your other > comment, > could be something to do with classloading as well. > > Can you post a bit more sample code? > > Something like this: > > new InitialContext().lookup("java:openejb/Resource/mySqlDatabase"); > > Will be unlikely to work unless you specify everything correctly in > jndi.properties. To force loading jndi.properties, I end up doing > something > like this: > > p.load(new FileInputStream(jndiFile)); > InitialContext ic = new InitialContext(p); > > The second line here is the IC that actually creates the openejb server, > at > least in my case (embedded). Are you doing unit testing? Embedded? Tomcat > based? As long as I invoke against that IC it's fine. In my EJBs I do > have > EJBContext for looking up objects. > > - John > > On Sun, Nov 29, 2009 at 10:48 AM, Cae Fernandes <rag...@gmail.com> wrote: > >> >> Doesn`t work either. >> name "mySqlDatabase" not found. >> >> This works (though not ideal): >> >> @Resource(name = "mySqlDatabase") >> private DataSource dataSource; >> >> >> meetoblivion wrote: >> > >> > Hi >> > >> > What if you just lookup >> > >> > this.context.lookup("mySqlDatabase"); >> > >> > ? >> > >> > On Sun, Nov 29, 2009 at 6:56 AM, Cae Fernandes <rag...@gmail.com> >> wrote: >> > >> >> >> >> Can't lookup openejb context so I can hardly lookup anything actually. >> >> Help? >> >> >> >> properties: >> >> >> >> >> >> >> java.naming.factory.initial=org.apache.openejb.client.LocalInitialContextFactory >> >> openejb.embedded=true >> >> openejb.embedded.remotable=true >> >> openejb.jndiname.format={ejbName} >> >> openejb.descriptors.output=true >> >> openejb.validation.output.level=verbose >> >> log4j.category.OpenEJB=INFO >> >> log4j.category.OpenEJB.options=INFO >> >> log4j.category.OpenEJB.startup=INFO >> >> log4j.category.OpenEJB.server=INFO >> >> log4j.category.OpenEJB.server.remote=INFO >> >> log4j.category.OpenEJB.startup.service=INFO >> >> log4j.category.OpenEJB.startup.config=INFO >> >> log4j.category.org.apache.activemq=INFO >> >> log4j.category.org.apache.geronimo=INFO >> >> log4j.category.openjpa=INFO >> >> log4j.category.Transaction=INFO >> >> hsql.disabled=true >> >> httpejbd.disabled=true >> >> telnet.disabled=true >> >> admin.disabled=true >> >> ejbd.disabled=false >> >> ejbd.bind=127.0.0.1 >> >> ejbd.server=org.apache.openejb.server.ejbd.EjbServer >> >> ejbd.port=4201 >> >> Default\ JMS\ Resource\ Adapter.ServerUrl=tcp://localhost:61616 >> >> Default\ JMS\ Resource\ >> >> Adapter.BrokerXmlConfig=broker:(tcp://localhost:61616)?useJmx=false >> >> openejb.deployments.classpath.include=.*/WEB-INF/classes/.* >> >> openejb.deployments.classpath.exclude=.* >> >> mySqlDatabase=new://Resource?type=DataSource >> >> mySqlDatabase.JdbcDriver=com.mysql.jdbc.Driver >> >> mySqlDatabase.JdbcUrl=jdbc:mysql://localhost:3306/noc >> >> mySqlDatabase.JtaManaged=true >> >> mySqlDatabase.UserName=nextview >> >> mySqlDatabase.Password=nxt >> >> mySqlDatabase.MaxIdle=20 >> >> mySqlDatabase.MaxActive=20 >> >> mySqlDatabase.DefaultAutoCommit=true >> >> mySqlDatabase.AccessToUnderlyingConnectionAllowed=true >> >> mySqlDatabase.InitialSize=20 >> >> >> >> output: >> >> >> >> Apache OpenEJB 3.1.2 build: 20091010-03:11 >> >> http://openejb.apache.org/ >> >> INFO - >> >> >> >> >> ******************************************************************************** >> >> OpenEJB http://openejb.apache.org/ >> >> Startup: 11/29/09 9:56 AM >> >> Copyright 1999-2008 (C) Apache OpenEJB Project, All Rights Reserved. >> >> Version: 3.1.2 >> >> Build date: 20091010 >> >> Build time: 03:11 >> >> >> >> >> ******************************************************************************** >> >> >> >> >> >> INFO - openejb.home = C:\galileo\eclipse >> >> INFO - openejb.base = C:\galileo\eclipse >> >> INFO - Cannot find the configuration file [conf/openejb.xml]. Will >> >> attempt >> >> to create one for the beans deployed. >> >> INFO - Configuring Service(id=Default Security Service, >> >> type=SecurityService, provider-id=Default Security Service) >> >> INFO - Configuring Service(id=Default Transaction Manager, >> >> type=TransactionManager, provider-id=Default Transaction Manager) >> >> INFO - Configuring Service(id=mySqlDatabase, type=Resource, >> >> provider-id=Default JDBC Database) >> >> INFO - Using >> >> 'openejb.deployments.classpath.include=.*/WEB-INF/classes/.*' >> >> INFO - Using 'openejb.deployments.classpath.exclude=.*' >> >> INFO - Found EjbModule in classpath: >> >> >> >> >> C:\geradores\noc\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Noc-WarEjb\WEB-INF\classes >> >> INFO - Found ClientModule in classpath: >> >> C:\servers\apache-tomcat-6.0.20\bin\bootstrap.jar >> >> INFO - Found ClientModule in classpath: >> >> >> >> >> C:\geradores\noc\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Noc-WarEjb\WEB-INF\lib\xml-resolver-1.2.jar >> >> INFO - Beginning load: >> >> >> >> >> C:\geradores\noc\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Noc-WarEjb\WEB-INF\classes >> >> INFO - Beginning load: >> C:\servers\apache-tomcat-6.0.20\bin\bootstrap.jar >> >> INFO - Beginning load: >> >> >> >> >> C:\geradores\noc\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Noc-WarEjb\WEB-INF\lib\xml-resolver-1.2.jar >> >> INFO - Configuring enterprise application: classpath.ear >> >> INFO - Auto-deploying ejb MessagePool: >> >> EjbDeployment(deployment-id=MessagePool) >> >> INFO - Auto-deploying ejb MessageReceiver: >> >> EjbDeployment(deployment-id=MessageReceiver) >> >> INFO - Configuring Service(id=Default Stateless Container, >> >> type=Container, >> >> provider-id=Default Stateless Container) >> >> INFO - Auto-creating a container for bean MessagePool: >> >> Container(type=STATELESS, id=Default Stateless Container) >> >> INFO - Configuring Service(id=Default MDB Container, type=Container, >> >> provider-id=Default MDB Container) >> >> INFO - Auto-creating a container for bean MessageReceiver: >> >> Container(type=MESSAGE, id=Default MDB Container) >> >> INFO - Configuring Service(id=Default JMS Resource Adapter, >> >> type=Resource, >> >> provider-id=Default JMS Resource Adapter) >> >> INFO - Configuring Service(id=Default JMS Connection Factory, >> >> type=Resource, >> >> provider-id=Default JMS Connection Factory) >> >> INFO - Auto-creating a Resource with id 'Default JMS Connection >> Factory' >> >> of >> >> type 'javax.jms.ConnectionFactory for 'MessageReceiver'. >> >> INFO - Auto-linking resource-ref >> >> 'br.com.noc.ejb.MessageReceiver/connectionFactory' in bean >> >> MessageReceiver >> >> to Resource(id=Default JMS Connection Factory) >> >> INFO - Auto-linking resource-ref >> >> 'br.com.noc.ejb.MessageReceiver/dataSource' >> >> in bean MessageReceiver to Resource(id=mySqlDatabase) >> >> INFO - Configuring Service(id=MessageReceiver, type=Resource, >> >> provider-id=Default Queue) >> >> INFO - Auto-creating a Resource with id 'MessageReceiver' of type >> >> 'javax.jms.Queue for 'MessageReceiver'. >> >> INFO - Using 'openejb.descriptors.output=true' >> >> INFO - Using 'openejb.descriptors.output=true' >> >> INFO - Dumping Generated ejb-jar.xml to: >> >> C:\DOCUME~1\Cae\LOCALS~1\Temp\ejb-jar-5441164056184778307classes.xml >> >> INFO - Dumping Generated openejb-jar.xml to: >> >> >> C:\DOCUME~1\Cae\LOCALS~1\Temp\openejb-jar-2736192197881294481classes.xml >> >> INFO - Using 'openejb.validation.output.level=VERBOSE' >> >> INFO - Enterprise application "classpath.ear" loaded. >> >> INFO - Creating TransactionManager(id=Default Transaction Manager) >> >> INFO - Creating SecurityService(id=Default Security Service) >> >> INFO - Creating Resource(id=mySqlDatabase) >> >> INFO - Creating Resource(id=Default JMS Resource Adapter) >> >> INFO - ActiveMQ 4.1.1 JMS Message Broker (localhost) is starting >> >> INFO - For help or more information please see: >> >> http://incubator.apache.org/activemq/ >> >> INFO - Listening for connections at: tcp://mybeats-032a882:61616 >> >> INFO - Connector tcp://mybeats-032a882:61616 Started >> >> INFO - ActiveMQ JMS Message Broker (localhost, >> >> ID:mybeats-032a882-1472-1259495772671-0:0) started >> >> INFO - Creating Resource(id=Default JMS Connection Factory) >> >> INFO - Creating ConnectionManager for Resource(id=Default JMS >> Connection >> >> Factory) >> >> INFO - Creating Resource(id=MessageReceiver) >> >> INFO - Creating Container(id=Default Stateless Container) >> >> INFO - Creating Container(id=Default MDB Container) >> >> INFO - Assembling app: classpath.ear >> >> INFO - Using 'openejb.jndiname.format={ejbName}' >> >> INFO - Jndi(name=MessagePool) --> Ejb(deployment-id=MessagePool) >> >> INFO - Jndi(name=MessageReceiver) --> >> Ejb(deployment-id=MessageReceiver) >> >> INFO - Created Ejb(deployment-id=MessagePool, ejb-name=MessagePool, >> >> container=Default Stateless Container) >> >> INFO - Created Ejb(deployment-id=MessageReceiver, >> >> ejb-name=MessageReceiver, >> >> container=Default MDB Container) >> >> INFO - Deployed Application(path=classpath.ear) >> >> INFO - Starting network services >> >> Nov 29, 2009 9:56:13 AM >> org.apache.cxf.bus.spring.BusApplicationContext >> >> getConfigResources >> >> INFO: No cxf.xml configuration file detected, relying on defaults. >> >> ** Starting Services ** >> >> NAME IP PORT >> >> ejbd 127.0.0.1 4201 >> >> ------- >> >> Ready! >> >> 1: Name openejb is not bound in this Context >> >> 2: Name openejb is not bound in this Context >> >> >> >> code: >> >> >> >> try { >> >> >> >> this.context.lookup("java:openejb/Resource/mySqlDatabase"); >> >> new >> >> InitialContext().lookup("java:openejb/Resource/mySqlDatabase"); >> >> } catch (NamingException ex) { >> >> System.out.println("1: " + ex.getMessage()); >> >> } >> >> >> >> try { >> >> >> >> new >> >> InitialContext().lookup("java:openejb/Resource/mySqlDatabase"); >> >> } catch (NamingException ex) { >> >> System.out.println("2: " + ex.getMessage()); >> >> } >> >> >> >> Enumeration<URL> ejbJars = >> >> >> >> this.getClass().getClassLoader().getResources("META-INF/ejb-jar.xml"); >> >> while (ejbJars.hasMoreElements()) { >> >> URL url = ejbJars.nextElement(); >> >> System.out.println("app = " + url); >> >> } >> >> } // --> CAN'T FIND my ejb-jar.xml at META-INF/ but it's >> there!!!! >> >> >> >> -- >> >> View this message in context: >> >> >> http://old.nabble.com/NamingExpection%3A-Name-openejb-is-not-bound-in-this-Context-tp26560497p26560497.html >> >> Sent from the OpenEJB User mailing list archive at Nabble.com. >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://old.nabble.com/NamingExpection%3A-Name-openejb-is-not-bound-in-this-Context-tp26560497p26563113.html >> Sent from the OpenEJB User mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://old.nabble.com/NamingExpection%3A-Name-openejb-is-not-bound-in-this-Context-tp26560497p26563838.html Sent from the OpenEJB User mailing list archive at Nabble.com.