You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dan Greening <gr...@bigtribe.com> on 2006/03/19 22:16:50 UTC

DESPERATE: JBoss EJB3 embeddable container fails under surefire?

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 Jacek Laskowski <el...@gmail.com>.
2006/3/19, Dan Greening <gr...@bigtribe.com>:
> I am pulling my hair out.

Before you lose all your hair, could you share what exception/error
message you're getting? I haven't used JBoss and M2, but I don't think
it really matters.

Jacek

--
Jacek Laskowski
http://www.laskowski.org.pl

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


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
> > > > >>
> > > > >>
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
>

Re: DESPERATE: JBoss EJB3 embeddable container fails under surefire?

Posted by Marco Mistroni <mm...@gmail.com>.
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 Marco Mistroni <mm...@gmail.com>.
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 <gr...@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 Chris Richardson <ch...@gmail.com>.
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 <gr...@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 Dan Greening <gr...@bigtribe.com>.
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 Dan Greening <gr...@bigtribe.com>.
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 Marco Mistroni <mm...@gmail.com>.
Hello All,
 i am trying the same.... and what i get?

-------------------------------------------------------------------------------
Battery: example1.EJB3ContainerTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.047 sec

testMethod1(example1.EJB3ContainerTest)  Time elapsed: 0.015 sec  <<< ERROR!

[ stdout ] ---------------------------------------------------------------



[ stderr ] ---------------------------------------------------------------

---- bootstrapping EJB3 container....
...... deploying embedded-jboss-beans....


[ stacktrace ] -----------------------------------------------------------

java.lang.NoClassDefFoundError: org/jboss/logging/Logger
    at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.<clinit>(
EJB3StandaloneDeployer.java:137)


My assumption is that, because i am including microcontainer libraries using
system scope, they don't turn out at test time since
org.jboss.logging.Logger is part of jboss-common.jar whic is CLEARLY listed
as dependency of my pom.xml

here is  my pom (i attach at the end aslo the ejb test class);;

-------- pom.xml ------------
<project>
   <modelVersion>4.0.0</modelVersion>
   <groupId>root</groupId>
   <artifactId>ejbs</artifactId>
   <packaging>jar</packaging>
   <version>1.0</version>
   <name>enterprise java beans</name>
   <parent>
      <groupId>root</groupId>
      <artifactId>project</artifactId>
      <version>1.0</version>
   </parent>
   <pluginRepositories>
         <pluginRepository>
            <id>apache.snapshots</id>
            <url>http://cvs.apache.org/maven-snapshot-repository</url>
         </pluginRepository>
   </pluginRepositories>
   <repositories>
         <repository>
           <id>apache.snapshots</id>
           <url>http://cvs.apache.org/maven-snapshot-repository</url>
         </repository>
   </repositories>
   <dependencies>
      <dependency>
         <groupId>root</groupId>
         <artifactId>shared</artifactId>
      </dependency>
      <dependency>
         <groupId>geronimo-spec</groupId>
         <artifactId>geronimo-spec-j2ee</artifactId>
     <scope>provided</scope>
       </dependency>
       <dependency>
         <groupId>jboss</groupId>
         <artifactId>jboss-ejb3x</artifactId>
         <version>4.0.4</version>
         <scope>system</scope>
         <systemPath>${basedir}\lib\jboss-ejb3x-4.0.4.jar</systemPath>
      </dependency>
      <dependency>
         <groupId>jboss</groupId>
         <artifactId>ejb3-persistence</artifactId>
         <version>4.0.4</version>
         <scope>system</scope>
         <systemPath>${basedir}\lib\ejb3-persistence-4.0.4.jar</systemPath>
      </dependency>
      <dependency>
         <groupId>org.testng</groupId>
         <artifactId>testng</artifactId>
         <version>4.6.1</version>
         <scope>test</scope>
         <classifier>jdk15</classifier>
      </dependency>


      <!-- JBoss Microcontainer dependencies (for tests)-->

      <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>asm</artifactId>
            <version>current</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\asm-current.jar</systemPath>

      </dependency>
      <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>asm</artifactId>
           <version>attrs</version>
           <scope>system</scope>
           <systemPath>${basedir}\microcontainer\jars\asm-attrs.jar
</systemPath>
      </dependency>
      <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>cglib</artifactId>
           <version>2.1.1</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\cglib-2.1.1.jar
</systemPath>
      </dependency>


      <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>commons</artifactId>
           <version>collections</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\commons-collections.jar</systemPath>

      </dependency>
      <dependency>
          <groupId>microcontainer</groupId>
          <artifactId>commons</artifactId>
          <version>logging</version>
          <scope>system</scope>
          <systemPath>${basedir}\microcontainer\jars\commons-logging.jar</systemPath>

       </dependency>
       <dependency>
          <groupId>microcontainer</groupId>
          <artifactId>commons</artifactId>
          <version>logging-api</version>
          <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\commons-logging-api.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>hsqldb</artifactId>
           <version>current</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\hsqldb-current.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss-annotations</artifactId>
           <version>ejb3</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-
annotations-ejb3.jar</systemPath>
       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss-aop</artifactId>
           <version>jdk50</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-aop-jdk50.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss-aspect-library</artifactId>
         <version>jdk50</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-
aspect-library-jdk50.jar</systemPath>
       </dependency>

       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>common</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-common.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss-common</artifactId>
           <version>jdbc-wrapper</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-
common-jdbc-wrapper.jar</systemPath>
       </dependency>
       <dependency>
            <groupId>microcontainer</groupId>
            <artifactId>jboss</artifactId>
            <version>concurrent</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-concurrent.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss</artifactId>
           <version>container</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-container.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss</artifactId>
           <version>current</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-current.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>dependency</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-dependency.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>ejb3</version>
         <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-ejb3.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>j2ee</version>
         <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-j2ee.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>j2se</version>
         <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-j2se.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>jca</version>
         <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-jca.jar</systemPath>
       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss-local</artifactId>
         <version>jdbc</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-local-jdbc.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss</artifactId>
           <version>microcontainer</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-microcontainer.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jbossmq</artifactId>
           <version>current</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jbossmq-current.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss</artifactId>
           <version>namespace</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-namespace.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>remoting</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-remoting.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jbosssx</artifactId>
           <version>current</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jbosssx-current.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss</artifactId>
           <version>system</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-system.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss</artifactId>
           <version>transaction</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-transaction.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss-xa</artifactId>
           <version>jdbc</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-xa-jdbc.jar</systemPath>

       </dependency>
       <dependency>
            <groupId>microcontainer</groupId>
            <artifactId>jnpserver</artifactId>
            <version>current</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jnpserver-current.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>log4j</artifactId>
           <version>current</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\log4j-current.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>resolver</artifactId>
         <version>current</version>
         <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\resolver-current.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>trove</artifactId>
           <version>current</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\trove-current.jar</systemPath>

       </dependency>
       <dependency>
            <groupId>microcontainer</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>jboss</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\xercesImpl-jboss.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>xml-apis</artifactId>
           <version>jboss</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\xml-apis-jboss.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>hibernate</artifactId>
         <version>3</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\hibernate-3.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>hibernate</artifactId>
           <version>entitymanager</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\hibernate-entitymanager.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>hibernate</artifactId>
           <version>annotations</version>
            <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\hibernate-
annotations.jar</systemPath>
       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>dom4j</artifactId>
           <version>current</version>
            <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\dom4j-current.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>javassist</artifactId>
         <version>current</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\javassist-current.jar</systemPath>

       </dependency>
        <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>ehcache</artifactId>
           <version>1.1</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\ehcache-1.1.jar</systemPath>

    </dependency>
    <dependency>
               <groupId>microcontainer</groupId>
               <artifactId>jboss</artifactId>
               <version>ejb3</version>
               <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-ejb3.jar</systemPath>

    </dependency>
   </dependencies>
   <build>
      <plugins>


         <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
               <encoding>iso-8859-1</encoding>
            </configuration>
         </plugin>




         <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
         <suiteXmlFiles><suiteXmlFile>testng.xml
</suiteXmlFile></suiteXmlFiles>
        </configuration>
       </plugin>


        <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
         <executions>
           <execution>
             <phase>generate-sources</phase>
                 <configuration>
                   <tasks>
                   </tasks>
                 </configuration>
                 <goals>
                   <goal>run</goal>
                 </goals>
               </execution>
             </executions>
         </plugin>
      </plugins>
   </build>
</project>


----------------

and here's my test, whic does not test anything so far but it is supposed to
be the
base class for every test

------ EJB3 test -------
/**
 * Boots the JBoss Microcontainer with an EJB3 configuration.
 * <p>
 * You can also use this class to lookup managed beans from JNDI.
 *
 * @author christian.bauer@jboss.com
 */
public class EJB3ContainerTest extends TestCase{

    private static InitialContext initialContext;
    private EJB3StandaloneDeployer deployer;

    public void setUp() {
        try {

        System.err.println("---- bootstrapping EJB3 container....");

            // Boot the JBoss Microcontainer with EJB3 settings, loads
ejb3-interceptors-aop.xml
            EJB3StandaloneBootstrap.boot(null);
            System.err.println("...... deploying embedded-jboss-beans....");
            // Deploy CaveatEmptor beans (datasource, mostly)
            //EJB3StandaloneBootstrap.deployXmlResource("/embedded-
jboss-beans.xml");
            //EJB3StandaloneBootstrap.deployXmlResource("/embedded-
jboss-beans.xml");
            //EJB3StandaloneBootstrap.deployXmlResource("/embedded-
jboss-beans.xml");
        EJB3StandaloneBootstrap.scanClasspath();

        System.err.println("...... embedded-jboss-beans deployed....");
        // Add all EJBs found in the archive that has this file
        deployer = new EJB3StandaloneDeployer();

        System.err.println("...... deploying MM ejb3.....");
        System.err.println("...... ejb3 deployed....");
        // Deploy everything we got
        deployer.create();
        System.err.println("...... deployer created....");

        deployer.start();
        System.err.println("...... deployer started....");

        // Create InitialContext from jndi.properties
        initialContext = new InitialContext();


        System.err.println("---- end of bootstrapping EJB3 container....");

        } catch (Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
    }





    public void tearDown() {
        try {
            System.err.println("---- Invoking EJB3.shutdown..");
            deployer.stop();
            deployer.destroy();
            EJB3StandaloneBootstrap.shutdown();
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }


    public void testMethod1() {
        System.err.println("EJB3CONTAINER.....  TESTING1");
    }


     public static Test suite() {
          return new TestSuite(EJB3ContainerTest.class);
    }



    public static Object lookup(String beanName) {
        try {
            return initialContext.lookup(beanName);
        } catch (NamingException ex) {
            throw new RuntimeException("Couldn't lookup: " + beanName, ex);
        }
    }
}

i have successfully used testng plugin wtih maven1.1 but with maven2 it
looks like plugin has some bugs.....

anyone could help me out starting from this pom & test?

thanks and regards
 marco

Re: DESPERATE: JBoss EJB3 embeddable container fails under surefire?

Posted by Carlos Sanchez <ca...@apache.org>.
You can try to set <childDelegation>true</childDelegation> in the
surefire plugin configuration

On 3/21/06, Chris Richardson <ch...@gmail.com> wrote:
> Pete
>
> You can download the source code for my book, which includes the POMs etc,
> from: http://www.manning.com/crichardson
> The embedded EJB 3 container looks like a good way to easily test EJB3
> session beans- avoids having to fire up the fullblown server.
>
> 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/20/06, Pete <pe...@gmail.com> wrote:
> >
> > Chris  or Dan,
> >
> > Just wondered if you could share your POM and testing approach with me ,
> > I'm
> > looking to test JBoss EJB3 EJBs using surefire or testNG, so I am
> > wondering
> > what the options are, and how this emedded EJB3 container works /  fits in
> > ?
> >
> > Pete
> >
> > On 19/03/06, Chris Richardson <ch...@gmail.com> wrote:
> > >
> > > Dan,
> > >
> > > I also had a problem using maven2 to run the EJB3/JBoss microcontainer
> > > tests
> > > for the example from my book.
> > > It got this error:
> > >
> > > Caused by: java.net.MalformedURLException: no protocol: and
> > >    at java.net.URL.&lt;init&gt;(URL.java:567)
> > >    at java.net.URL.&lt;init&gt;(URL.java:464)
> > >    at java.net.URL.&lt;init&gt;(URL.java:413)
> > >
> > > A quick google found this:
> > >
> > >
> > http://mail-archives.apache.org/mod_mbox/geronimo-dev/200512.mbox/%3C1140943220.1133540370123.JavaMail.jira@ajax.apache.org%3E
> > >
> > > It suggests that the problem is caused by the path to the repository
> > being
> > > under "Documents and Settings", which has a space :-(
> > > After specifying a different location for the local repository, which
> > > didn't
> > > have spaces in the path, the problem went away and tests passed.
> > >
> > > 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/19/06, Dan Greening < greening@bigtribe.com> 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
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
> --
> 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
>
>


--
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
                             -- The Princess Bride

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: DESPERATE: JBoss EJB3 embeddable container fails under surefire?

Posted by Chris Richardson <ch...@gmail.com>.
Pete

You can download the source code for my book, which includes the POMs etc,
from: http://www.manning.com/crichardson
The embedded EJB 3 container looks like a good way to easily test EJB3
session beans- avoids having to fire up the fullblown server.

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/20/06, Pete <pe...@gmail.com> wrote:
>
> Chris  or Dan,
>
> Just wondered if you could share your POM and testing approach with me ,
> I'm
> looking to test JBoss EJB3 EJBs using surefire or testNG, so I am
> wondering
> what the options are, and how this emedded EJB3 container works /  fits in
> ?
>
> Pete
>
> On 19/03/06, Chris Richardson <ch...@gmail.com> wrote:
> >
> > Dan,
> >
> > I also had a problem using maven2 to run the EJB3/JBoss microcontainer
> > tests
> > for the example from my book.
> > It got this error:
> >
> > Caused by: java.net.MalformedURLException: no protocol: and
> >    at java.net.URL.&lt;init&gt;(URL.java:567)
> >    at java.net.URL.&lt;init&gt;(URL.java:464)
> >    at java.net.URL.&lt;init&gt;(URL.java:413)
> >
> > A quick google found this:
> >
> >
> http://mail-archives.apache.org/mod_mbox/geronimo-dev/200512.mbox/%3C1140943220.1133540370123.JavaMail.jira@ajax.apache.org%3E
> >
> > It suggests that the problem is caused by the path to the repository
> being
> > under "Documents and Settings", which has a space :-(
> > After specifying a different location for the local repository, which
> > didn't
> > have spaces in the path, the problem went away and tests passed.
> >
> > 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/19/06, Dan Greening < greening@bigtribe.com> 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
> > >
> > >
> > >
> > >
> >
> >
>
>


--
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

Re: DESPERATE: JBoss EJB3 embeddable container fails under surefire?

Posted by Pete <pe...@gmail.com>.
Chris  or Dan,

Just wondered if you could share your POM and testing approach with me , I'm
looking to test JBoss EJB3 EJBs using surefire or testNG, so I am wondering
what the options are, and how this emedded EJB3 container works /  fits in ?

Pete

On 19/03/06, Chris Richardson <ch...@gmail.com> wrote:
>
> Dan,
>
> I also had a problem using maven2 to run the EJB3/JBoss microcontainer
> tests
> for the example from my book.
> It got this error:
>
> Caused by: java.net.MalformedURLException: no protocol: and
>    at java.net.URL.&lt;init&gt;(URL.java:567)
>    at java.net.URL.&lt;init&gt;(URL.java:464)
>    at java.net.URL.&lt;init&gt;(URL.java:413)
>
> A quick google found this:
>
> http://mail-archives.apache.org/mod_mbox/geronimo-dev/200512.mbox/%3C1140943220.1133540370123.JavaMail.jira@ajax.apache.org%3E
>
> It suggests that the problem is caused by the path to the repository being
> under "Documents and Settings", which has a space :-(
> After specifying a different location for the local repository, which
> didn't
> have spaces in the path, the problem went away and tests passed.
>
> 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/19/06, Dan Greening <gr...@bigtribe.com> 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 Chris Richardson <ch...@gmail.com>.
Dan,

I also had a problem using maven2 to run the EJB3/JBoss microcontainer tests
for the example from my book.
It got this error:

Caused by: java.net.MalformedURLException: no protocol: and
    at java.net.URL.&lt;init&gt;(URL.java:567)
    at java.net.URL.&lt;init&gt;(URL.java:464)
    at java.net.URL.&lt;init&gt;(URL.java:413)

A quick google found this:
http://mail-archives.apache.org/mod_mbox/geronimo-dev/200512.mbox/%3C1140943220.1133540370123.JavaMail.jira@ajax.apache.org%3E

It suggests that the problem is caused by the path to the repository being
under "Documents and Settings", which has a space :-(
After specifying a different location for the local repository, which didn't
have spaces in the path, the problem went away and tests passed.

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/19/06, Dan Greening <gr...@bigtribe.com> 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
>
>
>
>