geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: EJB unit testing JPA projects
Date Wed, 19 Nov 2008 02:02:08 GMT

On Nov 17, 2008, at 7:24 AM, ericp56 wrote:

>
> Hi All,
>
> OpenEJB unit testing works great.

Thanks!

> However, I am now trying to unit test a JPA EJB and get the  
> following error:
>
> Apache OpenEJB 3.0    build: 20080408-04:13
> http://openejb.apache.org/
> INFO - openejb.home = C:\eclipseRC3\workspace\ScrapEjb
> INFO - openejb.base = C:\eclipseRC3\workspace\ScrapEjb
> INFO - Configuring Service(id=Default Security Service,
> type=SecurityService, provider-id=Default Security Service)
> INFO - Configuring Service(id=Default Transaction Manager,
> type=TransactionManager, provider-id=Default Transaction Manager)
> INFO - Configuring Service(id=SchedulerDB2, type=Resource,
> provider-id=Default JDBC Database)
> INFO - Configuring Service(id=SchedulerDB, type=Resource,
> provider-id=Default JDBC Database)
> INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory,
> type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
> INFO - Found EjbModule in classpath:
> C:\eclipseRC3\workspace\ScrapEjb\build\classes
> INFO - Configuring app: C:\eclipseRC3\workspace\ScrapEjb\build\classes
> INFO - Configuring Service(id=Default Stateless Container,  
> type=Container,
> provider-id=Default Stateless Container)
> INFO - Auto-creating a container for bean ScrapClass:
> Container(type=STATELESS, id=Default Stateless Container)
> INFO - Auto-linking resource-ref 'SchedulerDB2' in bean ScrapClass to
> Resource(id=SchedulerDB2)
> INFO - Auto-linking resource-ref 'SchedulerDB' in bean ScrapClass to
> Resource(id=SchedulerDB)
> INFO - Configuring PersistenceUnit(name=ScrapEjb)
> INFO - Loaded Module: C:\eclipseRC3\workspace\ScrapEjb\build\classes
> ERROR - FATAL ERROR: Unknown error in Assembler.  Please send the  
> following
> stack trace and this message to user@openejb.org :
> org.apache.xbean.recipe.ConstructionException: Error invoking factory
> method: public static javax.sql.DataSource
> org 
> .apache 
> .openejb.resource.jdbc.DataSourceFactory.create(boolean,boolean)
> ...
> Caused by: java.lang.NoClassDefFoundError:
> org/apache/commons/dbcp/managed/BasicManagedDataSource
> ...
>
> OpenEjb-core.3.0.jar is included in the classpath, so the
> BasicManagedDataSource is available.

That class is not located in the openejb-core-3.0.jar.  I'd download  
the zip and include all the jars from the lib/ directory in your  
eclipse test classpath:

   http://www.apache.org/dist/openejb/3.1/openejb-3.1.zip

That's the latest release.  The 3.0 release is great, but the 3.1  
release has more bells and whistles for unit testing along with better  
diagnostic messages.

-David


Mime
View raw message