About Markus Eisele

Markus is a principal technology consultant working for msg systems ag in Germany. Markus is a software architect, developer and consultant. He also writes for IT magazines. Markus is speaking at different conferences about his favorite topics. He is also part of the Java EE 7 expert group.

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 :

Related Whitepaper:

Functional Programming in Java: Harnessing the Power of Java 8 Lambda Expressions

Get ready to program in a whole new way!

Functional Programming in Java will help you quickly get on top of the new, essential Java 8 language features and the functional style that will change and improve your code. This short, targeted book will help you make the paradigm shift from the old imperative way to a less error-prone, more elegant, and concise coding style that’s also a breeze to parallelize. You’ll explore the syntax and semantics of lambda expressions, method and constructor references, and functional interfaces. You’ll design and write applications better using the new standards in Java 8 and the JDK.

Get it Now!  

Leave a Reply


seven − 2 =



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use
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.

Sign up for our Newsletter

15,153 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books
Get tutored by the Geeks! JCG Academy is a fact... Join Now
Hello. Add your message here.