[jboss-user] [EJB/JBoss] - EJB3 Standalone bootstrap questions for the source code avai
shadukan
do-not-reply at jboss.com
Thu May 14 06:37:14 EDT 2009
Hi once again,
i am fighting again with the ejb3 embedded in order to manage and o some unit tests in my ejb3.I downloaded the source form the repository and after trying various workarounds to make that thing to work i have come to the point where i can't understand the reason for some fragments of code.I will provide my bootstrap class code + the fragments of code that i believe are wrong.So:
TestNG class
| EJB3StandaloneBootstrap.boot(null);
| deployer = EJB3StandaloneBootstrap.createDeployer();
|
| System.out.println("INFO ["+EJB3StandaloneBootstrap.class.getCanonicalName()+"]\tServer start up in "+(System.currentTimeMillis() - start)+" ms");
|
| String classpath = System.getProperty("java.class.path");
|
|
| StringTokenizer tokenizer = new StringTokenizer(classpath,":");
|
| while(tokenizer.hasMoreTokens()){
| String token = tokenizer.nextToken();
| if(token.contains("/xxx-app-ejb/target/classes"))
| deployer.getDeployDirs().add(new URL("file:"+token));
| /*if(!token.contains(".jar"))
| deployer.getDeployDirsByResource().add(token);
| else{
| deployer.getArchivesByResource().add(token);
| }*/
| }
|
|
| /*URL url = Thread.currentThread().getContextClassLoader().getResource("META-INF/persistence.xml");
| URL deployDir = EJB3StandaloneDeployer.getDeployDirFromResource(url, "META-INF/persistence.xml");
| deployer.getDeployDirs().add(deployDir);*/
|
| try{
| deployer.create();
| deployer.start();
| }catch(Exception e){
| e.printStackTrace();
| }
|
EJB3StandaloneDeployer.create():
| for (URL archive : archives)
| {
| DeployerUnit du = new DeployerUnit(classLoader, archive, defaultPersistenceProperties, jndiProperties);
| EJB3StandaloneDeployment deployment = new EJB3StandaloneDeployment(du, kernel, mbeanServer);
| deployments.add(deployment);
| deployment.create();
| }
|
EJB3StandaloneDeployment:
| public class EJB3StandaloneDeployment extends Ejb3Deployment
| {
| public EJB3StandaloneDeployment(DeploymentUnit di, Kernel kernel, MBeanServer mbeanServer)
| {
| super(di, null, null, null, null);
|
| defaultSFSBDomain = "Embedded Stateful Bean";
| kernelAbstraction = new MCKernelAbstraction(kernel, mbeanServer);
| this.mbeanServer = mbeanServer;
| }
|
Then i get an deployer is null from the constructor of the super class Ejb3Deployment
and the reason is SO obvious!!!
I think the code of the repository is even more buggy...
any convincing answer on why/how this is solved...So i wonder how can anyone make this thing to work...Unless i will not use dirs BUT jars?Stile it gets to the points of iterating the archives...
regards
\n\m
P.S.:Sorry for the long post
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4231045#4231045
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4231045
More information about the jboss-user
mailing list