Posts Tagged 11g

Slides for my german presentation “Quality Assurance for ADF projects” available

I have presented today on DOAG Development 2014 in Dusseldorf. For all non DOAG members – you can find the german presentation on slideshare too.

2014-Development_Banner-Speaker-180x180

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

Leave a comment

Quality Assurance for ADF projects

If you speak german and you are interested in quality assurance for your ADF projects you should come and attend my presentation at DOAG Development on 06/04/2014 in Dusseldorf.

I will show you, how you can implement in the JDeveloper IDE and in Continous Integration server Jenkins:

  • static code analysis with PMD, FindBugs and Checkstyle
  • Task’s
  • Commit tests with JUnit, Mockito and Powermock for Mockito
  • Code coverage for commit tests with JaCoCo
  • Acceptance tests with JUnit and Selenium

See you!

2014-Development_Banner-Speaker-180x180

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

2 Comments

Have released PMD Jdeveloper Extension 5.0.5

I have finished now my work on integrating last PMD version 5.0.5 into JDeveloper.

This is available now for JDeveloper 11.1.1.6 upwards, 11.1.2.x. and 12.1.2. There is no new functionality, as the most work intensive part was the rewriting for PMD 5. There has changed a lot of api functionality.

Please give it a try, you can download it via the standard update center “Open Source and Partners Extensions” in JDveloper itself

update_center_11.1.2.5050

or directly from the PMD SourceForge.net Project Page.

, , , , ,

Leave a comment

Write ADF static code analysis rules with PMD and running these in JDeveloper

Do you know, that PMD can analyse XML files since version 5? Many of ADF files are XML configuration files – wouldn’t it be a good idea to create some static code analysis rules for ADF too?

Unfortunatly oracle configuration files in most times create references to dtd’s, which are not exist anywhere in the path. Till PMD 5.0.1 such files results in errors, as PMD tries to validate this doctype. I have switched of this validation in PMD release 5.0.2.

Following article requires configuration of PMD as described in my blog PMD Integration with JDeveloper through Ant External Tools.

You can download all requried files from here.

Let’s start from the beginning.

  1. At the moment PMD only provide XML check’s against files with the extension *.xml, there is a feature request to change this behaviour. So at the moment, we have to change the code by ourself to reach the result. Load the the 5.0.4 source code.
  2. Look for the file src\main\java\net\sourceforge\pmd\lang\Language.java and replace the line
    XML(“XML”, null, “xml”, XmlRuleChainVisitor.class, “xml”);
    with
    XML(“XML”, null, “xml”, XmlRuleChainVisitor.class, “xml”, “jws”, “jpr”, “cpx”, “xcfg”, “dcx”, “jpx”);
  3. Change to directory pmd-src-5.0.4
  4. set JAVA_HOME, e.g. to your 1.6 JDeveloper jdk
  5. run “mvn clean package”, I have succesfully used maven 2.2.1 from <JDev-Home>\jdeveloper\apache-maven-2.2.1\bin
  6. If you don’t need further extensions, you can instead running steps 2 till 5 the resulting pmd-5.0.4.jar from my side.
  7. Replace the file pmd-5.0.4.jar in pmd-bin-5.0.4\lib (see my previous blog) with the downloaded file or the file from pmd-src-5.0.4\target
  8. Now is the time to create the first adf static code analysis rule. In the adf architecture course I attend, there was a rule, that the taskflow behaviour “No controller transaction”
    should not be mixed with the other option of this selection list

    In the sourcecode this property is described through the absence of the node adfc-config/task-flow-definition/transaction, the other options create this node and additional child nodes, here e.g. for the option “Always create new transaction”
  9. In PMD you can create two kind of rules: Java and XPath. For our xml Files XPath should be the efficient option. We have to put our configuraration e.g. in file my_pmd_rules.xml in the same directory as pmd.xml in the last blog. For the above rule the XPath query in line 14 find nodes, which does not contain the transaction node
    <?xml version="1.0"?>
    <ruleset name="Oracle ADF rules" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
    <description>This ruleset checks Oracle ADF code for bad stuff</description>
    <!-- ADF Rules ############################################################################################### -->
    <rule name="OracleAdfTaskflowShouldNotHaveNoControllerTransaktion" since="5.0" language="xml"
    message='ADF tasklows should normally not contain transaktion behavior "No Controller Transaction"'
    >
    <priority>1</priority>
    <properties>
    <property name="xpath">
    <value><![CDATA[
    adfc-config/task-flow-definition[not(transaction)]
    ]]></value>
    </property>
    </properties>
    </rule>
    </ruleset>
    
  10. Now we have to change the configuration file pmd.xml from the last blog in the marked lines to call our new configuration and run this on files with defined Extensions
    <?xml version="1.0" encoding="windows-1252" ?>
    <project xmlns="antlib:org.apache.tools.ant" name="Project1" default="all" basedir=".">
    <path id="classpathForPMD">
    <fileset dir="pmd-bin-5.0.4\lib">
    <include name="**/**.jar"/>
    </fileset>
    </path>
    <taskdef name="pmd" classpathref="classpathForPMD" classname="net.sourceforge.pmd.ant.PMDTask"/>
    <target name="pmdAll">
    <echo message="PMD is running on directory ${dir}" level="info"/>
    <pmd rulesetfiles="my_pmd_rules.xml" failOnRuleViolation="true" minimumPriority="1">
    <fileset dir="${dir}">
    <include name="**/*.java"/>
    <include name="**/*.xml"/>
    <include name="**/*.jws"/>
    <include name="**/*.jpr"/>
    <include name="**/*.cpx"/>
    <include name="**/*.xcfg"/>
    <include name="**/*.dcx"/>
    <include name="**/*.jpx"/>
    </fileset>
    </pmd>
    </target>
    </project>
    
  11. Now call again pmd from the Fusion Order Demo Application StoreFrontModule
  12. You can see the results for xml in the message pane. Unfortunatly the direct jump to violated files does not work at the moment as pmd delivers for every xml violation -1 as line, but I have created an bug for this

That’s it.

Maybe somebody has an idea, where we can build an extension exchange for ADF rules, e.g. for creating rules for ADF Code Guidelines v1.00 or ADF Naming and Project Layout Guidelines v2.00?

Remember: you are not restricted to ADF files, e.g. we do checks to for JDeveloper application (*.jws) and project files (*.jpr) as well, as this are xml files too. The configuration you see already in step 2.

Chrysanth WebStory Published by WebStory

, , , , ,

Leave a comment

PMD Integration with JDeveloper through Ant External Tools

In the past I read following blogs from Shay Shmeltzer:

Now (after little code change in pmd) this integration is possible. I use here JDeveloper 11.2.0.4, with other versions this should be very similar. Now let’s start:

1. Create a new folder
2. Download PMD 5.0.4
3. Extract the zip file into the created folder
4. Create a file pmd.xml into the created folder
5. Enter following code into the file pmd.xml:

<?xml version="1.0" encoding="windows-1252" ?>
<project xmlns="antlib:org.apache.tools.ant" name="Project1" default="all" basedir=".">
    <path id="classpathForPMD">
        <fileset dir="pmd-bin-5.0.4\lib">
            <include name="**/**.jar"/>
        </fileset>
    </path>
    <taskdef name="pmd" classpathref="classpathForPMD" classname="net.sourceforge.pmd.ant.PMDTask"/>
    <target name="pmdAll">
        <echo message="PMD is running on directory ${dir}" level="info"/>
        <pmd rulesetfiles="rulesets/internal/dogfood.xml" failOnRuleViolation="true" minimumPriority="1">
            <fileset dir="${dir}">
                <include name="**/src/**/*.java"/>
            </fileset>
        </pmd>
    </target>
    <target name="pmd">
        <echo message="PMD is running on file ${dir}\${file}" level="info"/>
        <pmd rulesetfiles="rulesets/internal/dogfood.xml" failOnRuleViolation="true">
            <fileset dir="${dir}">
                <include name="${file}"/>
            </fileset>
        </pmd>
    </target>
</project>

6. Select Tools – Exernal Tools from the JDeveloper menu
7. Press Button New
8. Select Tool Type: Apache Ant
9. Select your created pmd.xml file in Ant Buildfile:

10. Shuttle target pmdAll to SelectedTargets

11. Add Property dir with value ${file.dir}

12. Skip the Options and Process Step to leave the defaults
13. Add the lib directory of pmd as additional classpath entry

14. Enter Caption and Icon as you want

15. Add the tool to the Navigator Context Menu and Main Toolbar and do not forget to set Log Output to Messages Log

16. Press Next and Finish.

Now you can call pmd e.g. from the fusion order demo application

You see the results of the ant process in the message pane and you can click on the link to open the file and jump to the rule violation:

In upcoming blogs I will show you how you can define your own rulesets (replacing the ones in pmd.xml) and how to use it with any kind of xml files, eg. jws, jpr, xcfg etc..

Chrysanth WebStory Published by WebStory

, , , ,

1 Comment

Fasten your Oracle Forms and Reports 11g Server start on Unix derivates

Do you see a slow start of your weblogic managed server for forms & reports on unix derivate? We have this problem on Suse SLES 11 and forms and reports 11.1.2.

In November I attended the annual DOAG (German Oracle User Group) conference in Nuremberg. There I’ve heare an interesting presentation from Jan-Peter Timmermann about “Performance with Forms 11gR2 Weblogic 10.3.x”.

One snippet of the presentation was an bug in the jdk which slows down the start of managed weblogic servers. It has to do with the random number generator during loading the OPSS Policy Provider for security. This issue is discussed in detail in this blog: http://www.itonguard.com/20090313/weblogic-starts-slow/.

These are the relevant log files before as an example for forms:

####<21.12.2012 07:38 Uhr MEZ> <Info> <WebLogicServer> <localhost> <> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <1356071911941> <BEA-000000> <WebLogic Server "WLS_FORMS" version: WebLogic Server 10.3.5.0  Fri Apr 1 20:20:06 PDT 2011 1398638  Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved.>
####<21.12.2012 07:38 Uhr MEZ> <Info> <IIOP> <localhost> <WLS_FORMS> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1356071912371> <BEA-002014> <IIOP subsystem enabled.>
####<21.12.2012 07:40 Uhr MEZ> <Info> <Security> <localhost> <WLS_FORMS> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1356072024665> <BEA-090894> <Successfully loaded the OPSS Policy Provider using oracle.security.jps.internal.policystore.JavaPolicyProvider.>
####<21.12.2012 07:41 Uhr MEZ> <Notice> <WebLogicServer> <localhost> <WLS_FORMS> <main> <<WLS Kernel>> <> <> <1356072069175> <BEA-000360> <Server started in RUNNING mode>

You see, that initializing the OPSS Policy Provider, which seems to use the random number generator, needs 2 minutes.

Now we will make a simple change in the Oracle Middleware JDK Runtime file (we have here SUN JDK 1.6.0_26 64bit)

<JDK Home>/jre/lib/security/java.security

Comment the original line as followed, an add a the marked new line:

#securerandom.source=file:/dev/urandom
securerandom.source=file:/dev/./urandom

Now see the results for forms:

####<21.12.2012 07:57 Uhr MEZ> <Info> <WebLogicServer> <sdu10037> <> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <1356073038615> <BEA-000000> <WebLogic Server "WLS_FORMS" version: WebLogic Server 10.3.5.0  Fri Apr 1 20:20:06 PDT 2011 1398638  Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved.>
####<21.12.2012 07:57 Uhr MEZ> <Info> <IIOP> <localhost> <WLS_FORMS> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1356073039121> <BEA-002014> <IIOP subsystem enabled.>
####<21.12.2012 07:57 Uhr MEZ> <Info> <Security> <localhost> <WLS_FORMS> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1356073042034> <BEA-090894> <Successfully loaded the OPSS Policy Provider using oracle.security.jps.internal.policystore.JavaPolicyProvider.>
####<21.12.2012 07:58 Uhr MEZ> <Notice> <WebLogicServer> <localhost> <WLS_FORMS> <main> <<WLS Kernel>> <> <> <1356073086151> <BEA-000360> <Server started in RUNNING mode>

You see the loading of OPSS Policy Provider takes now no relevant time and the startup time in our case decrease from 3 to 1 minute. We see same improvement for the reports managed server.

Remember, your mileage may vary if

  • Your are not on a affected unix derivate.
  • You use not an jdk with this bug. Unfortunatly in the blog is not described the bug number.

, , , , , , ,

2 Comments

Oracle Reports Designer 11g 64bit on Windows7 64bit very buggy – Use Reports 32bit instead!

As I have seen in Oracle certification matrix Forms & Reports 11g 64bit is supported under Windows7 64bit. So I tried to install it and to work with it. Unfortunatly there are serious bugs in it, please read for more information MOS Doc ID 1395965.1:

  1. After starting Reports Builder, trying to open “Data Model” or “Web Source” will crash the Report Builder
  2. Impossibility to create a Query based on a Pluggable Data Source (PDS) in reports builder
  3. Reports Builder spins on CPU (grabbing full power of one CPU) when “Copy/Paste” functionality is used in Layout Model

For 1./2. is a workaround to disable all Pluggable Data Source (PDS) in cauprefs.ora, if you don’t use that feature.

But for 3. is no workaround besides to use Forms & Reports 11g 32bit!

, , , , ,

1 Comment

TranslationHub 11g is only available as 32 bit – requires Forms & Reports 11g too in 32 bit for Development

I have done the whole may scripting silent installs of several developer tools. Among them was Fusion Midleware 11.1.2 Forms & Reports. I see that oracle certifies the 64bit installers on win7 64bit and so I have successfully script this after a lot of time. I want not speak about the many errors in silent installers here.

As we use TranslationHub for translating our forms, menus and reports, I tried last weeks to script this and after this to batch import all my original and translated modules as 11g versions, as this is required before roll out fusion middleware to our users.

First I have seen that TranslationHub is only available in 32bit as standalone version outside Fusion Middleware. Additional there is no silent installer available for this separate package. Asking support for 64bit version and silent install option results in two enhancement requests. Everybody who has created such an request before know, that he does not get this in some weeks, very likely he got it never. Fortunatly our scripting boys have recorded and repackaged this installer. The 32bit version installs on win7 64bit and starts.

But now begins the really horror: I could not see forms and reports in the import wizards, my batch jobs fails. The 32bit TranslationHub version seems not find the 64bit Forms version. So the work begins again – I had to script the 32bit version of Fusion Midleware 11.1.2 Forms & Reports for the developers. Fortunatly this works very similar to 64bit, and I complete this package in several ours. Now

One additional note for TranslationHub: You must ensure that the first entry in the path variable is an 32bit Oracle Client for succesfull connect to your TranslationHub repository.

, , , , , , , ,

12 Comments

Have released PMD Jdeveloper Extension 4.3

Sorry for a time without new post – but I have finished now my work on integrating last PMD version 4.3 into JDeveloper.

This is available now for JDeveloper 10.1.3.x, 11.1.1.6 and 11.1.2.x. There is no new functionality, as the most work intensive part was the rewriting for 11.1.2.x. There has changed a lot of JDeveloper api functionality. Additional I tried to solve a class loader conflict in JDeveloper 11.1.1.x with the delivered libraries from PMD 4.3, but I was not succesful. Fortunatly Oracle JDeveloper product management solved this conflict in 11.1.1.6, so I can deliver at least the extension for this JDeveloper version.

Please give it a try, you can download it via the standard update center “Open Source and Partners Extensions” in JDveloper itself or directly from the PMD SourceForge.net Project Page.

, , , , ,

4 Comments

Oracle Forms 11 running as application in Java Webstart

According to my last post today I will show you the basic configuration for forms 11g.

Unfortunatly webstart in forms 11g it is not as easy as in 10g, but it works too!

As first you need an additional unique identifier “ifsessid” in parameter “serverURL” for forms. This prevents the use of a static jnlp in this case. Maybe it is possible to branch out the build of this unique identifier from the jnlp. I have decided instead to create the the jnlp from a java server page. This helps me additional to use forms parameters, which I will describe in a later post. Sure there maybe exist other ways to build the jnlp.

Let’s start:

Again I assume you have an running unix or linux application server with forms 11g.

As first you need the webstart_11g.jsp in folder public_html under a JDeveloper project. The marked lines provides the identifier:

<%@ page contentType="application/x-java-jnlp-file" language="java" import="java.sql.*"%>
<%@ page session="true"%>
<%response.setDateHeader ("Expires", 0); //prevents caching at the proxy server%>
<%
  long time = System.currentTimeMillis();
  String sessid = String.valueOf(time);
%>
<jnlp codebase="http://localhost.localdomain:9001/forms/java/">
  <information>
    <title>Webstart Test Oracle Forms 11g</title>
    <vendor>develishdevelopment.wordpress.com</vendor>
    <description>Webstart Test Oracle Forms 11g</description>
  </information>
  <security>
    <all-permissions/>
  </security>
  <update check="timeout" policy="always"/>
  <resources>
    <j2se version="1.6.0"/>
    <jar href="frmall.jar" download="eager" main="true"/>
  </resources>
  <applet-desc name="Webstart Test Oracle Forms 11g" main-class="oracle.forms.engine.Main" width="990" height="640">
    <param name="background" value="no"/>
    <param name="logo" value="no"/>
    <param name="serverApp" value="default"/>
    <param name="lookAndFeel" value="oracle"/>
    <param name="allow_debug" value="true"/>
    <param name="separateFrame" value="false"/>
    <param name="em_mode" value="1"/>
    <param name="latencyCheck" value="true"/>
    <param name="networkRetries" value="240"/>
    <param name="serverArgs" value="module=test.fmx useSDI=yes"/>
    <param name="serverURL" value="http://localhost.localdomain:9001/forms/lservlet?ifcfs=http://localhost.localdomain:9001/forms/frmservlet?config=jpi&ifsessid=formsapp.<%=sessid%>"/>
    <param name="colorScheme" value="teal"/>
    <param name="splashScreen" value="no"/>
    <param name="dontTruncateTabs" value="true"/>
  </applet-desc>
</jnlp>

Now you need to deploy this jsp. First create a application server connection in JDeveloper version corresponding to your forms weblogic server. I have forms 11.1.1.2.0, which runs on weblogic 10.3.2. So I have to use JDeveloper 11.1.1.2.0. See oracle support information for supported JDeveloper version for your environment. Right click on you Jdeveloper project with the jsp an select deploy. Following are the steps in the deploy wizard:

  • Deployment Action
    • Deploy to application server
  • Select Servers
    • Application Servers: your application server
    • Overwrite modules of the same name: select
    • Deploy to all server instances in the domain: unselect
    • Deploy as a standanlone Application: select
  • Server instances
    • List Standalone Servers and Cluster: select your forms cluster or your forms server (WLS_FORMS)
  • Summary: finish

In the project properties change the deployment properties to set your context root, which will be later part of your url:

Set context root.

If you redeploy this jsp, you may wonder that your change is not immediatly shown. You can solve this by dropping the former deployment before redeploying or you add following files to your JDeveloper Project under folder public_html\WEB-INF:

weblogic.xml:

<weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd" xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
  <jsp-descriptor>
    <page-check-seconds>0</page-check-seconds>
  </jsp-descriptor>
  <container-descriptor>
    <servlet-reload-check-secs>0</servlet-reload-check-secs>
    <resource-reload-check-secs>0</resource-reload-check-secs>
  </container-descriptor>
  <context-root>webstart_11g</context-root>
  <fast-swap>
    <enabled>true</enabled>
    <refresh-interval>1</refresh-interval>
  </fast-swap>
</weblogic-web-app>

web.xml:

<?xml version = '1.0' encoding = 'windows-1252'?>
<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/web-app_2_5.xsd" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"></web-app>

Complete workspace you can found here: webstart_11g.zip

Now start java webstart with your jnlp url, here is an example in linux:

./javaws http://localhost.localdomain:9001/webstart_11g/webstart_11g.jsp

Java webstart comes up with the standard test.fmx from the forms services installation:

webstart_11g_succesful

That’s all!

, , , ,

6 Comments

Follow

Get every new post delivered to your Inbox.

Join 44 other followers

%d bloggers like this: