You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by MirekSz <m....@gmail.com> on 2010/04/18 09:59:32 UTC

Deployments dir in embedded

Hello,
I can configure deployments dir in openejb.xml by

<openejb>
...

<Deployments dir="c:\myapp\acmeEjbs" />
</openejb>

but how I can do it via system properties 

Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,org.apache.openejb.client.LocalInitialContextFactory");
properties.put("deployments.dir", "c:\myapp\acmeEjbs");
InitialContext initialContext = new InitialContext(properties);

this is dosen't works

Please help my how to configure.
And second question 
How can I turn off Application discovery via the classpath. Beacause I know
dir of my ejbs??

Best regards
-- 
View this message in context: http://n4.nabble.com/Deployments-dir-in-embedded-tp2014699p2014699.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: Deployments dir in embedded

Posted by David Blevins <da...@visi.com>.
On Apr 19, 2010, at 2:35 PM, Thiago Veronezi wrote:

> try {
> final ClassLoader loader;
> loader = EjbServer.class.getClassLoader();
> Properties prop = new Properties();
> prop.load(loader.getResourceAsStream("jndi.properties"));
>
> //Getting the openejb.xml file
> File openejbXmlFile = FileUtils.getFile(SystemParams.tempFolder,  
> config)
> prop.put("openejb.configuration", openejbXmlFile.getAbsolutePath());
> this.ctx = new InitialContext(prop);
> } catch (Exception e) {
> 	throw new SystemException(e); //My custom exception
> }		

This is cool. Just as a side note, the InitialContext class will go  
looking for jndi.properties files in the classpath and load them.  Try  
without the  
'prop.load(loader.getResourceAsStream("jndi.properties"));' and see if  
it doesn't just magically work.

-David


RE: Deployments dir in embedded

Posted by Thiago Veronezi <Th...@fxinnovation.com>.
Hi, MirekSz.

I had the same problems with my project. I found a solution for it, but
Im using both openejb.xml and jndi.properties

openejb.xml
<?xml version="1.0"?>
<openejb>
	<Deployments dir="ejbs/" /> <!-- relative to my openejb.home
path -->
</openejb>

jndi.properties
java.naming.factory.initial=org.apache.openejb.client.LocalInitialContex
tFactory
openejb.deployments.classpath.filter.descriptors=true
openejb.deployments.classpath.exclude=.*
openejb.deployments.classpath.include=


My startup code.... EjbServer.java...
.
.
.
@Override
public void start() {
.
.
.
try {
final ClassLoader loader;
loader = EjbServer.class.getClassLoader();
Properties prop = new Properties();
prop.load(loader.getResourceAsStream("jndi.properties"));

//Getting the openejb.xml file
File openejbXmlFile = FileUtils.getFile(SystemParams.tempFolder, config)
prop.put("openejb.configuration", openejbXmlFile.getAbsolutePath());
this.ctx = new InitialContext(prop);
} catch (Exception e) {
	throw new SystemException(e); //My custom exception
}		
.
.
.
}

Try it... its working for me.

[]s,
Thiago.

-----Original Message-----
From: MirekSz [mailto:m.szajowski@gmail.com] 
Sent: Sunday, April 18, 2010 4:00 AM
To: dev@openejb.apache.org
Subject: Deployments dir in embedded


Hello,
I can configure deployments dir in openejb.xml by

<openejb>
...

<Deployments dir="c:\myapp\acmeEjbs" />
</openejb>

but how I can do it via system properties 

Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,org.apache.openej
b.client.LocalInitialContextFactory");
properties.put("deployments.dir", "c:\myapp\acmeEjbs");
InitialContext initialContext = new InitialContext(properties);

this is dosen't works

Please help my how to configure.
And second question 
How can I turn off Application discovery via the classpath. Beacause I
know
dir of my ejbs??

Best regards
-- 
View this message in context:
http://n4.nabble.com/Deployments-dir-in-embedded-tp2014699p2014699.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.801 / Virus Database: 271.1.1/2810 - Release Date: 04/19/10
02:31:00