Re: JUnit question

2008-11-05 Thread Jacek Laskowski
On Wed, Nov 5, 2008 at 12:05 AM, ericp56 <[EMAIL PROTECTED]> wrote:

> My current problem is "caused by:"
> Caused by: java.lang.NoClassDefFoundError:
> org/apache/commons/dbcp/BasicDataSource

Add commons-dbcp-*.jar to CLASSPATH and start it over.

Jacek

-- 
Jacek Laskowski
Notatnik Projektanta Java EE - http://www.JacekLaskowski.pl


Re: JUnit question

2008-11-05 Thread David Blevins


On Nov 4, 2008, at 3:05 PM, ericp56 wrote:


org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java: 
196)

Caused by: java.lang.NoClassDefFoundError:
org/apache/commons/dbcp/BasicDataSource


I'm guessing it's something simple with my configuration...


That class is in the commons-dbcp-all jar under the lib/ directory.   
Definitely add that to your classpath if you haven't.


-David



Re: How to set Java / JDBC / SQL type mapping with Open EJB ?

2008-11-05 Thread David Blevins


On Nov 4, 2008, at 7:52 AM, Olivier THIERRY wrote:


But it nevers returns any result, while I have no problem running the
similar queries with string or int columns instead of float one ! So  
it's
just a problem with floats. Moreover using Hibernate console, I  
could make
it work but I had to set my parameter as a double. So it looks like  
I have a
type mapping problem with floats between Java, JDBC and HSQLDB. For  
what I
understood this type mapping is configured on the application  
server. In
JBoss AS (the one I use in production), there's a file for this,  
called
standardjbosscmp-jdbc.xml. It defines for each database product and  
each
Java type the JDBC and SQL corresponding types. Do we have the  
equivalent
with Open EJB ? Or is there something I misunderstood with JPA ?  
Please tell
me if it's not a problem with Open EJB because I am not sure at all  
about

this.



Type mapping is all handled by the JPA provider.  I'd double check  
with Hibernate.


I know OpenJPA and other JPA implementations have logic that adapts  
their JDBC usage to match the dialect of the database and the  
capabilities of its JDBC driver.  Pretty sure I've seen a similar  
property for Hibernate.


One quick test might be to temporarily switch your JPA provider to say  
OpenJPA, which is certified, and see how it handles the query.


-David



Re: JUnit question

2008-11-05 Thread ericp56

That's already included in my classpath via openejb-core-3.0.jar (in Geronimo
server).


-- 
View this message in context: 
http://www.nabble.com/JUnit-question-tp20306283p20351506.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: JUnit question

2008-11-05 Thread David Blevins


On Nov 5, 2008, at 2:50 PM, ericp56 wrote:

That's already included in my classpath via openejb-core-3.0.jar (in  
Geronimo

server).


Not sure I follow.  The embeddable EJB container functionality for  
unit testing doesn't use the Geronimo server.  Also Geronimo doesn't  
use commons-dbcp as it has it's own connection management code.


You could try something like this in your test case to see what is in  
our classpath, assuming the Eclipse classloader is a subclass of  
URLClassLoader (good chance of that).


  ClassLoader classLoader =  
Thread.currentThread().getContextClassLoader();

  System.out.println("classLoader" + classLoader);
  System.out.println("classLoader.class" +  
classLoader.getClass().getName());

  if (classLoader instanceof URLClassLoader) {
  URLClassLoader urlClassLoader = (URLClassLoader) classLoader;
  URL[] urls = urlClassLoader.getURLs();
  for (URL url : urls) {
  System.out.println("url = " + url.toExternalForm());
  }
  }

-David



ApplicationException annotation ignored

2008-11-05 Thread Kory Markevich

I have a fairly simple EAR that I'm developing using Geronimo 2.1.2 and thus
whatever version of OpenEJB it uses, making use of EJB 3.  I've been trying
to flag an exception with the @ApplicationException annotation but it
doesn't seem to be processed.  I've been using Eclipse 3.4 to develop it.

The EAR consists of one stateless bean defined in an EJB project, it's local
interface + exception defined in another project, and the EAR project itself
which contains these two.  There's also a connector in there for DB stuff,
but it's unimportant.

So as assembled and deployed by Eclipse, leaving out the RAR and META-INFs:

EAR file
|_ EJB.jar
|_ StatelessSessionBean class
|_ EJB_client.jar
|_ LocalInterface class
|_ AppException class

Now when I debugged the deploy process, I noticed that the Assembler would
try to loop through all the defined application exceptions, but there were
none.  Next I looked in the AnnotationDeployer.DiscoverAnnotatedBeans class
and the findAnnotatedClasses(ApplicationException.class) call in deploy.  It
is returning nothing.  I haven't bothered to grab the source for the class
finder, but from looking at it the classloader that it uses has only loaded
the StatelessSessionBean and LocalInterface classes.  The AppException
doesn't seem to be loaded anywhere.

I'm sure there's something really simple I'm overlooking but I can't find
it.  What are the basic requirements to use the ApplicationException
annotation with OpenEJB properly?
-- 
View this message in context: 
http://www.nabble.com/ApplicationException-annotation-ignored-tp20353137p20353137.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: ApplicationException annotation ignored

2008-11-05 Thread David Blevins


On Nov 5, 2008, at 4:41 PM, Kory Markevich wrote:



I have a fairly simple EAR that I'm developing using Geronimo 2.1.2  
and thus
whatever version of OpenEJB it uses, making use of EJB 3.  I've been  
trying

to flag an exception with the @ApplicationException annotation but it
doesn't seem to be processed.  I've been using Eclipse 3.4 to  
develop it.


The EAR consists of one stateless bean defined in an EJB project,  
it's local
interface + exception defined in another project, and the EAR  
project itself
which contains these two.  There's also a connector in there for DB  
stuff,

but it's unimportant.

So as assembled and deployed by Eclipse, leaving out the RAR and  
META-INFs:


EAR file
|_ EJB.jar
   |_ StatelessSessionBean class
|_ EJB_client.jar
   |_ LocalInterface class
   |_ AppException class



Hi Kory,

This is the issue you're facing:

  https://issues.apache.org/jira/browse/OPENEJB-835  
"@ApplicationException ignored when class exists in separate module"


It's closed and fixed in the recently released OpenEJB 3.1 and will be  
pulled into Geronimo 2.2 when that is released.


In the meantime, you can explicitly list the ApplicationException in  
an ejb-jar.xml added to the EJB.jar like this:





AppException
false





-David