Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] OC4J Tricks - Ramifications?

Micahel, my issue is this:

If I put the data source & provider tags in my persistence.xml then
OC4J has class loading issues, which I assume is because I'm using a
user lib in my war for eclipselink.jar and the persistence.jar rather
than a shared server lib, so it tries to start up the persistence
layer before my app's WEB-INF/lib is loaded, resulting in no class def
issues on entities. That option is out to me, as I'll have a hard time
convincing the server admins to rearrange things for me.

I tried to set my transaction type to RESOURCE_LOCAL and removed my
orion-application.xml from the ear but OC4J still tried to use the
default data source.

My goal:
Deploy to vanilla OC4J without having to define a data source on the
server that ultimately is never used. I can live with the work around
of defining a data source or default data source, just to make the
OC4J Deploy happy, but it seems wasteful.

I suppose I could change my spring app to use a JNDI data source, but
then I'd have some issues deploying to WTP's J2EE Preview Jetty Server
locally.

./tch



On Tue, Dec 1, 2009 at 12:46 PM, Michael O'Brien
<michael.obrien@xxxxxxxxxx> wrote:
> Tim,
>     Try a non-jta-data-source if you need a DS that is not transactional.
>     Switch from transaction-type JTA to RESOURCE_LOCAL (usually only in SE)
> - in that case it will not be managed by the server, you will need your own
> javax.persistence.jdbc.* properties and will not be using the server's
> connection pool.  Sounds like you are in a similar situation as most Tomcat
> users and want to run in partial SE mode on the server.
>     thank you
>     /michael
>
> Tim Hollosy wrote:
>
> Thanks Michael,
> So is there some setting to force OC4J to not try to use a data source
> for an app? I find it silly that I have to define a datasource for my
> app in the orion-application.xml even though I'm not using a JNDI data
> source. The wiki page says to override the OracleDS, but obviously
> this doesn't work in a production environment with multiple apps
> deployed on the same server.
>
> ./tch
>
>
>
> On Tue, Dec 1, 2009 at 10:23 AM, Michael O'Brien
> <michael.obrien@xxxxxxxxxx> wrote:
>
>
> Tim,
>   Thank you for the end to end verification of EclipseLink EAR deployment on
> OC4J that includes Spring - the details of your issues are very useful.
>   There is a repository of info that may be of interest on the OC4J tutorial
> (updated for 10.1.3.5) for EclipseLink JPA EE applications that detail some
> scenarios around the default OracleDS JTA datasource, overriding the
> essentials provider with EclipseLink and integration with the Eclipse EE IDE
> server pluggin which handles the custom orion descriptor for the developer -
> in the case of the simple tutorial app that uses the default OracleDS - one
> is not required yet.
>   A non-jta and application managed DS section would be beneficial.
>   http://wiki.eclipse.org/EclipseLink/Examples/JPA/OC4J_Web_Tutorial
>
>   /michael
>   http://www.eclipselink.org
>
> Tim Hollosy wrote:
>
>
> I've been playing around with OC4J Deploys, my goal is to deploy into
> a vanilla OC4J Instance. I'm posting how I did it for people who may
> be struggling with the same issues, and also to get a  sanity check
> from the Oracle people.
>
> My app uses Spring's Transaction manager and a c3p0 data source,
> defined in my app context.xml, an eclipselink.jar and persistance.jar
> in my /WEB-INF/lib.
>
> Anyway on OC4J 10.1.3.5.0 Here are the Issues I ran into.
>
> Initial deploy, my ear file does not contain an orion-application.xml,
> persistence.xml does not specificially reference eclipselink as the
> JPA provider.
>
> Deploy fails, when OC4J decides to start up the default data source
> defined in the server's application.xml jdbc/OracleDS. So I decide to
> define my own orion-application.xml and tell it to use my own
> data-source.
>
> It looked like this:
> <orion-application
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>
> xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-application-10_0.xsd";
>  deployment-version="10.1.3.1.0" default-data-source="jdbc/myDS"
> component-classification="external" schema-major-version="10"
> schema-minor-version="0" >
>    <imported-shared-libraries>
>        <remove-inherited name="oracle.toplink"/>
>        <remove-inherited name="oracle.persistence"/>
>    </imported-shared-libraries>
> </orion-application>
>
> I now reference the datasource in my persistence.xml like:
>
> <jta-data-source>jdbc/myDS</jta-data-source>
>
> I then get an error like:
>
> Exception creating EntityManagerFactory
> using PersistenceProvider class
> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider for
> persistence unit
>
> So, I add
> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
> to my persistence.xml, now I get further, but now I get weird naming
> errors, and class loader issues. I look into this and it appears
> that's because of the way the shared libraries are loaded, and the
> wiki says I need to modify a bunch of system.xml files and define a
> shared library, bla, bla, bla. I can smell the headaches when I need
> to explain this to the production server admins.
>
> So, I end up removing the jta-data-source and provider entries from my
> persistence.xml and change my orion-application.xml to look like:
> <orion-application
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>
> xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-application-10_0.xsd";
>  deployment-version="10.1.3.1.0" default-data-source="jdbc/myDS"
> component-classification="external" schema-major-version="10"
> schema-minor-version="0" >
>
> </orion-application>
>
>
> I also need to define the datasource on the server even though I don't
> use it, otherwise OC4J will force me to use the default data source
> which is not defined on the server.
>
> Looking at the logs my app works now, and data source defined in
> spring is being used.
>
> What are the ramifications of bypassing OC4J's transaction
> handling/persitance voodoo? I'm still using the OC4J load time weaver
> for spring, but as far as I can tell Spring is managing the connection
> and transactions so I won't get the fancy transaction failover OC4J
> JTA offers.
>
> I'd really like to not have to define a datasource to make OC4J go
> through with the deploy, but it's the only way I can find to deploy an
> eclipselink app to OC4J without the need for server xml hacking,
> perhaps in future versions it will be easier to use OC4J with
> Eclipselink since they're part of the same tech stack.
>
> ./tch
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>


Back to the top