You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Marco Mistroni <mm...@gmail.com> on 2006/04/02 17:33:36 UTC
Re: DESPERATE: JBoss EJB3 embeddable container fails under surefire?
Hello,
not sure if anyone is still watchingn this thread, but i managed to run
my tests by bootstrapping jboss microcontainer.......
i have used jboss-embeddable-alpha5 classes for my EJBs.. using maven2
surefire plugin
if anyone is interested, i can send him/her my code
regards
marco
On 3/29/06, Marco Mistroni <mm...@gmail.com> wrote:
>
> Hello,
> my 2 cents....i used this code that worked fine with maven 1.1, didnt
> have time to try it with latest maven due
> to missing jars (that i still have to identify)
>
> EJB3StandaloneBootstrap.boot(null);
> EJB3StandaloneBootstrap.scanClasspath();
>
> // Add all EJBs found in the archive that has this file
> deployer = new EJB3StandaloneDeployer();
> deployer.create();
> deployer.start();
>
>
> hth
> marco
>
>
>
>
>
> On 3/28/06, Chris Richardson <ch...@gmail.com> wrote:
> >
> > Dan,
> >
> > This is what I used:
> >
> > public void setUp() throws Exception {
> > EJB3StandaloneBootstrap.boot(null);
> > deployer = new EJB3StandaloneDeployer();
> > deployer.getDeployDirs().add(makeURLForDir("target/test-classes"));
> >
> > deployer.getDeployDirs().add(makeURLForDir("target/classes"));
> > deployer.create();
> > deployer.start();
> > initialContext = new InitialContext();
> > }
> >
> > private URL makeURLForDir(String dir) throws MalformedURLException,
> > IOException {
> > return new URL("file:///" + new File(dir).getCanonicalPath());
> > }
> >
> > Unfortunately, I can't remember why I coded it this way - just that it
> > worked on what ever version of the microcontainer was available in
> > December.
> > :-)
> >
> > Chris
> >
> >
> > --
> > Enterprise POJO consulting - http://www.chrisrichardson.net
> > Author, POJOs in Action - http://www.manning.com/crichardson
> > Enterprise POJOs blog - http://chris-richardson.blog-city.com
> >
> >
> > On 3/28/06, Dan Greening <greening@bigtribe.com > wrote:
> > >
> > > For what it's worth, I changed the configuration a bit, just in case
> > > Surefire's alteration of the java.class.path was relevant. This code
> > > provides explicit paths to the EJB3 deployer, for the configuration
> > > files and for the location of the EJBs.
> > >
> > > Change EmbeddedEjb3TestCase.startupEmbeddedJboss to be this:
> > >
> > > public static void startupEmbeddedJboss()
> > > {
> > > EJB3StandaloneBootstrap.boot ("target/test-classes");
> > > EJB3StandaloneBootstrap.scanClasspath("target/classes");
> > > }
> > >
> > > It actually CRASHES surefire, I think because of a null pointer
> > > exception in EJB3StandaloneBootstrap.boot. But still runs fine in
> > > eclipse. Don't know what the problem is, but it seems like a bug in
> > > Surefire.
> > >
> > > I updated SUREFIRE-38 to document this.
> > >
> > > By the way, thank you to Chris Richardson and Carlos Sanchez for
> > > their interest in this problem. I think it is well worthwhile to
> > > make sure Surefire works properly with EJB3 embeddable testing. Once
> > > EJB3 is finalized, people are going to be using embeddable containers
> > > for unit testing, because it is awesome.
> > >
> > > If I am unable to get this to work, is there an alternate tester I
> > > could use that works like the old Maven 1 junit tester? It is, I
> > > believe, the only hurdle remaining for me to migrate to Maven 2.
> > >
> > > Dan R. Greening, Ph.D., CEO BigTribe Corporation, http://
> > > dan.greening.name/contact.htm
> > >
> > >
> > > On Mar 28, 2006, at 8:08 AM, Dan Greening wrote:
> > >
> > > > I appreciate that many people tried to help out with suggestions,
> > > > but none of them seemed to work.
> > > >
> > > > I have created a test case that shows how the JUnit test fails
> > > > under Surefire (with Maven 2.0.3), and succeeds in Eclipse using
> > > > Maven 2.0.3's eclipse:eclipse, both using the same pom.xml. The
> > > > test case and detailed instructions are attached to JIRA ticket
> > > > SUREFIRE-38. The problem may be related to the fact that Surefire
> > > > resets the java.class.path so EJB3 embeddable container cannot find
> > > > the annotations. I may test this hypothesis today.
> > > >
> > > > I have spent many days on this problem, mainly because I want to
> > > > convert our EJB3 application from Maven 1.0.2 to Maven 2. I also
> > > > contributed a fix to the Maven 2 ejb plugin, which is required to
> > > > build EJB3 components. Sure could use some help on this.
> > > >
> > > > Dan R. Greening, Ph.D., CEO BigTribe Corporation, http://
> > > > dan.greening.name/contact.htm
> > > >
> > > >
> > > > On Mar 19, 2006, at 11:16 AM, Dan Greening wrote:
> > > >
> > > >> I am pulling my hair out.
> > > >>
> > > >> If you have gotten maven2 surefire plugin (or anything else) to
> > > >> initiate a JBoss EJB3 embeddable container, I am desperate for
> > > >> your POM.
> > > >>
> > > >> I am trying very hard to get the JBoss EJB3 embeddable container
> > > >> to operate under the surefire-plugin, under the test phase. I
> > > >> cannot, for the life of me, get it to find the InitialContext.
> > > >> I've set the system properties properly, and I even have a
> > > >> duplicated it in jndi.properties. My configuration works under
> > > >> maven1, but not maven2.
> > > >>
> > > >> I think it could be caused by one of two things. Either
> > > >>
> > > >> a. The surefire plugin isolated classloader is making it
> > > >> impossible for the embeddable container to find the annotated
> > > >> classes.
> > > >>
> > > >> b. I have screwed up my POM somehow.
> > > >>
> > > >> If all you tell me is "yes, I have gotten the JBoss EJB3
> > > >> embeddable container to run and see my classes under surefire",
> > > >> you will have done me a favor, because that would indicate it is
> > > >> possible. However, it would be really nice if you would also send
> > > >> your POM so I could understand your configuration.
> > > >>
> > > >> Seriously, this has been driving me nuts for days, so I could
> > > >> really use the help.
> > > >>
> > > >> Dan R. Greening, Ph.D., CEO BigTribe Corporation, http://
> > > >> dan.greening.name/contact.htm
> > > >>
> > > >>
> > > >
> > >
> > >
> > >
> >
> >
>
Re: DESPERATE: JBoss EJB3 embeddable container fails under surefire?
Posted by Subhash Chandran <su...@gmail.com>.
I am very much interested in the code. Can u send it accross to me, or
better still, put it in some HTTP accessible location from where we can get
it.
Regards,
Subhash.
On 4/2/06, Marco Mistroni <mm...@gmail.com> wrote:
>
> Hello,
> not sure if anyone is still watchingn this thread, but i managed to run
> my tests by bootstrapping jboss microcontainer.......
>
> i have used jboss-embeddable-alpha5 classes for my EJBs.. using maven2
> surefire plugin
>
> if anyone is interested, i can send him/her my code
>
> regards
> marco
>
> On 3/29/06, Marco Mistroni <mm...@gmail.com> wrote:
> >
> > Hello,
> > my 2 cents....i used this code that worked fine with maven 1.1, didnt
> > have time to try it with latest maven due
> > to missing jars (that i still have to identify)
> >
> > EJB3StandaloneBootstrap.boot(null);
> > EJB3StandaloneBootstrap.scanClasspath();
> >
> > // Add all EJBs found in the archive that has this file
> > deployer = new EJB3StandaloneDeployer();
> > deployer.create();
> > deployer.start();
> >
> >
> > hth
> > marco
> >
> >
> >
> >
> >
> > On 3/28/06, Chris Richardson <ch...@gmail.com> wrote:
> > >
> > > Dan,
> > >
> > > This is what I used:
> > >
> > > public void setUp() throws Exception {
> > > EJB3StandaloneBootstrap.boot(null);
> > > deployer = new EJB3StandaloneDeployer();
> > > deployer.getDeployDirs
> ().add(makeURLForDir("target/test-classes"));
> > >
> > > deployer.getDeployDirs().add(makeURLForDir("target/classes"));
> > > deployer.create();
> > > deployer.start();
> > > initialContext = new InitialContext();
> > > }
> > >
> > > private URL makeURLForDir(String dir) throws
> MalformedURLException,
> > > IOException {
> > > return new URL("file:///" + new File(dir).getCanonicalPath());
> > > }
> > >
> > > Unfortunately, I can't remember why I coded it this way - just that
> it
> > > worked on what ever version of the microcontainer was available in
> > > December.
> > > :-)
> > >
> > > Chris
> > >
> > >
> > > --
> > > Enterprise POJO consulting - http://www.chrisrichardson.net
> > > Author, POJOs in Action - http://www.manning.com/crichardson
> > > Enterprise POJOs blog - http://chris-richardson.blog-city.com
> > >
> > >
> > > On 3/28/06, Dan Greening <greening@bigtribe.com > wrote:
> > > >
> > > > For what it's worth, I changed the configuration a bit, just in case
> > > > Surefire's alteration of the java.class.path was relevant. This
> code
> > > > provides explicit paths to the EJB3 deployer, for the configuration
> > > > files and for the location of the EJBs.
> > > >
> > > > Change EmbeddedEjb3TestCase.startupEmbeddedJboss to be this:
> > > >
> > > > public static void startupEmbeddedJboss()
> > > > {
> > > > EJB3StandaloneBootstrap.boot ("target/test-classes");
> > > > EJB3StandaloneBootstrap.scanClasspath("target/classes");
> > > > }
> > > >
> > > > It actually CRASHES surefire, I think because of a null pointer
> > > > exception in EJB3StandaloneBootstrap.boot. But still runs fine in
> > > > eclipse. Don't know what the problem is, but it seems like a bug in
> > > > Surefire.
> > > >
> > > > I updated SUREFIRE-38 to document this.
> > > >
> > > > By the way, thank you to Chris Richardson and Carlos Sanchez for
> > > > their interest in this problem. I think it is well worthwhile to
> > > > make sure Surefire works properly with EJB3 embeddable
> testing. Once
> > > > EJB3 is finalized, people are going to be using embeddable
> containers
> > > > for unit testing, because it is awesome.
> > > >
> > > > If I am unable to get this to work, is there an alternate tester I
> > > > could use that works like the old Maven 1 junit tester? It is, I
> > > > believe, the only hurdle remaining for me to migrate to Maven 2.
> > > >
> > > > Dan R. Greening, Ph.D., CEO BigTribe Corporation, http://
> > > > dan.greening.name/contact.htm
> > > >
> > > >
> > > > On Mar 28, 2006, at 8:08 AM, Dan Greening wrote:
> > > >
> > > > > I appreciate that many people tried to help out with suggestions,
> > > > > but none of them seemed to work.
> > > > >
> > > > > I have created a test case that shows how the JUnit test fails
> > > > > under Surefire (with Maven 2.0.3), and succeeds in Eclipse using
> > > > > Maven 2.0.3's eclipse:eclipse, both using the same pom.xml. The
> > > > > test case and detailed instructions are attached to JIRA ticket
> > > > > SUREFIRE-38. The problem may be related to the fact that Surefire
> > > > > resets the java.class.path so EJB3 embeddable container cannot
> find
> > > > > the annotations. I may test this hypothesis today.
> > > > >
> > > > > I have spent many days on this problem, mainly because I want to
> > > > > convert our EJB3 application from Maven 1.0.2 to Maven 2. I also
> > > > > contributed a fix to the Maven 2 ejb plugin, which is required to
> > > > > build EJB3 components. Sure could use some help on this.
> > > > >
> > > > > Dan R. Greening, Ph.D., CEO BigTribe Corporation, http://
> > > > > dan.greening.name/contact.htm
> > > > >
> > > > >
> > > > > On Mar 19, 2006, at 11:16 AM, Dan Greening wrote:
> > > > >
> > > > >> I am pulling my hair out.
> > > > >>
> > > > >> If you have gotten maven2 surefire plugin (or anything else) to
> > > > >> initiate a JBoss EJB3 embeddable container, I am desperate for
> > > > >> your POM.
> > > > >>
> > > > >> I am trying very hard to get the JBoss EJB3 embeddable container
> > > > >> to operate under the surefire-plugin, under the test phase. I
> > > > >> cannot, for the life of me, get it to find the InitialContext.
> > > > >> I've set the system properties properly, and I even have a
> > > > >> duplicated it in jndi.properties. My configuration works under
> > > > >> maven1, but not maven2.
> > > > >>
> > > > >> I think it could be caused by one of two things. Either
> > > > >>
> > > > >> a. The surefire plugin isolated classloader is making it
> > > > >> impossible for the embeddable container to find the annotated
> > > > >> classes.
> > > > >>
> > > > >> b. I have screwed up my POM somehow.
> > > > >>
> > > > >> If all you tell me is "yes, I have gotten the JBoss EJB3
> > > > >> embeddable container to run and see my classes under surefire",
> > > > >> you will have done me a favor, because that would indicate it is
> > > > >> possible. However, it would be really nice if you would also
> send
> > > > >> your POM so I could understand your configuration.
> > > > >>
> > > > >> Seriously, this has been driving me nuts for days, so I could
> > > > >> really use the help.
> > > > >>
> > > > >> Dan R. Greening, Ph.D., CEO BigTribe Corporation, http://
> > > > >> dan.greening.name/contact.htm
> > > > >>
> > > > >>
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
>