Posts Tagged ‘WebLogic’
09
Mar

After setting up a data source in your AppServer, e.g. for WebLogic Server, you want to use it in your application with JPA.

Basically there are three ways to connect to a db with JPA:

  • JDBC data source with JTA transactions (not supported by a Servlet-Container like Tomcat)
  • JDBC data source with self-managed transactions, i.e. transaction-type=”RESOURCE_LOCAL”
  • direct JDBC connection

The first and second are well discussed in the www. So we give an example on the second with provider Hibernate:

<persistence-unit name="PU_ResourceLocal_WithDS" transaction-type="RESOURCE_LOCAL">
  <provider>org.hibernate.ejb.HibernatePersistence</provider>

  <!-- the JNDI name as specified in your AppServer -->
  <non-jta-data-source>jdbc/mh_orcl</non-jta-data-source>

  <properties>
    <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
    <property name="hibernate.max_fetch_depth" value="5" />
  </properties>
</persistence-unit>

For Tomcat 6 and EclipseLink this is well explained in http://wiki.eclipse.org/EclipseLink/Examples/JPA/Tomcat_Web_Tutorial.

, , , , , ,

09
Mar

To use a data source in WLS (e.g. to benefit from the built-in connection pooling, XA transactions etc.) you have to configure it from the WLS admin console.
Prior to this post, we installed the Oracle DB and Oracle WLS.

  1. start the admin console, e.g. http://localhost:7001/console
  2. in the left tree menu named ‘Domain Structure’ go to ‘Services’ -> ‘JDBC’ -> ‘Data Sources’
  3. click ‘New’ and enter your data:
    • name:     mh_JDBC_DS_orcl (just a unique name in WLS to identify your ds)
    • JNDI Name:     jdbc/mh_orcl
    • Database Type:    Oracle
    • Database Driver:     oracle.jdbc.xa.client.OracleXADataSource (use the XA version if your App participates in global/distributed transactions)
    • Database Name:     orcl (the name you specified in the db installation)
    • Host Name:     localhost (or your IP where the db listens)
    • Port:     1521 (port where the db listens)
    • Database User Name:  mh (user to login)
    • Password:     <pwd>
    • under ‘Targets’: check the server, e.g. ‘AdminServer’ where you want to use this ds
  4. You can explore your settings also on the file system:
    • C:\Oracle\Middleware\user_projects\domains\mh_domain\config\jdbc\mh_JDBC_DS_orcl-5723-jdbc.xml, and an entry to this file in
    • C:\Oracle\Middleware\user_projects\domains\mh_domain\config\config.xml

Alternatively, if you need to make multiple installations/configurations, there is the possibility to use the silent installation and WLST (WebLogic Scripting Tool).

Now you can call the ds in your application via JNDI or if you use JPA you need to specify the JNDI name in persistence.xml.

, , , ,

25
Jan

For the use of JSF you only need a servlet container (no full application server).

JSF 1.2, 2.0: Servlet 2.5 / JSP 2.1 container

JSF 1.2 and JSF 2.0 depend only on Servlet 2.5 / JSP 2.1 containers. Note that EL 2.1 is a component of the JSP 2.1 Specification. This is the case in JEE 5 AppServers:

  • Tomcat 6
  • Glassfish 2
  • JBoss AS 5
  • Oracle WebLogic 11g
  • IBM WebSphere 7, etc.

E.g. So you can use JSF 2.0 in Tomcat 6, but not the features of EL 2.2, like call JSF action method with arguments. To tune Tomcat 6 towards Java EE 6 see here.

JSF 2.1, 2.2: Servlet 3.0 / JSP 2.2 container

JSF 2.1 and JSF 2.2 depend on Servlet 3.0 / JSP 2.2 containers. Note that EL 2.2 is a component of the JSP 2.2 Specification. This is the case in JEE 6 AppServers:

  • Tomcat 7
  • Glassfish 3
  • JBoss AS 6
  • Oracle WebLogic 12g
  • IBM WebSphere 8
  • or newer versions

For an overview of JEE 6 compatible servers: http://www.oracle.com/technetwork/java/javaee/overview/compatibility-jsp-136984.html
What’s new in JSF 2.1? It’s mainly a maintenance release:
http://javaserverfaces.java.net/nonav/rlnotes/2.1.0/whatsnew.html
http://it-republik.de/jaxenter/news/Was-ist-neu-in-JSF-2.1-057653.html (German)

, , , , , , , , , , , ,

24
Jan

After installing the database, I’m getting the WebLogic Server 11gR1 (10.3.3). You have to accept again the same “OTN License Agreement”.

Installation of WLS

Download and unzip

1. At the download page of Oracle WebLogic Server  you can choose versions for different platforms (32/64 bit). Although I would prefer the 64 bit version I’m sticking to the 32 bit version, due to the easy Windows Installer (double-click exe, and follow a wizard…) – I don’t want to invest too much time in the installation.
I choose the full package with Oracle Coherence and Oracle Enterprise Pack for Eclipse, although I won’t need Coherence but want to check out the OEPE (there’s also a zip with AppServer only, but the readme reveals no exe-installation with manual configuration – unfortunately WLS installation isn’t as easy as JBoss, Glassfish: unzip, done). So download

  • wls1033_oepe111150_win32.exe (about 0,9 GB)

Optional download: Documentation package E14571_01.zip, if you want offline all the WLS 11gR1 oracle docs in html and pdf version.

exe-Installer

2. Double-click wls1033_oepe111150_win32.exe, and wait for preparation of installation, about 5 min.

3. Follow the wizard:

  • Create a “Middleware Home Directory”, I choose the suggested one C:\Oracle\Middleware (in C:\Oracle also lies the db)
  • choose “Typical” installation (vs. “Custom”)
  • accept the suggested installation directories:
  • WebLogic Server: C:\Oracle\Middleware\wlserver_10.3
  • Oracle Coherence: C:\Oracle\Middleware\coherence_3.5
  • Oracle Enterprise Pack for Eclipse: C:\Oracle\Middleware\oepe_11gR1PS2
  • Create shortcuts in start menu for “all users” as recommended
  • Check installation summary, click “Next” to start the actual installation, wait about 20 min., time for a coffee :-)

4. Check “Run Quickstart” and press “Done” to create and configure a WLS domain:

  • in Quickstart, select “Getting started with WebLogic Server 10.3.3″
  • next select “Create a new WebLogic domain”
  • Select to “Generate a domain configured automatically to support the following products:” and check JAX-RPC- and JAX-WS extensions
  • enter domain name and location: I choose “mh_domain” and C:\Oracle\Middleware\user_projects\domains
  • configure the administrator user name and password: I choose “admin” and some easy to remember pwd (it has to be longer than 8 chars)
  • choose “Development Mode” and Sun SDK for getting the user/pwd out if boot.properties and poll for apps to deploy (auto-deploy)
  • check no further configurations, inspect the summary and click “Next”, installation complete!

Summary

Starting and Stopping WLS

C:\Oracle\Middleware\user_projects\domains\mh_domain\bin\startWebLogic.cmd
C:\Oracle\Middleware\user_projects\domains\mh_domain\bin\stopWebLogic.cmd

Visit the admin server http://localhost:7001/console and log in as the admin as specified before.

, , ,