Thanks for the response. I tried moving everything out of the run() method;
however I still get the same issue.  I got around this issue for now by
moving one of the maven modules into its own independent maven project.
Not the most ideal solution; however it does work 😁

On Fri, Oct 7, 2016 at 1:05 PM, Mauro Talevi <mauro.tal...@gmail.com> wrote:

> Hi,
>
> Are you saying that it works fine with Maven command-line if you use JUnit
> tests but not with JBehave stories?   This is strange but it could be down
> to different handling of the class loading.
>
> In any case, you should surely close down the connection after the stories
> execution.
>
> You should not really add anything in the run() method.   It’s much more
> advisable to use @Before/After annotations
> (e.g. using the @AfterStories annotation).
>
> Alternatively, you could centralise all stories in a single module to
> ensure that only one connection is opened.
>
> Cheers
>
> On 4 Oct 2016, at 17:47, Mike Koch <mkoch...@gmail.com> wrote:
>
> I have a project with the following maven structure:
>
> Parent
>   - First Module with JBehave Story
>   - Data Access Module
>   - Second Module with JBehave Story
>
> Both of the modules that have a JBehave Story utilize a local MS SQL
> server database connection as they rely on database tests.  The data access
> modules provides the necessary DataSource to connect to this database.  The
> issue I'm coming across is when running `mvn clean verify` across the
> parent module, only *one* of the JBehave stories will run. The other
> module will fail with the following error:
>
> WARNING: Failed to load the sqljdbc_auth.dll cause : Native Library C:\
> Windows\System32\sqljdbc_auth.dll already loaded in another classloader
>
> If only one (or none) of the modules utilize the database connection, the
> modules run fine.  Also, I can run each story separately.  I can also use
> this same data access logic across regular JUnit tests and those work fine,
> even when ran through maven.  This issue almost appears to be due to some
> sort of backend runner that is not shutting down / garbage collecting
> because if I don't explicitly close my DataSource after the story is
> complete (which I should be doing anyway), I get the following warning when
> the second module starts to run its tests:
>
> [WARNING] A C3P0Registry mbean is already registered. This probably means
> that an application using c3p0 was undeployed, but not all
> PooledDataSources were closed prior to undeployment. This may lead to
> resource leaks over time. Please take care to close all PooledDataSources.
>
> Is there something I am forgetting to do during my story's run() method to
> make sure everything is properly destroyed after the story is finished
> running, so the next story can run correctly without problems?  I've
> attached a .zip of a sample project that can reproduce this issue.
>
> --
> You received this message because you are subscribed to the Google Groups
> "JBehave User" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jbehave-user+unsubscr...@googlegroups.com.
> To post to this group, send email to jbehave-user@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/
> msgid/jbehave-user/2fbe6944-1130-48c0-94fa-b34f688a79c2%40googlegroups.com
> <https://groups.google.com/d/msgid/jbehave-user/2fbe6944-1130-48c0-94fa-b34f688a79c2%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JBehave User" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jbehave-user+unsubscr...@googlegroups.com.
To post to this group, send an email to jbehave-user@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/jbehave-user/CAGKnwFKEDwhChDpVB0agXX3T-q6v5OVHrfmeQPzro1V1SyU44A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to