You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Martin Davidsson <mh...@ncsu.edu> on 2004/07/07 20:52:31 UTC

Compiling without J2EE

Is it possible to compile OJB without using the j2ee.jar? I'm trying to  
use a custom version of OJB with a Tomcat servlet but it always throws  
NoClassDefFound errors. I think it might because I don't include  
j2ee.jar in the Tomcat classpath. When I do, however, I get this  
instead:

WebappClassLoader:  
validateJarFile(/home/local/mhdavids/Scoperto/tomcat/webapps/scoperto/ 
WEB-INF/lib/j2ee.jar) - jar not loaded. See Servlet Spec 2.3, section  
9.7.2. Offending class: javax/servlet/Servlet.class

Removing servlet.jar (which I've heard suggested elsewhere) isn't an  
option I'm afraid. I was hoping to cut any J2EE dependancies instead.  
Thanks

-- Martin


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Compiling without J2EE

Posted by Steve Clark <sc...@euler.cr.usgs.gov>.
What version of OJB are you using?  What classes are used at the
indicated lines?  The lines don't match up with anything interesting
in the various sources I have.

    org.apache.ojb.broker.util.BrokerHelper.crossCheckPBKey(BrokerHelper.java:123)
    org.apache.ojb.odmg.OJB.(OJB.java:68)

-- 
Steve Clark
Technology Applications Team
Natural Resources Research Center/USGS
sclark@support.tat.fws.gov
(970)226-9291


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Compiling without J2EE

Posted by Thomas Dudziak <to...@first.fhg.de>.
Martin Davidsson wrote:

> I hate to spam, but I should include this too. I seem to get it more  
> often than the other stack trace. Don't know if it helps or not :(
> 
> java.lang.NoClassDefFoundError
>     at org.apache.ojb.odmg.OJB.(OJB.java:68)
>     at org.apache.ojb.odmg.OJB.getInstance(OJB.java:76)

As Steve pointed out, you should *not* include the j2ee jar in the lib 
folder of your webapp.
The above error is more likely to be caused by something different 
because the ODMG impl is not dependent upon the Servlet spec nor J2EE AFAIK.

Also, if you're using Eclipse, then you can use the Sysdeo Tomcat Plugin 
to start Tomcat in Debug mode, in which case you simple add an Exception 
Breakpoint for NoClassDefFoundError. This will show you where the 
exception is thrown and what class is not found (IDEA will have 
something alike, I'm sure).

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Compiling without J2EE

Posted by Martin Davidsson <mh...@ncsu.edu>.
I hate to spam, but I should include this too. I seem to get it more  
often than the other stack trace. Don't know if it helps or not :(

java.lang.NoClassDefFoundError
	at org.apache.ojb.odmg.OJB.(OJB.java:68)
	at org.apache.ojb.odmg.OJB.getInstance(OJB.java:76)

On Jul 7, 2004, at 3:12 PM, Martin Davidsson wrote:

> Thanks Steve.
>
> The NoClassDefFound doesn't refer to anything. Here's part of the  
> Tomcat Error Report:
>
> java.lang.NoClassDefFoundError
> 	at  
> org.apache.ojb.broker.util.BrokerHelper.crossCheckPBKey(BrokerHelper.ja 
> va:123)
> 	at  
> org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPe 
> rsistenceBroker(PersistenceBrokerFactoryDefaultImpl.java:91)
> 	at  
> org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker( 
> PersistenceBrokerFactory.java:86)
> 	at org.apache.ojb.odmg.DatabaseImpl.open(DatabaseImpl.java:121)
>
> Thanks again
>
> -- Martin
>
> On Jul 7, 2004, at 3:08 PM, Steve Clark wrote:
>
>> You need to compile with j2ee.jar or the equivalent, but don't install
>> that jar (or servlet.jar or any of that ilk) with your servlet -
>> Tomcat provides its own equivalent at runtime.  This is the way the
>> Servlet spec works: the container is supposed to provide the classes
>> in servlet.jar, and individual servlets or webapps cannot.
>>
>> What class does the NoClassDefFound refer to?
>>
>> --
>> Steve Clark
>>
>> Technology Applications Team
>> Natural Resources Research Center/USGS
>> sclark@support.tat.fws.gov
>> (970)226-9291
>>
>>
>>>>>>> Martin Davidsson writes:
>>
>>     Martin> Is it possible to compile OJB without using the j2ee.jar?
>>     Martin> I'm trying to use a custom version of OJB with a Tomcat
>>     Martin> servlet but it always throws NoClassDefFound errors. I
>>     Martin> think it might because I don't include j2ee.jar in the
>>     Martin> Tomcat classpath. When I do, however, I get this instead:
>>
>>     Martin> WebappClassLoader:
>>     Martin>  
>> validateJarFile(/home/local/mhdavids/Scoperto/tomcat/webapps/ 
>> scoperto/
>>     Martin> WEB-INF/lib/j2ee.jar) - jar not loaded. See Servlet Spec
>>     Martin> 2.3, section 9.7.2. Offending class:
>>     Martin> javax/servlet/Servlet.class
>>
>>     Martin> Removing servlet.jar (which I've heard suggested
>>     Martin> elsewhere) isn't an option I'm afraid. I was hoping to cut
>>     Martin> any J2EE dependancies instead.  Thanks
>>
>>     Martin> -- Martin
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Compiling without J2EE

Posted by Martin Davidsson <mh...@ncsu.edu>.
Thanks Steve.

The NoClassDefFound doesn't refer to anything. Here's part of the  
Tomcat Error Report:

java.lang.NoClassDefFoundError
	at  
org.apache.ojb.broker.util.BrokerHelper.crossCheckPBKey(BrokerHelper.jav 
a:123)
	at  
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPer 
sistenceBroker(PersistenceBrokerFactoryDefaultImpl.java:91)
	at  
org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(P 
ersistenceBrokerFactory.java:86)
	at org.apache.ojb.odmg.DatabaseImpl.open(DatabaseImpl.java:121)

Thanks again

-- Martin

On Jul 7, 2004, at 3:08 PM, Steve Clark wrote:

> You need to compile with j2ee.jar or the equivalent, but don't install
> that jar (or servlet.jar or any of that ilk) with your servlet -
> Tomcat provides its own equivalent at runtime.  This is the way the
> Servlet spec works: the container is supposed to provide the classes
> in servlet.jar, and individual servlets or webapps cannot.
>
> What class does the NoClassDefFound refer to?
>
> --
> Steve Clark
>
> Technology Applications Team
> Natural Resources Research Center/USGS
> sclark@support.tat.fws.gov
> (970)226-9291
>
>
>>>>>> Martin Davidsson writes:
>
>     Martin> Is it possible to compile OJB without using the j2ee.jar?
>     Martin> I'm trying to use a custom version of OJB with a Tomcat
>     Martin> servlet but it always throws NoClassDefFound errors. I
>     Martin> think it might because I don't include j2ee.jar in the
>     Martin> Tomcat classpath. When I do, however, I get this instead:
>
>     Martin> WebappClassLoader:
>     Martin>  
> validateJarFile(/home/local/mhdavids/Scoperto/tomcat/webapps/scoperto/
>     Martin> WEB-INF/lib/j2ee.jar) - jar not loaded. See Servlet Spec
>     Martin> 2.3, section 9.7.2. Offending class:
>     Martin> javax/servlet/Servlet.class
>
>     Martin> Removing servlet.jar (which I've heard suggested
>     Martin> elsewhere) isn't an option I'm afraid. I was hoping to cut
>     Martin> any J2EE dependancies instead.  Thanks
>
>     Martin> -- Martin
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Compiling without J2EE

Posted by Steve Clark <sc...@euler.cr.usgs.gov>.
You need to compile with j2ee.jar or the equivalent, but don't install
that jar (or servlet.jar or any of that ilk) with your servlet -
Tomcat provides its own equivalent at runtime.  This is the way the
Servlet spec works: the container is supposed to provide the classes
in servlet.jar, and individual servlets or webapps cannot.

What class does the NoClassDefFound refer to?

--
Steve Clark

Technology Applications Team
Natural Resources Research Center/USGS
sclark@support.tat.fws.gov
(970)226-9291


>>>>> Martin Davidsson writes:

    Martin> Is it possible to compile OJB without using the j2ee.jar? 
    Martin> I'm trying to use a custom version of OJB with a Tomcat
    Martin> servlet but it always throws NoClassDefFound errors. I
    Martin> think it might because I don't include j2ee.jar in the
    Martin> Tomcat classpath. When I do, however, I get this instead:

    Martin> WebappClassLoader:
    Martin> validateJarFile(/home/local/mhdavids/Scoperto/tomcat/webapps/scoperto/
    Martin> WEB-INF/lib/j2ee.jar) - jar not loaded. See Servlet Spec
    Martin> 2.3, section 9.7.2. Offending class:
    Martin> javax/servlet/Servlet.class

    Martin> Removing servlet.jar (which I've heard suggested
    Martin> elsewhere) isn't an option I'm afraid. I was hoping to cut
    Martin> any J2EE dependancies instead.  Thanks

    Martin> -- Martin



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org