Markus Eisele

About Markus Eisele

Markus is a Developer Advocate at Red Hat and focuses on JBoss Middleware. He is working with Java EE servers from different vendors since more than 14 years and talks about his favorite topics around Java EE on conferences all over the world. Follow him on Twitter @myfear.

Quickstart WebLogic 12c with NetBeans 7.1 RC 2

WebLogic server 12c is out since a few days. It is for “naked” Java dev – the fancy Fusion Middleware stuff will move on to 12c down the line. So, this is basically my release to run. Today I am giving you a quick start with latest NetBeans 7.1 (RC 2) and WebLogic to run the Pet Catalog example with MySQL.

Preparation

First step is to download all required components. Grep a copy of latest NetBeans 7.1 RC 2, WebLogic 12.1.1.1and MySQL 5.5.18. Install WebLogic, NetBeans and MySQL according to the instructions. Next is to create a simple WebLogic server domain. Start the configuration tool (%WL_HOME%/common/bin/config.exe|sh) and add a “petcatalog_domain” with the basic configuration. Give a admin user and password.

Fire up NetBeans and switch to the Services tab. Right click on the Servers node and select “Add Server…”. Choose “Oracle WebLogic Server” and click next to enter the Server location “/Oracle/wls1211/wlserver_12.1″. Click next to select or browse for the new domain (petcatalog_domain), enter the administrator username and password. Click finish and right click on the new Oracle WebLogic Server node. You can start, stop and restart a domain. In normal, profile and debug mode. A quick link to either the server log and the Admin console is also available. Now fire up the MySQL Administrator and create a new db (e.g. petcatalog). Make sure, that you have a db user, that has access to it.

Pet Catalog Example with NetBeans

Since late 2009 a application called the Pet Catalog is part of NetBeans. It’s a Java EE 6 example that demonstrates the usage of JavaServer Faces 2.0 and the Java Persistence API based on MySQL. It’s basically there to demonstrate the usage of GlassFish with MySQL. Find more details about the application on java.net. What a wonderful show-case to deploy on the new WebLogic 12c server.
Back to NetBeans: Select “New Project” and project type “Sample/Java Web/Pet Catalog”. Enter a project name and location. Click finish. Confirm the “Missing Server” problem dialog and right click on your newly created project, choose “Resolve missing Server Problem…”. Select “Oracle WebLogic Server” and click ok. After a short project scan and a re-build, the project is opened and has all the needed libraries. Open a mysql command line or the query browser and execute the “netbeans-projects/PetCatalog/setup/catalog.sql” script against your newly created db. If you are down there already, open the project’s configuration files and open the “persistence.xml”. Comment out lines 5 to 8 (all in-between and including <properties> and </properties>).

Pet Catalog Data Source in WebLogic Server

Even if you also see a sun-resources.xml in your project, you can’t take advantage of it.
You need to create a suitable datasource in WebLogic server first. Open the WLS console/, expand the “Services” node in the left tree, click “Data Sources”. Select “New” on top of the table and select “Generic Data Source”. Give it a suitable name (e.g. “Pet Catalog Pool”), JNDI Name (“jdbc/petcatalog”) and select MySQL as the Database Type. Click next and review the database driver (“com.mysql….) click next and select the transaction options (leave default for now). Click next and enter the connection properties Database Name (e.g. petcatalog), Host Name (e.g. localhost), Port (3306), Database Username, Password and Password Confirmation. Click next and select “Test Configuration” on top. A green “Connection test succeeded” message should appear on top (compare screenshot). Click next, select Admin Server as target and click finish. Now your all set. The petcatalog Data Source is all set up.

Run it!

All finished. Right click your project in NetBeans and select “Run”. You see that the WebLogic server is started and the project is getting deployed. If everything is finished, your system browser is opened and you are redirected to the applications start page:

Adding Primefaces

That’s all. Nothing more to do! So, we have a new sample application for WebLogic server :) But let’s make this a little bit more fancy. Let’s add Primefaces to it. Right click your NetBeans project and select “Properties”. Select category “Frameworks” and select tab “Components” where you can select “Primefaces 2.2.1″. Click ok to update your project. Now open your list.xhtml and add the primefaces namespace
xmlns:p=”http://primefaces.prime.com.tr/ui” to the <html> element.
Next is to change the list.xhtml to use the Primefaces DataGrid example. And add a public List<item> getAllItems() method to Catalog.java. Same place introduce a selectedItem property with getters and setters. And if you have done everything the right way, you have your primefaceified Pet Catalog running on WebLogic Server 12c! Congratulations!

Reference: Quickstart WebLogic 12c with NetBeans 7.1 RC 2 from our JCG partner Markus Eisele at the Enterprise Software Development with Java blog.

Related Articles :

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

Leave a Reply


× eight = 16



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close