Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Examples/JPA/Spring Web Tutorial"

m (WebLogic 10.3.3.0 Default Spring Support)
m
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
=EclipseLink JPA Deployed on Spring=
+
<!--=EclipseLink JPA Deployed on Spring=
 
<div style="border: 3px red solid;" align="center" ><font color="red">DISCLAIMER: This page reflects investigation into how EclipseLink users can use EclipseLink JPA and the Spring Framework inside existing WebLogic and Spring releases. It does NOT imply any formal certification from Oracle or SpringSource on any technical details or configuration within this document this time.</font></div>  
 
<div style="border: 3px red solid;" align="center" ><font color="red">DISCLAIMER: This page reflects investigation into how EclipseLink users can use EclipseLink JPA and the Spring Framework inside existing WebLogic and Spring releases. It does NOT imply any formal certification from Oracle or SpringSource on any technical details or configuration within this document this time.</font></div>  
  
Line 86: Line 86:
 
         </init-param>
 
         </init-param>
 
     </servlet>
 
     </servlet>
    <!-- standard web.xml (non-Spring) - leave commented -->
 
    <!-- servlet>
 
      <description></description>
 
      <display-name>FrontController</display-name>
 
      <servlet-name>FrontController</servlet-name>
 
      <servlet-class>org.eclipse.persistence.example.jpa.spring.presentation.FrontController</servlet-class>
 
    </servlet-->
 
 
</source>
 
</source>
 
*The reason that the '''org.springframework.web.servlet.DispatcherServlet''' class cannot be loaded by WebLogic is either that it is unavailable or that there is another version in the classpath (not likely or we would get a ClassCastException).
 
*The reason that the '''org.springframework.web.servlet.DispatcherServlet''' class cannot be loaded by WebLogic is either that it is unavailable or that there is another version in the classpath (not likely or we would get a ClassCastException).
 
*The '''DispatcherServlet''' is inside '''org.springframework.web.servlet-3.0.5.RELEASE.jar'''
 
*The '''DispatcherServlet''' is inside '''org.springframework.web.servlet-3.0.5.RELEASE.jar'''
 
*You therefore need to distribute the Spring jars or place them on the server as explained in the section
 
*You therefore need to distribute the Spring jars or place them on the server as explained in the section
 +
====Systematic Inclusion of Spring libraries in WebLogic====
 +
*The goal is to get the latest Spring 3.0.5 working with the latest WebLogic 10.3.3.0.  Hopefully we do not need to rever to using the supported Spring 3.5.3 or 3.5.6 versions.
 +
*The following ClassNotFoundExceptions are being eradicated one at a time usually be easily matching the class with the appropriate 1 of 20 Spring module.  It would be nice to use some sort of OSGI support for dynamic module loading - we are only using PDE at this point.
 +
**1) '''org.springframework.web.servlet.DispatcherServlet''' is in ''org.springframework.web.servlet-3.0.5.RELEASE.jar''
 +
**2) '''org.apache.commons.logging.Log''' is in ''commons-logging.jar''
 +
**3) '''org.springframework.web.util.UrlPathHelper''' is in ''org.springframework.web-3.0.5.RELEASE.jar''
 +
**4) '''org.springframework.context.ApplicationContext''' is in ''org.springframework.context-3.0.5.RELEASE.jar''
 +
**5) '''org.springframework.beans.factory.ListableBeanFactory''' is in ''org.springframework.beans-3.0.5.RELEASE.jar''
 +
**6) '''org.springframework.core.io.support.ResourcePatternResolver''' is in ''org.springframework.core-3.0.5.RELEASE.jar''
 +
*Alright, we are now deployed and at the point where we are looking for the persistence unit - which is not properly configured yet.
 +
<source lang="java">
 +
Caused By: java.lang.IllegalArgumentException: No persistence unit named 'spring' is available in scope springhypercube. Available persistence units: []
 +
at weblogic.deployment.ModulePersistenceUnitRegistry.getPersistenceUnit(ModulePersistenceUnitRegistry.java:132)
 +
at weblogic.deployment.BasePersistenceContextProxyImpl.<init>(BasePersistenceContextProxyImpl.java:39)
 +
</source>
 +
*We are currently running on a modified server (so we do not have to ship the Spring modules with the EAR/WAR) with the following change to '''$WLS_Server/wlserver_10.3/common/bin/commEnv.cml:151
 +
<source lang="java">
 +
set SPRING_CP=C:/opt/spring305/dist
 +
set WEBLOGIC_CLASSPATH=%SPRING_CP%/org.springframework.web.servlet-3.0.5.RELEASE.jar;C:/opt/spring3/commons-logging.jar;%SPRING_CP%/org.springframework.web-3.0.5.RELEASE.jar;%SPRING_CP%/org.springframework.context-3.0.5.RELEASE.jar;%SPRING_CP%/org.springframework.beans-3.0.5.RELEASE.jar;%SPRING_CP%/org.springframework.core-3.0.5.RELEASE.jar;%JAVA_HOME%\lib\tools.jar;%WL_HOME%\server\lib\weblogic_sp.jar;%WL_HOME%\server\lib\weblogic.jar;%FEATURES_DIR%\weblogic.server.modules_10.3.4.0.jar;%WL_HOME%\server\lib\webservices.jar;%ANT_HOME%/lib/ant-all.jar;%ANT_CONTRIB%/lib/ant-contrib.jar
 +
 +
</source>
  
 
===Spring 3 Download===
 
===Spring 3 Download===
Line 160: Line 174:
 
**SPRING_STRUTS=org.springframework.web.struts-3.0.5.RELEASE.jar
 
**SPRING_STRUTS=org.springframework.web.struts-3.0.5.RELEASE.jar
 
===Spring Integration with WebLogic===
 
===Spring Integration with WebLogic===
*There are several options for getting the Spring framework enabled for your Spring WAR in WebLogic Server.
 
  
====Option 1: Spring library jars copied to WebLogic modules directory====
+
*There are several options for getting the Spring framework enabled for your Spring WAR in WebLogic Server.  I have ordered them in decreasing impact on the WebLogic server config and increasing application managed state.
 +
====Option 1: <font color="green">'''Spring library jars highest in WEBLOGIC_CLASSPATH var in commEnv.cmd script'''</font> - in use====
 +
*This option will override anything on the server and deployed WAR's (except '''prefer-application-packages''' overrides).  It will deal with most classLoader and CNFE issues.  Later we may want to refactor how the Spring modules are packaged to minimize server impact.
 +
 
 +
====Option 2: Spring library jars in WebLogic modules directory====
 +
====Option 3: Spring library jars in WebLogic Domain lib directory====
 +
====Option 4: Spring library jars in shared separate EAR library====
 +
====Option 5: Spring library jars deployed with EAR APP-INF/lib directory using <font color="red">'''prefer-application-packages'''</font> override====
 +
====Option 6: Spring library jars deployed with WAR lib directory====
  
 
===Eclipse 3.6 Setup===
 
===Eclipse 3.6 Setup===
Line 209: Line 230:
 
*If you were using a Hibernate SessionFactory for ORM you could describe your entities in the '''AnnotationSessionFactoryBean''' bean element to match the '''class''' elements from persistence.xml - if auto-discovery was not enabled
 
*If you were using a Hibernate SessionFactory for ORM you could describe your entities in the '''AnnotationSessionFactoryBean''' bean element to match the '''class''' elements from persistence.xml - if auto-discovery was not enabled
  
*The
 
  
 
==Transaction Manager Configuration==
 
==Transaction Manager Configuration==
Line 227: Line 247:
  
  
 
'''Previous 2008 content - currently undergoing refactoring on 20101220'''
 
 
==Downloading EclipseLink Libraries==
 
===Download EclipseLink using HTTP - recommended===
 
*Proceed to the following URL and download the latest eclipselink.zip which contains everything you need.
 
**http://www.eclipse.org/eclipselink/downloads/index.php
 
***'''Click on the "EclipseLink 1.0.2 Installer Zip''' link which resolves to http://www.eclipse.org/downloads/download.php?file=/rt/eclipselink/releases/1.0.2/eclipselink-1.0.2.zip
 
*Expand the zip file and get the following 2 files
 
**eclipselink-1.0.2\eclipselink\jlib\eclipselink.jar
 
**eclipselink-1.0.2\eclipselink\jlib\jpa\javax.persistence_1.0.0.jar
 
===Download EclipseLink using Maven===
 
See the repository on http://www.eclipse.org/eclipselink/downloads/index.php
 
===Download EclipseLink using SVN - developers only===
 
*Get the following ''<font color="blue">eclipselink.jar</font>'' and ''<font color="blue">javax.persistence*.jar</font>'' from http://www.eclipselink.org ready for your EclipseLink shared library - ''(I am running rev 2.0.0.20090218-SNAPSHOT)''
 
**The following page details four different ways to either obtain the binary jars or download the source and build them yourself with an anon account.
 
**http://wiki.eclipse.org/EclipseLink/Source
 
 
 
http://www.springframework.org/download
 
http://sourceforge.net/project/downloading.php?group_id=73357&use_mirror=voxel&filename=spring-framework-2.5.5-with-dependencies.zip&50273885
 
 
==Eclipse Launch Targets==
 
<pre>
 
-javaagent:c:\opt\spring3\org.springframework.instrument-3.0.0.RELEASE.jar
 
</pre>
 
 
==Change Log==
 
==Change Log==
 
*20080922 - start tutorial template (no content)
 
*20080922 - start tutorial template (no content)
Line 273: Line 267:
 
*Need to respond to...
 
*Need to respond to...
 
**http://old.nabble.com/Eclipselink-with-Spring-2.5.6-and-Weblogic-10.3-p24095716.html and http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg02836.html
 
**http://old.nabble.com/Eclipselink-with-Spring-2.5.6-and-Weblogic-10.3-p24095716.html and http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg02836.html
 +
-->

Latest revision as of 13:20, 25 December 2010

Back to the top