You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Paul Copeland <te...@jotobjects.com> on 2009/03/19 20:33:04 UTC

Questions about classpath for OpenJPA

I am just getting started and created a simple standalone (not in an app 
server container) JPA application working with both TopLink and OpenJPA 
1.2 and tested with both MySQL and Postgres.  This is with Java SE 
1.5.0_05 building with Ant (not in in an IDE).

By trial and error I found I needed the jar files downloaded in the 
apache-openjpa-1.2.0 lib directory. I also needed xercesImpl.jar.  I did 
not find these dependencies documented in the release notes, or in the 
manual, or on the Quickstart page  
(http://openjpa.apache.org/quick-start.html).

These were the necessary jars at either compile time or runtime -

commons-collections-3.2.jar
commons-lang-2.1.jar
geronimo-jpa_3.0_spec-1.0.jar
geronimo-jta_1.1_spec-1.1.jar
openjpa-1.2.0.jar
serp-1.13.1.jar
xercesImpl.jar

Probably I will also need commons-pool-1.3.jar or something similar for 
Connection pooling.

Presumably the geronimo jars are not needed in a Java 5 EE container.  
I'm not sure why xerces is required since Java SE 1.5 has a SAX parser.  
I guess all the other jars need to be deployed in the classpath in most 
other contexts.

This kind of dependency information might be usefully documented 
somewhere.  Every new user has to figure this stuff out.

BTW - My target runtime environment will be Tomcat 6 + Java SE 1.6 + 
OpenJPA 1.2 + Postgres 8.2.x

Any experience or advice about what jars are required or is this already 
documented somewhere?

Thanks - Paul



Re: Questions about classpath for OpenJPA

Posted by Paul Copeland <te...@jotobjects.com>.
Cool!  That's very nice and it makes sense that starting a new JVM 
changes the class loader issue.  Notice the ant lib directory includes 
xercesImpl.jar (ant 1.7.1).  That also explains why the OpenJPA examples 
work because the examples build.xml has fork=yes.

Thanks for figuring that out.  Might help the next poor developer that 
hits this. :-)

- Paul

On 3/26/2009 9:05 AM, Rick Curtis wrote:
> Paul -
> I don't fully understand whats going on, but I found what is causing the problems. When you launch your java application, you don't fork the JVM. Adding fork="yes" to <java classname="com.s... > made the problems go away.
>
> If you google around, you'll find other people having this very problem.
>
> -Rick
>
>
> Hi Rick -
>
> What I think is happening is that most containers have the JAXP jar 
> files, but if you run it standalone from the console this issue shows 
> up.  There was an evolution from java 1.4 to 1.5 that changed how this 
> works.  There are a lot of posts if you google it, but I'm no clear on 
> the what the configuration trick is so you don't have to have xercesIml.jar.
>
> Attached is is a bare bones zip file.  Directions -
>
> - Add the jars from OpenJPA 1.2.1 to the lib directory and your JDBC driver
> - Create a database with the test_person table for class 
> com.steelhead.lg.test.Person
> - Edit src/java/META-INF/persistence.xml with your connection properties
> - type "ant TestJPA"
>
> This should work.  If you remove the two sysproperty elements from the 
> ant build.xml then it fails with 
> javax.xml.parsers.FactoryConfigurationError unless you add 
> xercesImpl.jar to the lib directory.
>
> I'm using Java SE 1.6.0_12.  I had the same problem with Java 1.5.0_05. 
> Also had the same issue with OpenJPA 1.2.0.
>
> I'm using Postgres 8.2.13 but I had the same problem with MySql 1.31 so 
> probably the database does not matter.
>
> As I said, the OpenJPA hellojpa example works for me without 
> xercesImpl.jar so that adds to the mystery.
>
> - Paul
>
> On 3/23/2009 11:42 AM, Rick Curtis wrote:
>   
>> Paul-
>> <br>If you still are unable to figure out what's going on, feel free to zip up your simple test app and I'll take a look at it.
>> <br><br>-Rick
>> <br><blockquote class="quote light-black dark-border-color"><div class="quote light-border-color">
>> <div class="quote-author" style="font-weight: bold;">Paul Copeland wrote:</div>
>> <div class="quote-message shrinkable-quote">Hi Rick -
>> <br><br>Thanks. As I mentioned the openjpa example hellojpa also works for me 
>> <br>WITHOUT the xerces jar. &nbsp;But my very simple test app does not work with 
>> <br>xerces. &nbsp;However, I found out that if I add these two properties to my 
>> <br>runtime ant task then I do NOT need the xerces jar.
>> <br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;sysproperty key=&quot;javax.xml.parsers.SAXParserFactory&quot; 
>> <br>value=&quot;com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl&quot;/&gt;
>> <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;sysproperty key=&quot;javax.xml.parsers.DocumentBuilderFactory&quot; 
>> <br>value=&quot;com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl&quot;/&gt;
>> <br><br>There is some classloader subtlety that I don't fully understand here.
>> <br><br>- Paul
>> <br><br>On 3/23/2009 8:17 AM, Rick Curtis wrote:
>> <br>&gt; Paul -
>> <br>&gt; I quickly looked through the javadoc for the 
>> <br>&gt; http://java.sun.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance( )
>> <br>&gt; SAXParserFactory &nbsp;and I'm thinking that your problem is something specific
>> <br>&gt; to your environment.? I was able to run the examples on my box without
>> <br>&gt; adding xercesImpl.jar to my classpath. With my JSE1.6 install,
>> <br>&gt; SAXParserFactoryImpl is found in the [java_home]\lib\rt.jar.
>> <br>&gt;
>> <br>&gt; -Rick
>> <br>&gt;
>> <br>&gt; Paul Copeland wrote:
>> <br>&gt; &nbsp; 
>> <br>&gt;&gt; More info on this. &nbsp;I upgraded to Java SE 1.6.0_12 and I still need the 
>> <br>&gt;&gt; same jars (including xerces).
>> <br>&gt;&gt;
>> <br>&gt;&gt; Using OpenJPA 1.2 -
>> <br>&gt;&gt;
>> <br>&gt;&gt; 1) Only two jars are needed to compile my (very simple) test application -
>> <br>&gt;&gt;
>> <br>&gt;&gt; - openjpa-1.2.0.jar
>> <br>&gt;&gt; - geronimo-jta_1.1_spec-1.1.jar
>> <br>&gt;&gt;
>> <br>&gt;&gt; 2) At runtime (standalone, not in a container) I also need these jars
>> <br>&gt;&gt; (plus JDBC driver of course) -
>> <br>&gt;&gt;
>> <br>&gt;&gt; - serp-1.13.1.jar
>> <br>&gt;&gt; - geronimo-jta_1.1_spec-1.1.jar
>> <br>&gt;&gt; - commons-collections-3.2.jar
>> <br>&gt;&gt; - commons-lang-2.1.jar
>> <br>&gt;&gt; - xercesImpl.jar
>> <br>&gt;&gt;
>> <br>&gt;&gt; 3) When I build and run the apache-openjpa-1.2.0/examples/hellojpa 
>> <br>&gt;&gt; (Derby example) I do NOT need xerces.
>> <br>&gt;&gt; ....
>> <br>&gt;&gt;
>> <br>&gt;&gt; &nbsp; &nbsp; 
>> <br>&gt;
>> <br>&gt; &nbsp; 
>> <br></div>
>> </div></blockquote>
>>
>>   
>>     
>
>  
>
>
>   


Re: Questions about classpath for OpenJPA

Posted by Rick Curtis <cu...@gmail.com>.
Paul -
I don't fully understand whats going on, but I found what is causing the problems. When you launch your java application, you don't fork the JVM. Adding fork="yes" to <java classname="com.s... > made the problems go away.

If you google around, you'll find other people having this very problem.

-Rick


Hi Rick -

What I think is happening is that most containers have the JAXP jar 
files, but if you run it standalone from the console this issue shows 
up.  There was an evolution from java 1.4 to 1.5 that changed how this 
works.  There are a lot of posts if you google it, but I'm no clear on 
the what the configuration trick is so you don't have to have xercesIml.jar.

Attached is is a bare bones zip file.  Directions -

- Add the jars from OpenJPA 1.2.1 to the lib directory and your JDBC driver
- Create a database with the test_person table for class 
com.steelhead.lg.test.Person
- Edit src/java/META-INF/persistence.xml with your connection properties
- type "ant TestJPA"

This should work.  If you remove the two sysproperty elements from the 
ant build.xml then it fails with 
javax.xml.parsers.FactoryConfigurationError unless you add 
xercesImpl.jar to the lib directory.

I'm using Java SE 1.6.0_12.  I had the same problem with Java 1.5.0_05. 
Also had the same issue with OpenJPA 1.2.0.

I'm using Postgres 8.2.13 but I had the same problem with MySql 1.31 so 
probably the database does not matter.

As I said, the OpenJPA hellojpa example works for me without 
xercesImpl.jar so that adds to the mystery.

- Paul

On 3/23/2009 11:42 AM, Rick Curtis wrote:
> Paul-
> <br>If you still are unable to figure out what's going on, feel free to zip up your simple test app and I'll take a look at it.
> <br><br>-Rick
> <br><blockquote class="quote light-black dark-border-color"><div class="quote light-border-color">
> <div class="quote-author" style="font-weight: bold;">Paul Copeland wrote:</div>
> <div class="quote-message shrinkable-quote">Hi Rick -
> <br><br>Thanks. As I mentioned the openjpa example hellojpa also works for me 
> <br>WITHOUT the xerces jar. &nbsp;But my very simple test app does not work with 
> <br>xerces. &nbsp;However, I found out that if I add these two properties to my 
> <br>runtime ant task then I do NOT need the xerces jar.
> <br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;sysproperty key=&quot;javax.xml.parsers.SAXParserFactory&quot; 
> <br>value=&quot;com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl&quot;/&gt;
> <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;sysproperty key=&quot;javax.xml.parsers.DocumentBuilderFactory&quot; 
> <br>value=&quot;com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl&quot;/&gt;
> <br><br>There is some classloader subtlety that I don't fully understand here.
> <br><br>- Paul
> <br><br>On 3/23/2009 8:17 AM, Rick Curtis wrote:
> <br>&gt; Paul -
> <br>&gt; I quickly looked through the javadoc for the 
> <br>&gt; http://java.sun.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance( )
> <br>&gt; SAXParserFactory &nbsp;and I'm thinking that your problem is something specific
> <br>&gt; to your environment.? I was able to run the examples on my box without
> <br>&gt; adding xercesImpl.jar to my classpath. With my JSE1.6 install,
> <br>&gt; SAXParserFactoryImpl is found in the [java_home]\lib\rt.jar.
> <br>&gt;
> <br>&gt; -Rick
> <br>&gt;
> <br>&gt; Paul Copeland wrote:
> <br>&gt; &nbsp; 
> <br>&gt;&gt; More info on this. &nbsp;I upgraded to Java SE 1.6.0_12 and I still need the 
> <br>&gt;&gt; same jars (including xerces).
> <br>&gt;&gt;
> <br>&gt;&gt; Using OpenJPA 1.2 -
> <br>&gt;&gt;
> <br>&gt;&gt; 1) Only two jars are needed to compile my (very simple) test application -
> <br>&gt;&gt;
> <br>&gt;&gt; - openjpa-1.2.0.jar
> <br>&gt;&gt; - geronimo-jta_1.1_spec-1.1.jar
> <br>&gt;&gt;
> <br>&gt;&gt; 2) At runtime (standalone, not in a container) I also need these jars
> <br>&gt;&gt; (plus JDBC driver of course) -
> <br>&gt;&gt;
> <br>&gt;&gt; - serp-1.13.1.jar
> <br>&gt;&gt; - geronimo-jta_1.1_spec-1.1.jar
> <br>&gt;&gt; - commons-collections-3.2.jar
> <br>&gt;&gt; - commons-lang-2.1.jar
> <br>&gt;&gt; - xercesImpl.jar
> <br>&gt;&gt;
> <br>&gt;&gt; 3) When I build and run the apache-openjpa-1.2.0/examples/hellojpa 
> <br>&gt;&gt; (Derby example) I do NOT need xerces.
> <br>&gt;&gt; ....
> <br>&gt;&gt;
> <br>&gt;&gt; &nbsp; &nbsp; 
> <br>&gt;
> <br>&gt; &nbsp; 
> <br></div>
> </div></blockquote>
>
>   

 


-- 
View this message in context: http://n2.nabble.com/Questions-about--classpath-for-OpenJPA-tp2504942p2539314.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Questions about classpath for OpenJPA

Posted by Paul Copeland <te...@jotobjects.com>.
Hi Rick -

What I think is happening is that most containers have the JAXP jar 
files, but if you run it standalone from the console this issue shows 
up.  There was an evolution from java 1.4 to 1.5 that changed how this 
works.  There are a lot of posts if you google it, but I'm no clear on 
the what the configuration trick is so you don't have to have xercesIml.jar.

Attached is is a bare bones zip file.  Directions -

- Add the jars from OpenJPA 1.2.1 to the lib directory and your JDBC driver
- Create a database with the test_person table for class 
com.steelhead.lg.test.Person
- Edit src/java/META-INF/persistence.xml with your connection properties
- type "ant TestJPA"

This should work.  If you remove the two sysproperty elements from the 
ant build.xml then it fails with 
javax.xml.parsers.FactoryConfigurationError unless you add 
xercesImpl.jar to the lib directory.

I'm using Java SE 1.6.0_12.  I had the same problem with Java 1.5.0_05. 
Also had the same issue with OpenJPA 1.2.0.

I'm using Postgres 8.2.13 but I had the same problem with MySql 1.31 so 
probably the database does not matter.

As I said, the OpenJPA hellojpa example works for me without 
xercesImpl.jar so that adds to the mystery.

- Paul

On 3/23/2009 11:42 AM, Rick Curtis wrote:
> Paul-
> <br>If you still are unable to figure out what's going on, feel free to zip up your simple test app and I'll take a look at it.
> <br><br>-Rick
> <br><blockquote class="quote light-black dark-border-color"><div class="quote light-border-color">
> <div class="quote-author" style="font-weight: bold;">Paul Copeland wrote:</div>
> <div class="quote-message shrinkable-quote">Hi Rick -
> <br><br>Thanks. As I mentioned the openjpa example hellojpa also works for me 
> <br>WITHOUT the xerces jar. &nbsp;But my very simple test app does not work with 
> <br>xerces. &nbsp;However, I found out that if I add these two properties to my 
> <br>runtime ant task then I do NOT need the xerces jar.
> <br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;sysproperty key=&quot;javax.xml.parsers.SAXParserFactory&quot; 
> <br>value=&quot;com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl&quot;/&gt;
> <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;sysproperty key=&quot;javax.xml.parsers.DocumentBuilderFactory&quot; 
> <br>value=&quot;com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl&quot;/&gt;
> <br><br>There is some classloader subtlety that I don't fully understand here.
> <br><br>- Paul
> <br><br>On 3/23/2009 8:17 AM, Rick Curtis wrote:
> <br>&gt; Paul -
> <br>&gt; I quickly looked through the javadoc for the 
> <br>&gt; <a href="http://java.sun.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance(" target="_top" rel="nofollow">http://java.sun.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance(</a>)
> <br>&gt; SAXParserFactory &nbsp;and I'm thinking that your problem is something specific
> <br>&gt; to your environment.? I was able to run the examples on my box without
> <br>&gt; adding xercesImpl.jar to my classpath. With my JSE1.6 install,
> <br>&gt; SAXParserFactoryImpl is found in the [java_home]\lib\rt.jar.
> <br>&gt;
> <br>&gt; -Rick
> <br>&gt;
> <br>&gt; Paul Copeland wrote:
> <br>&gt; &nbsp; 
> <br>&gt;&gt; More info on this. &nbsp;I upgraded to Java SE 1.6.0_12 and I still need the 
> <br>&gt;&gt; same jars (including xerces).
> <br>&gt;&gt;
> <br>&gt;&gt; Using OpenJPA 1.2 -
> <br>&gt;&gt;
> <br>&gt;&gt; 1) Only two jars are needed to compile my (very simple) test application -
> <br>&gt;&gt;
> <br>&gt;&gt; - openjpa-1.2.0.jar
> <br>&gt;&gt; - geronimo-jta_1.1_spec-1.1.jar
> <br>&gt;&gt;
> <br>&gt;&gt; 2) At runtime (standalone, not in a container) I also need these jars
> <br>&gt;&gt; (plus JDBC driver of course) -
> <br>&gt;&gt;
> <br>&gt;&gt; - serp-1.13.1.jar
> <br>&gt;&gt; - geronimo-jta_1.1_spec-1.1.jar
> <br>&gt;&gt; - commons-collections-3.2.jar
> <br>&gt;&gt; - commons-lang-2.1.jar
> <br>&gt;&gt; - xercesImpl.jar
> <br>&gt;&gt;
> <br>&gt;&gt; 3) When I build and run the apache-openjpa-1.2.0/examples/hellojpa 
> <br>&gt;&gt; (Derby example) I do NOT need xerces.
> <br>&gt;&gt; ....
> <br>&gt;&gt;
> <br>&gt;&gt; &nbsp; &nbsp; 
> <br>&gt;
> <br>&gt; &nbsp; 
> <br></div>
> </div></blockquote>
>
>   

Re: Questions about classpath for OpenJPA

Posted by Rick Curtis <cu...@gmail.com>.
Paul-
<br>If you still are unable to figure out what's going on, feel free to zip up your simple test app and I'll take a look at it.
<br><br>-Rick
<br><blockquote class="quote light-black dark-border-color"><div class="quote light-border-color">
<div class="quote-author" style="font-weight: bold;">Paul Copeland wrote:</div>
<div class="quote-message shrinkable-quote">Hi Rick -
<br><br>Thanks. As I mentioned the openjpa example hellojpa also works for me 
<br>WITHOUT the xerces jar. &nbsp;But my very simple test app does not work with 
<br>xerces. &nbsp;However, I found out that if I add these two properties to my 
<br>runtime ant task then I do NOT need the xerces jar.
<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;sysproperty key=&quot;javax.xml.parsers.SAXParserFactory&quot; 
<br>value=&quot;com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl&quot;/&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;sysproperty key=&quot;javax.xml.parsers.DocumentBuilderFactory&quot; 
<br>value=&quot;com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl&quot;/&gt;
<br><br>There is some classloader subtlety that I don't fully understand here.
<br><br>- Paul
<br><br>On 3/23/2009 8:17 AM, Rick Curtis wrote:
<br>&gt; Paul -
<br>&gt; I quickly looked through the javadoc for the 
<br>&gt; <a href="http://java.sun.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance(" target="_top" rel="nofollow">http://java.sun.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance(</a>)
<br>&gt; SAXParserFactory &nbsp;and I'm thinking that your problem is something specific
<br>&gt; to your environment.? I was able to run the examples on my box without
<br>&gt; adding xercesImpl.jar to my classpath. With my JSE1.6 install,
<br>&gt; SAXParserFactoryImpl is found in the [java_home]\lib\rt.jar.
<br>&gt;
<br>&gt; -Rick
<br>&gt;
<br>&gt; Paul Copeland wrote:
<br>&gt; &nbsp; 
<br>&gt;&gt; More info on this. &nbsp;I upgraded to Java SE 1.6.0_12 and I still need the 
<br>&gt;&gt; same jars (including xerces).
<br>&gt;&gt;
<br>&gt;&gt; Using OpenJPA 1.2 -
<br>&gt;&gt;
<br>&gt;&gt; 1) Only two jars are needed to compile my (very simple) test application -
<br>&gt;&gt;
<br>&gt;&gt; - openjpa-1.2.0.jar
<br>&gt;&gt; - geronimo-jta_1.1_spec-1.1.jar
<br>&gt;&gt;
<br>&gt;&gt; 2) At runtime (standalone, not in a container) I also need these jars
<br>&gt;&gt; (plus JDBC driver of course) -
<br>&gt;&gt;
<br>&gt;&gt; - serp-1.13.1.jar
<br>&gt;&gt; - geronimo-jta_1.1_spec-1.1.jar
<br>&gt;&gt; - commons-collections-3.2.jar
<br>&gt;&gt; - commons-lang-2.1.jar
<br>&gt;&gt; - xercesImpl.jar
<br>&gt;&gt;
<br>&gt;&gt; 3) When I build and run the apache-openjpa-1.2.0/examples/hellojpa 
<br>&gt;&gt; (Derby example) I do NOT need xerces.
<br>&gt;&gt; ....
<br>&gt;&gt;
<br>&gt;&gt; &nbsp; &nbsp; 
<br>&gt;
<br>&gt; &nbsp; 
<br></div>
</div></blockquote>

-- 
View this message in context: http://n2.nabble.com/Questions-about--classpath-for-OpenJPA-tp2504942p2522760.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Questions about classpath for OpenJPA

Posted by Paul Copeland <te...@jotobjects.com>.
correction to prior message - my very simple test app does not work 
"without" xerces.

On 3/23/2009 10:25 AM, Paul Copeland wrote:
> Hi Rick -
>
> Thanks. As I mentioned the openjpa example hellojpa also works for me 
> WITHOUT the xerces jar.  But my very simple test app does not work 
> with xerces.  However, I found out that if I add these two properties 
> to my runtime ant task then I do NOT need the xerces jar.
>
>            <sysproperty key="javax.xml.parsers.SAXParserFactory" 
> value="com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"/>
>            <sysproperty key="javax.xml.parsers.DocumentBuilderFactory" 
> value="com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/> 
>
>
> There is some classloader subtlety that I don't fully understand here.
>
> - Paul
>
> On 3/23/2009 8:17 AM, Rick Curtis wrote:
>> Paul -
>> I quickly looked through the javadoc for the 
>> http://java.sun.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance() 
>>
>> SAXParserFactory  and I'm thinking that your problem is something 
>> specific
>> to your environment.? I was able to run the examples on my box without
>> adding xercesImpl.jar to my classpath. With my JSE1.6 install,
>> SAXParserFactoryImpl is found in the [java_home]\lib\rt.jar.
>>
>> -Rick
>>
>> Paul Copeland wrote:
>>  
>>> More info on this.  I upgraded to Java SE 1.6.0_12 and I still need 
>>> the same jars (including xerces).
>>>
>>> Using OpenJPA 1.2 -
>>>
>>> 1) Only two jars are needed to compile my (very simple) test 
>>> application -
>>>
>>> - openjpa-1.2.0.jar
>>> - geronimo-jta_1.1_spec-1.1.jar
>>>
>>> 2) At runtime (standalone, not in a container) I also need these jars
>>> (plus JDBC driver of course) -
>>>
>>> - serp-1.13.1.jar
>>> - geronimo-jta_1.1_spec-1.1.jar
>>> - commons-collections-3.2.jar
>>> - commons-lang-2.1.jar
>>> - xercesImpl.jar
>>>
>>> 3) When I build and run the apache-openjpa-1.2.0/examples/hellojpa 
>>> (Derby example) I do NOT need xerces.
>>> ....
>>>
>>>     
>>
>>   
>


Re: Questions about classpath for OpenJPA

Posted by Paul Copeland <te...@jotobjects.com>.
Hi Rick -

Thanks. As I mentioned the openjpa example hellojpa also works for me 
WITHOUT the xerces jar.  But my very simple test app does not work with 
xerces.  However, I found out that if I add these two properties to my 
runtime ant task then I do NOT need the xerces jar.

            <sysproperty key="javax.xml.parsers.SAXParserFactory" 
value="com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"/>
            <sysproperty key="javax.xml.parsers.DocumentBuilderFactory" 
value="com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>

There is some classloader subtlety that I don't fully understand here.

- Paul

On 3/23/2009 8:17 AM, Rick Curtis wrote:
> Paul -
> I quickly looked through the javadoc for the 
> http://java.sun.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance()
> SAXParserFactory  and I'm thinking that your problem is something specific
> to your environment.? I was able to run the examples on my box without
> adding xercesImpl.jar to my classpath. With my JSE1.6 install,
> SAXParserFactoryImpl is found in the [java_home]\lib\rt.jar.
>
> -Rick
>
> Paul Copeland wrote:
>   
>> More info on this.  I upgraded to Java SE 1.6.0_12 and I still need the 
>> same jars (including xerces).
>>
>> Using OpenJPA 1.2 -
>>
>> 1) Only two jars are needed to compile my (very simple) test application -
>>
>> - openjpa-1.2.0.jar
>> - geronimo-jta_1.1_spec-1.1.jar
>>
>> 2) At runtime (standalone, not in a container) I also need these jars
>> (plus JDBC driver of course) -
>>
>> - serp-1.13.1.jar
>> - geronimo-jta_1.1_spec-1.1.jar
>> - commons-collections-3.2.jar
>> - commons-lang-2.1.jar
>> - xercesImpl.jar
>>
>> 3) When I build and run the apache-openjpa-1.2.0/examples/hellojpa 
>> (Derby example) I do NOT need xerces.
>> ....
>>
>>     
>
>   


Re: Questions about classpath for OpenJPA

Posted by Rick Curtis <cu...@gmail.com>.
Paul -
I quickly looked through the javadoc for the 
http://java.sun.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance()
SAXParserFactory  and I'm thinking that your problem is something specific
to your environment.? I was able to run the examples on my box without
adding xercesImpl.jar to my classpath. With my JSE1.6 install,
SAXParserFactoryImpl is found in the [java_home]\lib\rt.jar.

-Rick

Paul Copeland wrote:
> 
> More info on this.  I upgraded to Java SE 1.6.0_12 and I still need the 
> same jars (including xerces).
> 
> Using OpenJPA 1.2 -
> 
> 1) Only two jars are needed to compile my (very simple) test application -
> 
> - openjpa-1.2.0.jar
> - geronimo-jta_1.1_spec-1.1.jar
> 
> 2) At runtime (standalone, not in a container) I also need these jars
> (plus JDBC driver of course) -
> 
> - serp-1.13.1.jar
> - geronimo-jta_1.1_spec-1.1.jar
> - commons-collections-3.2.jar
> - commons-lang-2.1.jar
> - xercesImpl.jar
> 
> 3) When I build and run the apache-openjpa-1.2.0/examples/hellojpa 
> (Derby example) I do NOT need xerces.
> ....
> 

-- 
View this message in context: http://n2.nabble.com/Questions-about--classpath-for-OpenJPA-tp2504942p2521640.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Questions about classpath for OpenJPA

Posted by Paul Copeland <te...@jotobjects.com>.
More info on this.  I upgraded to Java SE 1.6.0_12 and I still need the 
same jars (including xerces).

Using OpenJPA 1.2 -

1) Only two jars are needed to compile my (very simple) test application -

- openjpa-1.2.0.jar
- geronimo-jta_1.1_spec-1.1.jar

2) At runtime (standalone, not in a container) I also need these jars (plus JDBC driver of course) -

- serp-1.13.1.jar
- geronimo-jta_1.1_spec-1.1.jar
- commons-collections-3.2.jar
- commons-lang-2.1.jar
- xercesImpl.jar

3) When I build and run the apache-openjpa-1.2.0/examples/hellojpa 
(Derby example) I do NOT need xerces.

But this is the exception I get (with both Postgres and Mysql) with my 
very simple app without xercesImpl.jar. This occurs on the call to 
Persistence.createEntityManagerFactory() -

     [java] javax.xml.parsers.FactoryConfigurationError: Provider 
org.apache.xerces.jaxp.SAXParserFactoryImpl not found
     [java]     at 
javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:134)
     [java]     at 
org.apache.openjpa.lib.xml.XMLFactory.<clinit>(XMLFactory.java:60)
     [java]     at 
org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataParser.java:352)
     [java]     at 
org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:318)
     [java]     at 
org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:295)
     [java]     at 
org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:268)
     [java]     at 
org.apache.openjpa.persistence.PersistenceProductDerivation$ConfigurationParser.parse(PersistenceProductDerivation.java:509)
     [java]     at 
org.apache.openjpa.persistence.PersistenceProductDerivation.parseResources(PersistenceProductDerivation.java:359)
     [java]     at 
org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:326)
     [java]     at 
org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:161)
     [java]     at 
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:77)
     [java]     at 
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:109)
     [java]     at 
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:53)
     [java]     at 
javax.persistence.Persistence.createFactory(Persistence.java:171)
     [java]     at 
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:111)
     [java]     at 
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:65)
     [java]     at org.bodega.testjpa.TestJpa1.main(TestJpa1.java:14)


On 3/20/2009 1:35 PM, Michael Dick wrote:
> Hi Paul,
>
> Sorry for the confusion. I thought you were building OpenJPA, not building
> an OpenJPA application. OpenJPA applications can compile with whatever JDK
> they like ( so long as it's >= 1.5).
>
> Regarding xerces, do you know if that dependency is pulled in because of
> OpenJPA, or because of commons-dbcp? In the performance related thread I had
> to pull xerces and ran into a bug with version 2.0.4 (IIRC might have been
> 2.4.0). I had to manually move up to 2.9.0 to get past the problem (might
> work with earlier versions, I just grabbed the latest from the maven
> repository).
>
> -mike
>
>
> On Fri, Mar 20, 2009 at 10:26 AM, Paul Copeland <te...@jotobjects.com> wrote:
>
>   
>> Interesting.  Does this Jira bug say that OpenJPA applications can compile
>> and run with Java 1.6 as long as they do not use JDBC 4 methods?  Another
>> item for the release notes :-) ...
>>
>> - Paul
>>
>>
>> On 3/19/2009 7:03 PM, Michael Dick wrote:
>>
>>     
>>> Hi Paul,
>>>
>>> Sadly 1.6 might not be the best move [1]
>>>
>>> [1] http://issues.apache.org/jira/browse/OPENJPA-5.
>>>
>>> It's been on the back burner for too long. At runtime you'll be fine with
>>> 1.6, but we still don't have the JDBC interfaces updated for v4.
>>>
>>> -mike
>>>
>>> On Thu, Mar 19, 2009 at 8:58 PM, Paul Copeland <te...@jotobjects.com>
>>> wrote:
>>>
>>>
>>>
>>>       
>>>> Thanks for the responses - Lots of good suggestions there.
>>>>
>>>> I had the older Java 1.5.0_05 already installed and haven't bothered to
>>>> update since I plan to go to 1.6.  Correct me if there is any reason why
>>>> I
>>>> shouldn't go to 1.6.
>>>>
>>>> My use case here is sort of the minimal case.  Others are using an IDE or
>>>> deploying on an application server where the dependencies are different.
>>>>
>>>> - Paul
>>>>
>>>>
>>>> On 3/19/2009 2:11 PM, Jeremy Bauer wrote:
>>>>
>>>>
>>>>
>>>>         
>>>>> Hi Paul,
>>>>>
>>>>> For Tomcat related information, you may be able to derive some
>>>>> information
>>>>> from this thread [1].  It began as a data source related issue but got
>>>>> into
>>>>> some configuration issues as well.
>>>>>
>>>>> I've only used Tomcat 5.5 with OpenJPA.  I'm not sure about Tomcat 6,
>>>>> but
>>>>> 5.5 did not come with geronimo spec api jars (or equivalents).  Here are
>>>>> the
>>>>> OpenJPA bundled jars that I needed to copy into the tomcat/common/lib
>>>>> directory:
>>>>>
>>>>> - openjpa-1.2.0.jar
>>>>> - serp-1.13.1.jar
>>>>> - geronimo-jta_1.1_spec-1.1.jar
>>>>> - geronimo-jpa_3.0_spec-1.0.jar
>>>>> - commons-collections-3.2.jar
>>>>> - commons-lang-2.1.jar
>>>>>
>>>>> You'll also need to make your JDBC driver jar(s) available to your
>>>>> app(s).
>>>>> I added them to common/lib.  You may also be able to bundle all these
>>>>> jars
>>>>> in your WAR, but I found it cleaner to make them common libs.
>>>>>
>>>>> You may choose to use JNDI data sources with Tomcat vs. direct
>>>>> configuration.  Here is a an article for configuring pooled data sources
>>>>> with Tomcat.[2]  Until you make the jump to Tomcat, here is a link for
>>>>> configuring pooled datasources with OpenJPA in a JSE environment using
>>>>> dbcp.[3]
>>>>>
>>>>> JRE 1.5.0_05 is fairly old.  I'd try updating to a newer JRE.  I'm
>>>>> currently
>>>>> using 1.5.0_15.  Just a guess, but something may be relying on parser
>>>>> related updates in newer versions of the JRE.
>>>>>
>>>>> [1]
>>>>>
>>>>>
>>>>> http://n2.nabble.com/Using-datasource-from-tomcat-with-openjpa-tt1449575.html#a1449832
>>>>>
>>>>> [2]
>>>>>
>>>>>
>>>>> http://www.onjava.com/pub/a/onjava/2006/04/19/database-connection-pooling-with-tomcat.html
>>>>>
>>>>> [3]
>>>>>
>>>>>
>>>>> http://webspherepersistence.blogspot.com/2009/01/jpa-connection-pooling.html
>>>>>
>>>>> hth,
>>>>> -Jeremy
>>>>>
>>>>> On Thu, Mar 19, 2009 at 2:33 PM, Paul Copeland <te...@jotobjects.com>
>>>>> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>           
>>>>>> I am just getting started and created a simple standalone (not in an
>>>>>> app
>>>>>> server container) JPA application working with both TopLink and OpenJPA
>>>>>> 1.2
>>>>>> and tested with both MySQL and Postgres.  This is with Java SE 1.5.0_05
>>>>>> building with Ant (not in in an IDE).
>>>>>>
>>>>>> By trial and error I found I needed the jar files downloaded in the
>>>>>> apache-openjpa-1.2.0 lib directory. I also needed xercesImpl.jar.  I
>>>>>> did
>>>>>> not
>>>>>> find these dependencies documented in the release notes, or in the
>>>>>> manual,
>>>>>> or on the Quickstart page  (http://openjpa.apache.org/quick-start.html
>>>>>> ).
>>>>>>
>>>>>> These were the necessary jars at either compile time or runtime -
>>>>>>
>>>>>> commons-collections-3.2.jar
>>>>>> commons-lang-2.1.jar
>>>>>> geronimo-jpa_3.0_spec-1.0.jar
>>>>>> geronimo-jta_1.1_spec-1.1.jar
>>>>>> openjpa-1.2.0.jar
>>>>>> serp-1.13.1.jar
>>>>>> xercesImpl.jar
>>>>>>
>>>>>> Probably I will also need commons-pool-1.3.jar or something similar for
>>>>>> Connection pooling.
>>>>>>
>>>>>> Presumably the geronimo jars are not needed in a Java 5 EE container.
>>>>>>  I'm
>>>>>> not sure why xerces is required since Java SE 1.5 has a SAX parser.  I
>>>>>> guess
>>>>>> all the other jars need to be deployed in the classpath in most other
>>>>>> contexts.
>>>>>>
>>>>>> This kind of dependency information might be usefully documented
>>>>>> somewhere.
>>>>>>  Every new user has to figure this stuff out.
>>>>>>
>>>>>> BTW - My target runtime environment will be Tomcat 6 + Java SE 1.6 +
>>>>>> OpenJPA 1.2 + Postgres 8.2.x
>>>>>>
>>>>>> Any experience or advice about what jars are required or is this
>>>>>> already
>>>>>> documented somewhere?
>>>>>>
>>>>>> Thanks - Paul
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>>
>>>>>           
>>>>         
>>>
>>>       
>>     
>
>   


Re: Questions about classpath for OpenJPA

Posted by Michael Dick <mi...@gmail.com>.
Hi Paul,

Sorry for the confusion. I thought you were building OpenJPA, not building
an OpenJPA application. OpenJPA applications can compile with whatever JDK
they like ( so long as it's >= 1.5).

Regarding xerces, do you know if that dependency is pulled in because of
OpenJPA, or because of commons-dbcp? In the performance related thread I had
to pull xerces and ran into a bug with version 2.0.4 (IIRC might have been
2.4.0). I had to manually move up to 2.9.0 to get past the problem (might
work with earlier versions, I just grabbed the latest from the maven
repository).

-mike


On Fri, Mar 20, 2009 at 10:26 AM, Paul Copeland <te...@jotobjects.com> wrote:

> Interesting.  Does this Jira bug say that OpenJPA applications can compile
> and run with Java 1.6 as long as they do not use JDBC 4 methods?  Another
> item for the release notes :-) ...
>
> - Paul
>
>
> On 3/19/2009 7:03 PM, Michael Dick wrote:
>
>> Hi Paul,
>>
>> Sadly 1.6 might not be the best move [1]
>>
>> [1] http://issues.apache.org/jira/browse/OPENJPA-5.
>>
>> It's been on the back burner for too long. At runtime you'll be fine with
>> 1.6, but we still don't have the JDBC interfaces updated for v4.
>>
>> -mike
>>
>> On Thu, Mar 19, 2009 at 8:58 PM, Paul Copeland <te...@jotobjects.com>
>> wrote:
>>
>>
>>
>>> Thanks for the responses - Lots of good suggestions there.
>>>
>>> I had the older Java 1.5.0_05 already installed and haven't bothered to
>>> update since I plan to go to 1.6.  Correct me if there is any reason why
>>> I
>>> shouldn't go to 1.6.
>>>
>>> My use case here is sort of the minimal case.  Others are using an IDE or
>>> deploying on an application server where the dependencies are different.
>>>
>>> - Paul
>>>
>>>
>>> On 3/19/2009 2:11 PM, Jeremy Bauer wrote:
>>>
>>>
>>>
>>>> Hi Paul,
>>>>
>>>> For Tomcat related information, you may be able to derive some
>>>> information
>>>> from this thread [1].  It began as a data source related issue but got
>>>> into
>>>> some configuration issues as well.
>>>>
>>>> I've only used Tomcat 5.5 with OpenJPA.  I'm not sure about Tomcat 6,
>>>> but
>>>> 5.5 did not come with geronimo spec api jars (or equivalents).  Here are
>>>> the
>>>> OpenJPA bundled jars that I needed to copy into the tomcat/common/lib
>>>> directory:
>>>>
>>>> - openjpa-1.2.0.jar
>>>> - serp-1.13.1.jar
>>>> - geronimo-jta_1.1_spec-1.1.jar
>>>> - geronimo-jpa_3.0_spec-1.0.jar
>>>> - commons-collections-3.2.jar
>>>> - commons-lang-2.1.jar
>>>>
>>>> You'll also need to make your JDBC driver jar(s) available to your
>>>> app(s).
>>>> I added them to common/lib.  You may also be able to bundle all these
>>>> jars
>>>> in your WAR, but I found it cleaner to make them common libs.
>>>>
>>>> You may choose to use JNDI data sources with Tomcat vs. direct
>>>> configuration.  Here is a an article for configuring pooled data sources
>>>> with Tomcat.[2]  Until you make the jump to Tomcat, here is a link for
>>>> configuring pooled datasources with OpenJPA in a JSE environment using
>>>> dbcp.[3]
>>>>
>>>> JRE 1.5.0_05 is fairly old.  I'd try updating to a newer JRE.  I'm
>>>> currently
>>>> using 1.5.0_15.  Just a guess, but something may be relying on parser
>>>> related updates in newer versions of the JRE.
>>>>
>>>> [1]
>>>>
>>>>
>>>> http://n2.nabble.com/Using-datasource-from-tomcat-with-openjpa-tt1449575.html#a1449832
>>>>
>>>> [2]
>>>>
>>>>
>>>> http://www.onjava.com/pub/a/onjava/2006/04/19/database-connection-pooling-with-tomcat.html
>>>>
>>>> [3]
>>>>
>>>>
>>>> http://webspherepersistence.blogspot.com/2009/01/jpa-connection-pooling.html
>>>>
>>>> hth,
>>>> -Jeremy
>>>>
>>>> On Thu, Mar 19, 2009 at 2:33 PM, Paul Copeland <te...@jotobjects.com>
>>>> wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> I am just getting started and created a simple standalone (not in an
>>>>> app
>>>>> server container) JPA application working with both TopLink and OpenJPA
>>>>> 1.2
>>>>> and tested with both MySQL and Postgres.  This is with Java SE 1.5.0_05
>>>>> building with Ant (not in in an IDE).
>>>>>
>>>>> By trial and error I found I needed the jar files downloaded in the
>>>>> apache-openjpa-1.2.0 lib directory. I also needed xercesImpl.jar.  I
>>>>> did
>>>>> not
>>>>> find these dependencies documented in the release notes, or in the
>>>>> manual,
>>>>> or on the Quickstart page  (http://openjpa.apache.org/quick-start.html
>>>>> ).
>>>>>
>>>>> These were the necessary jars at either compile time or runtime -
>>>>>
>>>>> commons-collections-3.2.jar
>>>>> commons-lang-2.1.jar
>>>>> geronimo-jpa_3.0_spec-1.0.jar
>>>>> geronimo-jta_1.1_spec-1.1.jar
>>>>> openjpa-1.2.0.jar
>>>>> serp-1.13.1.jar
>>>>> xercesImpl.jar
>>>>>
>>>>> Probably I will also need commons-pool-1.3.jar or something similar for
>>>>> Connection pooling.
>>>>>
>>>>> Presumably the geronimo jars are not needed in a Java 5 EE container.
>>>>>  I'm
>>>>> not sure why xerces is required since Java SE 1.5 has a SAX parser.  I
>>>>> guess
>>>>> all the other jars need to be deployed in the classpath in most other
>>>>> contexts.
>>>>>
>>>>> This kind of dependency information might be usefully documented
>>>>> somewhere.
>>>>>  Every new user has to figure this stuff out.
>>>>>
>>>>> BTW - My target runtime environment will be Tomcat 6 + Java SE 1.6 +
>>>>> OpenJPA 1.2 + Postgres 8.2.x
>>>>>
>>>>> Any experience or advice about what jars are required or is this
>>>>> already
>>>>> documented somewhere?
>>>>>
>>>>> Thanks - Paul
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
>
>

Re: Questions about classpath for OpenJPA

Posted by Paul Copeland <te...@jotobjects.com>.
Interesting.  Does this Jira bug say that OpenJPA applications can 
compile and run with Java 1.6 as long as they do not use JDBC 4 
methods?  Another item for the release notes :-) ...

- Paul

On 3/19/2009 7:03 PM, Michael Dick wrote:
> Hi Paul,
>
> Sadly 1.6 might not be the best move [1]
>
> [1] http://issues.apache.org/jira/browse/OPENJPA-5.
>
> It's been on the back burner for too long. At runtime you'll be fine with
> 1.6, but we still don't have the JDBC interfaces updated for v4.
>
> -mike
>
> On Thu, Mar 19, 2009 at 8:58 PM, Paul Copeland <te...@jotobjects.com> wrote:
>
>   
>> Thanks for the responses - Lots of good suggestions there.
>>
>> I had the older Java 1.5.0_05 already installed and haven't bothered to
>> update since I plan to go to 1.6.  Correct me if there is any reason why I
>> shouldn't go to 1.6.
>>
>> My use case here is sort of the minimal case.  Others are using an IDE or
>> deploying on an application server where the dependencies are different.
>>
>> - Paul
>>
>>
>> On 3/19/2009 2:11 PM, Jeremy Bauer wrote:
>>
>>     
>>> Hi Paul,
>>>
>>> For Tomcat related information, you may be able to derive some information
>>> from this thread [1].  It began as a data source related issue but got
>>> into
>>> some configuration issues as well.
>>>
>>> I've only used Tomcat 5.5 with OpenJPA.  I'm not sure about Tomcat 6, but
>>> 5.5 did not come with geronimo spec api jars (or equivalents).  Here are
>>> the
>>> OpenJPA bundled jars that I needed to copy into the tomcat/common/lib
>>> directory:
>>>
>>> - openjpa-1.2.0.jar
>>> - serp-1.13.1.jar
>>> - geronimo-jta_1.1_spec-1.1.jar
>>> - geronimo-jpa_3.0_spec-1.0.jar
>>> - commons-collections-3.2.jar
>>> - commons-lang-2.1.jar
>>>
>>> You'll also need to make your JDBC driver jar(s) available to your app(s).
>>> I added them to common/lib.  You may also be able to bundle all these jars
>>> in your WAR, but I found it cleaner to make them common libs.
>>>
>>> You may choose to use JNDI data sources with Tomcat vs. direct
>>> configuration.  Here is a an article for configuring pooled data sources
>>> with Tomcat.[2]  Until you make the jump to Tomcat, here is a link for
>>> configuring pooled datasources with OpenJPA in a JSE environment using
>>> dbcp.[3]
>>>
>>> JRE 1.5.0_05 is fairly old.  I'd try updating to a newer JRE.  I'm
>>> currently
>>> using 1.5.0_15.  Just a guess, but something may be relying on parser
>>> related updates in newer versions of the JRE.
>>>
>>> [1]
>>>
>>> http://n2.nabble.com/Using-datasource-from-tomcat-with-openjpa-tt1449575.html#a1449832
>>>
>>> [2]
>>>
>>> http://www.onjava.com/pub/a/onjava/2006/04/19/database-connection-pooling-with-tomcat.html
>>>
>>> [3]
>>>
>>> http://webspherepersistence.blogspot.com/2009/01/jpa-connection-pooling.html
>>>
>>> hth,
>>> -Jeremy
>>>
>>> On Thu, Mar 19, 2009 at 2:33 PM, Paul Copeland <te...@jotobjects.com>
>>> wrote:
>>>
>>>
>>>
>>>       
>>>> I am just getting started and created a simple standalone (not in an app
>>>> server container) JPA application working with both TopLink and OpenJPA
>>>> 1.2
>>>> and tested with both MySQL and Postgres.  This is with Java SE 1.5.0_05
>>>> building with Ant (not in in an IDE).
>>>>
>>>> By trial and error I found I needed the jar files downloaded in the
>>>> apache-openjpa-1.2.0 lib directory. I also needed xercesImpl.jar.  I did
>>>> not
>>>> find these dependencies documented in the release notes, or in the
>>>> manual,
>>>> or on the Quickstart page  (http://openjpa.apache.org/quick-start.html).
>>>>
>>>> These were the necessary jars at either compile time or runtime -
>>>>
>>>> commons-collections-3.2.jar
>>>> commons-lang-2.1.jar
>>>> geronimo-jpa_3.0_spec-1.0.jar
>>>> geronimo-jta_1.1_spec-1.1.jar
>>>> openjpa-1.2.0.jar
>>>> serp-1.13.1.jar
>>>> xercesImpl.jar
>>>>
>>>> Probably I will also need commons-pool-1.3.jar or something similar for
>>>> Connection pooling.
>>>>
>>>> Presumably the geronimo jars are not needed in a Java 5 EE container.
>>>>  I'm
>>>> not sure why xerces is required since Java SE 1.5 has a SAX parser.  I
>>>> guess
>>>> all the other jars need to be deployed in the classpath in most other
>>>> contexts.
>>>>
>>>> This kind of dependency information might be usefully documented
>>>> somewhere.
>>>>  Every new user has to figure this stuff out.
>>>>
>>>> BTW - My target runtime environment will be Tomcat 6 + Java SE 1.6 +
>>>> OpenJPA 1.2 + Postgres 8.2.x
>>>>
>>>> Any experience or advice about what jars are required or is this already
>>>> documented somewhere?
>>>>
>>>> Thanks - Paul
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>         
>>>
>>>       
>>     
>
>   


Re: Questions about classpath for OpenJPA

Posted by Michael Dick <mi...@gmail.com>.
Hi Paul,

Sadly 1.6 might not be the best move [1]

[1] http://issues.apache.org/jira/browse/OPENJPA-5.

It's been on the back burner for too long. At runtime you'll be fine with
1.6, but we still don't have the JDBC interfaces updated for v4.

-mike

On Thu, Mar 19, 2009 at 8:58 PM, Paul Copeland <te...@jotobjects.com> wrote:

> Thanks for the responses - Lots of good suggestions there.
>
> I had the older Java 1.5.0_05 already installed and haven't bothered to
> update since I plan to go to 1.6.  Correct me if there is any reason why I
> shouldn't go to 1.6.
>
> My use case here is sort of the minimal case.  Others are using an IDE or
> deploying on an application server where the dependencies are different.
>
> - Paul
>
>
> On 3/19/2009 2:11 PM, Jeremy Bauer wrote:
>
>> Hi Paul,
>>
>> For Tomcat related information, you may be able to derive some information
>> from this thread [1].  It began as a data source related issue but got
>> into
>> some configuration issues as well.
>>
>> I've only used Tomcat 5.5 with OpenJPA.  I'm not sure about Tomcat 6, but
>> 5.5 did not come with geronimo spec api jars (or equivalents).  Here are
>> the
>> OpenJPA bundled jars that I needed to copy into the tomcat/common/lib
>> directory:
>>
>> - openjpa-1.2.0.jar
>> - serp-1.13.1.jar
>> - geronimo-jta_1.1_spec-1.1.jar
>> - geronimo-jpa_3.0_spec-1.0.jar
>> - commons-collections-3.2.jar
>> - commons-lang-2.1.jar
>>
>> You'll also need to make your JDBC driver jar(s) available to your app(s).
>> I added them to common/lib.  You may also be able to bundle all these jars
>> in your WAR, but I found it cleaner to make them common libs.
>>
>> You may choose to use JNDI data sources with Tomcat vs. direct
>> configuration.  Here is a an article for configuring pooled data sources
>> with Tomcat.[2]  Until you make the jump to Tomcat, here is a link for
>> configuring pooled datasources with OpenJPA in a JSE environment using
>> dbcp.[3]
>>
>> JRE 1.5.0_05 is fairly old.  I'd try updating to a newer JRE.  I'm
>> currently
>> using 1.5.0_15.  Just a guess, but something may be relying on parser
>> related updates in newer versions of the JRE.
>>
>> [1]
>>
>> http://n2.nabble.com/Using-datasource-from-tomcat-with-openjpa-tt1449575.html#a1449832
>>
>> [2]
>>
>> http://www.onjava.com/pub/a/onjava/2006/04/19/database-connection-pooling-with-tomcat.html
>>
>> [3]
>>
>> http://webspherepersistence.blogspot.com/2009/01/jpa-connection-pooling.html
>>
>> hth,
>> -Jeremy
>>
>> On Thu, Mar 19, 2009 at 2:33 PM, Paul Copeland <te...@jotobjects.com>
>> wrote:
>>
>>
>>
>>> I am just getting started and created a simple standalone (not in an app
>>> server container) JPA application working with both TopLink and OpenJPA
>>> 1.2
>>> and tested with both MySQL and Postgres.  This is with Java SE 1.5.0_05
>>> building with Ant (not in in an IDE).
>>>
>>> By trial and error I found I needed the jar files downloaded in the
>>> apache-openjpa-1.2.0 lib directory. I also needed xercesImpl.jar.  I did
>>> not
>>> find these dependencies documented in the release notes, or in the
>>> manual,
>>> or on the Quickstart page  (http://openjpa.apache.org/quick-start.html).
>>>
>>> These were the necessary jars at either compile time or runtime -
>>>
>>> commons-collections-3.2.jar
>>> commons-lang-2.1.jar
>>> geronimo-jpa_3.0_spec-1.0.jar
>>> geronimo-jta_1.1_spec-1.1.jar
>>> openjpa-1.2.0.jar
>>> serp-1.13.1.jar
>>> xercesImpl.jar
>>>
>>> Probably I will also need commons-pool-1.3.jar or something similar for
>>> Connection pooling.
>>>
>>> Presumably the geronimo jars are not needed in a Java 5 EE container.
>>>  I'm
>>> not sure why xerces is required since Java SE 1.5 has a SAX parser.  I
>>> guess
>>> all the other jars need to be deployed in the classpath in most other
>>> contexts.
>>>
>>> This kind of dependency information might be usefully documented
>>> somewhere.
>>>  Every new user has to figure this stuff out.
>>>
>>> BTW - My target runtime environment will be Tomcat 6 + Java SE 1.6 +
>>> OpenJPA 1.2 + Postgres 8.2.x
>>>
>>> Any experience or advice about what jars are required or is this already
>>> documented somewhere?
>>>
>>> Thanks - Paul
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>
>

Re: Questions about classpath for OpenJPA

Posted by Paul Copeland <te...@jotobjects.com>.
Thanks for the responses - Lots of good suggestions there.

I had the older Java 1.5.0_05 already installed and haven't bothered to 
update since I plan to go to 1.6.  Correct me if there is any reason why 
I shouldn't go to 1.6.

My use case here is sort of the minimal case.  Others are using an IDE 
or deploying on an application server where the dependencies are different.

- Paul

On 3/19/2009 2:11 PM, Jeremy Bauer wrote:
> Hi Paul,
>
> For Tomcat related information, you may be able to derive some information
> from this thread [1].  It began as a data source related issue but got into
> some configuration issues as well.
>
> I've only used Tomcat 5.5 with OpenJPA.  I'm not sure about Tomcat 6, but
> 5.5 did not come with geronimo spec api jars (or equivalents).  Here are the
> OpenJPA bundled jars that I needed to copy into the tomcat/common/lib
> directory:
>
> - openjpa-1.2.0.jar
> - serp-1.13.1.jar
> - geronimo-jta_1.1_spec-1.1.jar
> - geronimo-jpa_3.0_spec-1.0.jar
> - commons-collections-3.2.jar
> - commons-lang-2.1.jar
>
> You'll also need to make your JDBC driver jar(s) available to your app(s).
> I added them to common/lib.  You may also be able to bundle all these jars
> in your WAR, but I found it cleaner to make them common libs.
>
> You may choose to use JNDI data sources with Tomcat vs. direct
> configuration.  Here is a an article for configuring pooled data sources
> with Tomcat.[2]  Until you make the jump to Tomcat, here is a link for
> configuring pooled datasources with OpenJPA in a JSE environment using
> dbcp.[3]
>
> JRE 1.5.0_05 is fairly old.  I'd try updating to a newer JRE.  I'm currently
> using 1.5.0_15.  Just a guess, but something may be relying on parser
> related updates in newer versions of the JRE.
>
> [1]
> http://n2.nabble.com/Using-datasource-from-tomcat-with-openjpa-tt1449575.html#a1449832
>
> [2]
> http://www.onjava.com/pub/a/onjava/2006/04/19/database-connection-pooling-with-tomcat.html
>
> [3]
> http://webspherepersistence.blogspot.com/2009/01/jpa-connection-pooling.html
>
> hth,
> -Jeremy
>
> On Thu, Mar 19, 2009 at 2:33 PM, Paul Copeland <te...@jotobjects.com> wrote:
>
>   
>> I am just getting started and created a simple standalone (not in an app
>> server container) JPA application working with both TopLink and OpenJPA 1.2
>> and tested with both MySQL and Postgres.  This is with Java SE 1.5.0_05
>> building with Ant (not in in an IDE).
>>
>> By trial and error I found I needed the jar files downloaded in the
>> apache-openjpa-1.2.0 lib directory. I also needed xercesImpl.jar.  I did not
>> find these dependencies documented in the release notes, or in the manual,
>> or on the Quickstart page  (http://openjpa.apache.org/quick-start.html).
>>
>> These were the necessary jars at either compile time or runtime -
>>
>> commons-collections-3.2.jar
>> commons-lang-2.1.jar
>> geronimo-jpa_3.0_spec-1.0.jar
>> geronimo-jta_1.1_spec-1.1.jar
>> openjpa-1.2.0.jar
>> serp-1.13.1.jar
>> xercesImpl.jar
>>
>> Probably I will also need commons-pool-1.3.jar or something similar for
>> Connection pooling.
>>
>> Presumably the geronimo jars are not needed in a Java 5 EE container.  I'm
>> not sure why xerces is required since Java SE 1.5 has a SAX parser.  I guess
>> all the other jars need to be deployed in the classpath in most other
>> contexts.
>>
>> This kind of dependency information might be usefully documented somewhere.
>>  Every new user has to figure this stuff out.
>>
>> BTW - My target runtime environment will be Tomcat 6 + Java SE 1.6 +
>> OpenJPA 1.2 + Postgres 8.2.x
>>
>> Any experience or advice about what jars are required or is this already
>> documented somewhere?
>>
>> Thanks - Paul
>>
>>
>>
>>     
>
>   


Re: Questions about classpath for OpenJPA

Posted by Jeremy Bauer <te...@gmail.com>.
Hi Paul,

For Tomcat related information, you may be able to derive some information
from this thread [1].  It began as a data source related issue but got into
some configuration issues as well.

I've only used Tomcat 5.5 with OpenJPA.  I'm not sure about Tomcat 6, but
5.5 did not come with geronimo spec api jars (or equivalents).  Here are the
OpenJPA bundled jars that I needed to copy into the tomcat/common/lib
directory:

- openjpa-1.2.0.jar
- serp-1.13.1.jar
- geronimo-jta_1.1_spec-1.1.jar
- geronimo-jpa_3.0_spec-1.0.jar
- commons-collections-3.2.jar
- commons-lang-2.1.jar

You'll also need to make your JDBC driver jar(s) available to your app(s).
I added them to common/lib.  You may also be able to bundle all these jars
in your WAR, but I found it cleaner to make them common libs.

You may choose to use JNDI data sources with Tomcat vs. direct
configuration.  Here is a an article for configuring pooled data sources
with Tomcat.[2]  Until you make the jump to Tomcat, here is a link for
configuring pooled datasources with OpenJPA in a JSE environment using
dbcp.[3]

JRE 1.5.0_05 is fairly old.  I'd try updating to a newer JRE.  I'm currently
using 1.5.0_15.  Just a guess, but something may be relying on parser
related updates in newer versions of the JRE.

[1]
http://n2.nabble.com/Using-datasource-from-tomcat-with-openjpa-tt1449575.html#a1449832

[2]
http://www.onjava.com/pub/a/onjava/2006/04/19/database-connection-pooling-with-tomcat.html

[3]
http://webspherepersistence.blogspot.com/2009/01/jpa-connection-pooling.html

hth,
-Jeremy

On Thu, Mar 19, 2009 at 2:33 PM, Paul Copeland <te...@jotobjects.com> wrote:

> I am just getting started and created a simple standalone (not in an app
> server container) JPA application working with both TopLink and OpenJPA 1.2
> and tested with both MySQL and Postgres.  This is with Java SE 1.5.0_05
> building with Ant (not in in an IDE).
>
> By trial and error I found I needed the jar files downloaded in the
> apache-openjpa-1.2.0 lib directory. I also needed xercesImpl.jar.  I did not
> find these dependencies documented in the release notes, or in the manual,
> or on the Quickstart page  (http://openjpa.apache.org/quick-start.html).
>
> These were the necessary jars at either compile time or runtime -
>
> commons-collections-3.2.jar
> commons-lang-2.1.jar
> geronimo-jpa_3.0_spec-1.0.jar
> geronimo-jta_1.1_spec-1.1.jar
> openjpa-1.2.0.jar
> serp-1.13.1.jar
> xercesImpl.jar
>
> Probably I will also need commons-pool-1.3.jar or something similar for
> Connection pooling.
>
> Presumably the geronimo jars are not needed in a Java 5 EE container.  I'm
> not sure why xerces is required since Java SE 1.5 has a SAX parser.  I guess
> all the other jars need to be deployed in the classpath in most other
> contexts.
>
> This kind of dependency information might be usefully documented somewhere.
>  Every new user has to figure this stuff out.
>
> BTW - My target runtime environment will be Tomcat 6 + Java SE 1.6 +
> OpenJPA 1.2 + Postgres 8.2.x
>
> Any experience or advice about what jars are required or is this already
> documented somewhere?
>
> Thanks - Paul
>
>
>

Re: Questions about classpath for OpenJPA

Posted by Kevin Sutter <kw...@gmail.com>.
I have no idea why there's a dependency on xercesImpl...  First time I have
heard of this.

I agree that our QuickStart needs some work.  Volunteers are always
welcome.  :-)

Kevin

On Thu, Mar 19, 2009 at 2:58 PM, Georgi Naplatanov <go...@oles.biz> wrote:

> Hello Paul.
>
> You may consider to add commons-dbcp and commons-pool jars for
> connection pooling. You may use commons-pool for pooling EntityManager
> instances.
>
> Best regards
> Georgi
>
> Paul Copeland wrote:
> > I am just getting started and created a simple standalone (not in an app
> > server container) JPA application working with both TopLink and OpenJPA
> > 1.2 and tested with both MySQL and Postgres.  This is with Java SE
> > 1.5.0_05 building with Ant (not in in an IDE).
> >
> > By trial and error I found I needed the jar files downloaded in the
> > apache-openjpa-1.2.0 lib directory. I also needed xercesImpl.jar.  I did
> > not find these dependencies documented in the release notes, or in the
> > manual, or on the Quickstart page
> > (http://openjpa.apache.org/quick-start.html).
> >
> > These were the necessary jars at either compile time or runtime -
> >
> > commons-collections-3.2.jar
> > commons-lang-2.1.jar
> > geronimo-jpa_3.0_spec-1.0.jar
> > geronimo-jta_1.1_spec-1.1.jar
> > openjpa-1.2.0.jar
> > serp-1.13.1.jar
> > xercesImpl.jar
> >
> > Probably I will also need commons-pool-1.3.jar or something similar for
> > Connection pooling.
> >
> > Presumably the geronimo jars are not needed in a Java 5 EE container.
> > I'm not sure why xerces is required since Java SE 1.5 has a SAX parser.
> > I guess all the other jars need to be deployed in the classpath in most
> > other contexts.
> >
> > This kind of dependency information might be usefully documented
> > somewhere.  Every new user has to figure this stuff out.
> >
> > BTW - My target runtime environment will be Tomcat 6 + Java SE 1.6 +
> > OpenJPA 1.2 + Postgres 8.2.x
> >
> > Any experience or advice about what jars are required or is this already
> > documented somewhere?
> >
> > Thanks - Paul
> >
> >
>
>

Re: Questions about classpath for OpenJPA

Posted by Georgi Naplatanov <go...@oles.biz>.
Hello Paul.

You may consider to add commons-dbcp and commons-pool jars for
connection pooling. You may use commons-pool for pooling EntityManager
instances.

Best regards
Georgi

Paul Copeland wrote:
> I am just getting started and created a simple standalone (not in an app
> server container) JPA application working with both TopLink and OpenJPA
> 1.2 and tested with both MySQL and Postgres.  This is with Java SE
> 1.5.0_05 building with Ant (not in in an IDE).
> 
> By trial and error I found I needed the jar files downloaded in the
> apache-openjpa-1.2.0 lib directory. I also needed xercesImpl.jar.  I did
> not find these dependencies documented in the release notes, or in the
> manual, or on the Quickstart page 
> (http://openjpa.apache.org/quick-start.html).
> 
> These were the necessary jars at either compile time or runtime -
> 
> commons-collections-3.2.jar
> commons-lang-2.1.jar
> geronimo-jpa_3.0_spec-1.0.jar
> geronimo-jta_1.1_spec-1.1.jar
> openjpa-1.2.0.jar
> serp-1.13.1.jar
> xercesImpl.jar
> 
> Probably I will also need commons-pool-1.3.jar or something similar for
> Connection pooling.
> 
> Presumably the geronimo jars are not needed in a Java 5 EE container. 
> I'm not sure why xerces is required since Java SE 1.5 has a SAX parser. 
> I guess all the other jars need to be deployed in the classpath in most
> other contexts.
> 
> This kind of dependency information might be usefully documented
> somewhere.  Every new user has to figure this stuff out.
> 
> BTW - My target runtime environment will be Tomcat 6 + Java SE 1.6 +
> OpenJPA 1.2 + Postgres 8.2.x
> 
> Any experience or advice about what jars are required or is this already
> documented somewhere?
> 
> Thanks - Paul
> 
>