Posts Tagged ‘Oracle’

Keep walking around WebLogic server and JRockit traps

June 14th, 2012

Happily developed web based application by using Groovy and Grails, and it runs happily as well on Tomcat. Then deploy to WebLogic server in staging environment which runs in JRockit JVM in RedHat Linux (better for performance), bugged.

Curiously try to duplicate the issue, I set up the exactly same version WebLogic server for Windows, but using standard JDK 1.6.x, same war file deployed, but application runs without any problem.

Always admire Oracle’s product quality and highly calibre service, I never bother to call them – help yourself, I can see Oracle sales smiling to me.

The first issue on WebLogic in JRockit is Exception thrown when try to start up the application:

Caused By: java.lang.IllegalArgumentException: com.sun.xml.internal.messaging.saaj.soap.LocalStrings != com.sun.xml.messaging.saaj.soap.LocalStrings
        at java.util.logging.Logger.getLogger(Logger.java:337)
        at com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl.(SAAJMetaFactoryImpl.java:71)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at javax.xml.soap.FactoryFinder.newInstance(FactoryFinder.java:59)

Did some search and found out this link on developers favourited StackOverflow - http://stackoverflow.com/questions/3889087/illegalargumentexception-com-sun-xml-internal-messaging-saaj-soap-localstrings

It seems JRockit has its own implementation of SOAP SAAJ which is not compatible, even in saaj-impl-1.3.2.jar file already specifies to use implementation inside jar file, rather then jar bundled with JVM:

    64 META-INF/services/javax.xml.soap.MessageFactory
    51 META-INF/services/javax.xml.soap.MetaFactory
    63 META-INF/services/javax.xml.soap.SOAPConnectionFactory
    57 META-INF/services/javax.xml.soap.SOAPFactory

» Read more: Keep walking around WebLogic server and JRockit traps

Annoying SLF4J problem in Weblogic server 12c

June 2nd, 2012

Using Grails quickly build a web-based application. Deploy and run happily on Tomcat. But after deploy the same war on the latest WebLogic server development version 12c, failed and Exception thrown:

Caused by: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:301)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:240)

After a few drilled investigation, found out bloody WebLogic comes with SLF4J itself, under the directory:

./modules/org.slf4j.api_1.6.1.0.jar
./modules/org.slf4j.ext_1.6.1.0.jar
./modules/org.slf4j.jdk14_1.6.1.0.jar

These SLF4J jar files are conflicting with different version SLF4J jar files in the war file:

17097 10-04-10 10:07 WEB-INF/lib/jcl-over-slf4j-1.5.8.jar
 4464 10-04-10 10:07 WEB-INF/lib/jul-to-slf4j-1.5.8.jar
23445 10-04-10 10:07 WEB-INF/lib/slf4j-api-1.5.8.jar
 9679 10-04-10 10:07 WEB-INF/lib/slf4j-log4j12-1.5.8.jar

After another investigation, the only solution can try is to use SLF4J jar files in the package “overwrite” jar files in WebLogic modules. To do that, add weblogic.xml descriptor file under web-app/WEB-INF directory:

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app
	xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
	<wls:container-descriptor>
		<wls:prefer-application-packages>
			<wls:package-name>org.slf4j</wls:package-name>
		</wls:prefer-application-packages>
	</wls:container-descriptor>
</wls:weblogic-web-app>

» Read more: Annoying SLF4J problem in Weblogic server 12c

JSF 2, Spring 3, Spring MVC 3, Hibernate 4, Tomcat 7 – a lightweight approach

April 22nd, 2012

“What is your favourite design pattern?” Question asked in a job interview.

WTF question is that?

“Hmmm… my favourite design pattern is Salami pattern – approaching to the finish line slice by slice.”

– From Antidisestablishmentarianism I.T.

In my previous blog - Spring 3 shacks up JSF 2, the maverick way, demonstrating how JSF 2 a component, event driven framework as the presentation layer, and Spring 3, Spring MVC 3 work in middleware. Well, technology keeps evolving. Hopefully even pigs could programe one day. This time, Hibernate 4 is added as the persistence layer. Now, we have end-to-end, a “traditional” three tiers web application. Moreover, an unit test to test business logic layer, the most important, runs outside of container.

Firstly, files and directories structure:

The backend database is Oracle’s example of  Human Resources (HR) application for a fictitious company (check the reference at the end of the blog).

» Read more: JSF 2, Spring 3, Spring MVC 3, Hibernate 4, Tomcat 7 – a lightweight approach

Step by step to create a dynamic Map chart in APEX

April 11th, 2012

In last blog, I demo how to create a dynamic 3D bar chart in APEX. Now let’s have a bit fun – let’s create a map chart in APEX. It is based on the same example of  Human Resources (HR) application for a fictitious company called ManyCo Corp.

I’m going to create a map page for ManyCo app, drawing a map including number of employees around world by each country.

Log on APEX, select ManyCo app, click on “Create Page” button and select “Chart”, then click on “Next”:

Choose “World and Continent Maps” in Select Map Type step, then click on “Next”:

Choose “World” in Create Map page, then click on “Next”:

» Read more: Step by step to create a dynamic Map chart in APEX

Step by step to create a dynamic 3D bar chart in APEX

April 10th, 2012

Here I’m going to demo how to Step by step to create a dynamic 3D bar chart in APEX.

Remember Oracle has this an example of  Human Resources (HR) application for a fictitious company called ManyCo Corp?

Here is ManyCo departments page. Remind you ManyCo has several offices around world:

I select IT department, in employees page, five staff belong to IT listed. This time, we are going to particular interested in “Hire Date” field:

Now I’m going to create a chart page for ManyCo app, drawing a chart including employees hired by year.

Log on APEX, select ManyCo app, click on “Create Page” button and select “Chart”, then click on “Next”:

» Read more: Step by step to create a dynamic 3D bar chart in APEX

Rapid application development with Oracle Application Express

April 5th, 2012

When people were growing up in 1960′s and 1970′s, labour and time saving machines are propelling engine for productivity. So that you can see top-loading washing machine had replaced the front step, than came the television with remote control, which meant you no longer had to sit through 24 hours weather channel because you couldn’t be bothered get off your bums.

Life was very good.

But, it doesn’t much the same story in IT.

When database invented and became core repository storing business information, people in company’s IT department became mad loading tons and tons relevant and irrelevant data into it without considering the best way to utilise and mine them; and after WWW invented, so web based application was getting into the mainstream for lightweight and loose-coupling enterprise IT solution, and you got dot-com bubble and new bubble now change theirs name to web 2.0 and social network …

To developers, life is getting worse and worse. Automation in IT didn’t reduce developers work hours, but make them more overworked and underpaid.

Developers have to have a board knowledge base, mastering every technology aspect from client to server, craftmaning from business logic implementation to unit test developing.

There is an example. The requirement is to develop a web-based application, to let end-users browse, view, search and report some business information stored in back-end database.

First thought you would like “OK, it’s web app we should go with JSP, Struts for front-end; with back-end database, we could go with Hibernate, and use Spring to “glue” all these components together. Oh, you want to generate some ‘sexy’ report as well, we can use Open Source graphic tools GNU, erh …, something. Sorry,  I can’t remember the exact name”.

» Read more: Rapid application development with Oracle Application Express

Step by step to install Oracle Application Express (APEX) 4.1.1

April 2nd, 2012

I’m now showing you a step by step instructions how to install Oracle Application Express (APEX) 4.1.1 on Windows 7. With help from Cygwin environment.

  • Download Oracle Application Express (APEX) version 4.1.1 and Listener from OTN website: http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html and http://www.oracle.com/technetwork/developer-tools/apex-listener/downloads/index.html
  • Run sqlplus and log on database as user SYS:

    sqlplus SYS/Welcome1@localhost:1521/OracleDB as sysdba

  • Create tablespace “APEX”:

    DROP TABLESPACE APEX INCLUDING CONTENTS AND DATAFILES;

    CREATE TABLESPACE APEX DATAFILE 'C:\APP\ORADATA\ORACLEDB\APEX01.DBF' SIZE 256M AUTOEXTEND ON NEXT 16M MAXSIZE UNLIMITED
    LOGGING
    ONLINE
    PERMANENT
    EXTENT MANAGEMENT LOCAL AUTOALLOCATE
    BLOCKSIZE 8K
    SEGMENT SPACE MANAGEMENT AUTO
    FLASHBACK ON;

  • Assume you are under APEX package directory, then run the APEX installation sql script:

    SQL> @apexins APEX APEX01 TEMP /i/

    The installation will take a while. Time for a cup of tea till you see these on the screen:

    ...
    ...Compiled 701 out of 2896 objects considered, 0 failed compilation 14:01:03
    ...253 packages
    ...245 package bodies
    ...447 tables
    ...12 functions
    ...19 procedures
    ...3 sequences
    ...445 triggers
    ...1266 indexes
    ...196 views
    ...0 libraries
    ...6 types
    ...0 type bodies
    ...0 operators
    ...0 index types
    ...Begin key object existence check 14:01:03
    ...Completed key object existence check 14:01:03
    ...Setting DBMS Registry 14:01:03
    ...Setting DBMS Registry Complete 14:01:03
    ...Exiting validate 14:01:03
    timing for: Validate Installation
    Elapsed: 00:02:10.40
    timing for: Development Installation
    Elapsed: 00:15:59.51
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

  • Unpack APEX Listener to e.g. C:\app\apex directory

    » Read more: Step by step to install Oracle Application Express (APEX) 4.1.1