You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Newgro <pe...@gmx.ch> on 2007/11/09 11:37:37 UTC
Embedded: Tests not found in classpath
Hi *,
i try to run my tests in an embedded environment from within eclipse.
What i'm not understand is that my beans are not deployed.
I setup the test with
/**
* setUp
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
properties.setProperty("openejb.deployments.classpath.include",
".*buma.*");
initialContext = new InitialContext(properties);
System.out.println(System.getProperty("java.class.path"));
}
If i print the class path my "classes" folder is present. In a subfolder of
it my Testclasses and my EJB with Localinterface are present. The
package-name is "de.yhd.buma.backend.usecases".
But in the log i only see
2007-11-09 11:18:30,562 - DEBUG - Using
openejb.deployments.classpath.include '.*buma.*'
2007-11-09 11:18:30,562 - DEBUG - Using
openejb.deployments.classpath.exclude '.*'
2007-11-09 11:18:30,562 - DEBUG - Using
openejb.deployments.classpath.filter.systemapps 'true'
2007-11-09 11:18:30,562 - DEBUG - Using
openejb.deployments.classpath.filter.descriptors 'false'
2007-11-09 11:18:30,562 - DEBUG - Using
openejb.deployments.classpath.require.descriptor 'false'
2007-11-09 11:18:30,625 - DEBUG - Inspecting classpath for applications: 1
urls.
2007-11-09 11:18:31,170 - DEBUG - URLs after filtering: 156
... (the openejb jars)
2007-11-09 11:18:31,186 - DEBUG - Descriptors path:
file:/E:{...}/buma_backend/bin/
2007-11-09 11:18:31,186 - DEBUG - Searched 1 classpath urls in 202
milliseconds. Average 202 milliseconds per url.
2007-11-09 11:18:31,310 - DEBUG - Initialized debug=true
usersFile=users.properties groupsFile=groups.properties
2007-11-09 11:18:31,310 - DEBUG - abort
... (ActiveMQ and db stuff)
My suspicion is that i missed something with the regular expressions for
jar-parsing. But i didn't found any text on the webiste.
I hope someone can bring me the light :-)
Thanks
Per
--
View this message in context: http://www.nabble.com/Embedded%3A-Tests-not-found-in-classpath-tf4776887.html#a13664616
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: Embedded: Tests not found in classpath
Posted by David Blevins <da...@visi.com>.
On Nov 9, 2007, at 2:37 AM, Newgro wrote:
>
> Hi *,
>
> i try to run my tests in an embedded environment from within eclipse.
> What i'm not understand is that my beans are not deployed.
>
> I setup the test with
> /**
> * setUp
> * @throws java.lang.Exception
> */
> @Before
> public void setUp() throws Exception {
> Properties properties = new Properties();
> properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.LocalInitialContextFactory");
> properties.setProperty("openejb.deployments.classpath.include",
> ".*buma.*");
> initialContext = new InitialContext(properties);
> System.out.println(System.getProperty("java.class.path"));
> }
>
> If i print the class path my "classes" folder is present. In a
> subfolder of
> it my Testclasses and my EJB with Localinterface are present. The
> package-name is "de.yhd.buma.backend.usecases".
>
> But in the log i only see
> 2007-11-09 11:18:30,562 - DEBUG - Using
> openejb.deployments.classpath.include '.*buma.*'
> 2007-11-09 11:18:30,562 - DEBUG - Using
> openejb.deployments.classpath.exclude '.*'
> 2007-11-09 11:18:30,562 - DEBUG - Using
> openejb.deployments.classpath.filter.systemapps 'true'
> 2007-11-09 11:18:30,562 - DEBUG - Using
> openejb.deployments.classpath.filter.descriptors 'false'
> 2007-11-09 11:18:30,562 - DEBUG - Using
> openejb.deployments.classpath.require.descriptor 'false'
> 2007-11-09 11:18:30,625 - DEBUG - Inspecting classpath for
> applications: 1
> urls.
> 2007-11-09 11:18:31,170 - DEBUG - URLs after filtering: 156
> ... (the openejb jars)
> 2007-11-09 11:18:31,186 - DEBUG - Descriptors path:
> file:/E:{...}/buma_backend/bin/
> 2007-11-09 11:18:31,186 - DEBUG - Searched 1 classpath urls in 202
> milliseconds. Average 202 milliseconds per url.
> 2007-11-09 11:18:31,310 - DEBUG - Initialized debug=true
> usersFile=users.properties groupsFile=groups.properties
> 2007-11-09 11:18:31,310 - DEBUG - abort
> ... (ActiveMQ and db stuff)
>
> My suspicion is that i missed something with the regular expressions
> for
> jar-parsing. But i didn't found any text on the webiste.
>
> I hope someone can bring me the light :-)
Here's the doc on that functionality http://openejb.apache.org/application-discovery-via-the-classpath.html
The path matching actually works on the file paths in the classpath,
rather than packages in jars (very expensive to crack open 150+ jars
and list every file in them).
My preferred technique is to throw an empty META-INF/ejb-jar.xml file
in as detailed in that doc. It's the most hassle-free, IMHO. Just
remember you have to put it in the same classes folder as the beans
themselves -- if there's a separate path for tests like maven has,
don't put it there.
Hope that helps.
-David