dinsdag 28 mei 2013

ADF BC: JBO-25014: Another user has changed the row with primary key

Challenge

You receive the error mentioned in the title, but you are quite sure this is not the case and nothing has changed in the database due to triggers or pl/sql-code.

Context

Jdeveloper: 11gR1

Solution

There are already quite a few blogs on this error within ADF.  They all talk about the fact that something has changed in the database, without BC knowing about it.  This can be done through another user, a batch-script, a trigger or any other pl/sql-code.
But what if you are 100% sure this is not the case, then read on.

There is also another reason why this happen: the comparison of the different attributes didn't go well.  Although the documentation clearly state that the oracle.jbo.domain-classes should solve this issue, we still have found ourselves multiple times in this situation and mostly due to Date-attributes.
There are 2 ways to handle this:
  1. You can identify an attribute in your entity as a “Change Indicator”.  Once you have identified such an attribute in your entity, the BC-code will no longer compare all attributes, instead it will only compare those with the “Change Indicator” activated.

    To set this indicator on an attribute, just open the editor of the attribute to see the “Change Indicator” property.
  2. You can remove the attribute that is causing the problem from the comparison.  This is easier said than done, because you need to know which attribute is causing the problem.

    To find this out, just activate the JBO-diagnostic logging, you can do this by adding the following “-Djbo.debugoutput=console” to the Java-options of your run-configuration.
    Now run the application again and simulate the problem.  You should find something like this:
    <EntityImpl><compare> [508] Entity compare failed for attribute HireDate
    <EntityImpl><compare> [509] Original value :19-06-1987
    <EntityImpl><compare> [510] Target value :19-06-1987
    
    Now you know it is the HireDate-Attribute.  Now add the following code to the Impl-class of your entity:
    @Override
    protected boolean compare(SparseArray sparseArray) {
       // Removing the HIREDATE attribute from the array
       if (sparseArray != null && !sparseArray.isEmpty()) {
           for (int i=0; i<sparseArray.length(); i++) {
               Object value = sparseArray.get(i);
               if (value != null) {
                   if (i == HIREDATE) sparseArray.clear(i);
               }
           }
       }
       // Calling the standard compare method
       return super.compare(sparseArray);
    }
    
    You can do this for as many attributes as you need, just add them to the 3th if-statement.

dinsdag 7 mei 2013

JDeveloper 11.1.2.4 on Mac Lion


Challenge

Installing JDeveloper 11.1.2.4 on a MAC Lion

Context

Mac: 10.7.5
Jdeveloper: 11.1.2.4.0
Java: 1.7.0_17


Solution

I encountered 2 problems during installation:

  1. In the Installation wizard, when you use Custom instead of Typical, you need to find the correct Java version yourself.  If you use Typical, the default Java is set per default.
  2. When trying to run the WebLogic Server for the first time, I receive the following output:
    [Waiting for the domain to finish building...]
    
    [03:54:51 PM] Creating Integrated Weblogic domain...
    
    [03:55:21 PM] Extending Integrated Weblogic domain...
    
    [03:55:29 PM] Integrated Weblogic domain processing completed successfully.
    
    *** Using HTTP port 7101 ***
    
    *** Using SSL port 7102 ***
    
    /Users/filiphuysmans/.jdeveloper/system11.1.2.4.39.64.36/DefaultDomain/bin/startWebLogic.sh
    
    [waiting for the server to complete its initialization...]
    .
    .
    JAVA Memory arguments: -Xms256m -Xmx512m
    .
    Unrecognized option: -jrockit
    
    Error: Could not create the Java Virtual Machine.
    
    Error: A fatal exception has occurred. Program will exit.
    
    WLS Start Mode=Development
    .
    
    CLASSPATH=/Users/filiphuysmans/programs/JDev111240/oracle_common/modules/oracle.jdbc_11.1.1/ojdbc6dms.jar:/Users/filiphuysmans/programs/JDev111240/patch_wls1035/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/Users/filiphuysmans/programs/JDev111240/patch_jdev1112/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/tools.jar:/Users/filiphuysmans/programs/JDev111240/wlserver_10.3/server/lib/weblogic_sp.jar:/Users/filiphuysmans/programs/JDev111240/wlserver_10.3/server/lib/weblogic.jar:/Users/filiphuysmans/programs/JDev111240/modules/features/weblogic.server.modules_10.3.5.0.jar:/Users/filiphuysmans/programs/JDev111240/wlserver_10.3/server/lib/webservices.jar:/Users/filiphuysmans/programs/JDev111240/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/Users/filiphuysmans/programs/JDev111240/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:/Users/filiphuysmans/programs/JDev111240/oracle_common/modules/oracle.jrf_11.1.1/jrf.jar:/Users/filiphuysmans/programs/JDev111240/wlserver_10.3/common/derby/lib/derbyclient.jar:/Users/filiphuysmans/programs/JDev111240/wlserver_10.3/server/lib/xqrl.jar
    .
    PATH=/Users/filiphuysmans/programs/JDev111240/wlserver_10.3/server/bin:/Users/filiphuysmans/programs/JDev111240/modules/org.apache.ant_1.7.1/bin:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/jre/bin:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/bin:/usr/bin:/bin:/usr/sbin:/sbin
    .
    ***************************************************
    *  To start WebLogic Server, use a username and   *
    *  password assigned to an admin-level user.  For *
    *  server administration, use the WebLogic Server *
    *  console at http://hostname:port/console        *
    ***************************************************
    starting weblogic with Java version:
    Starting WLS with line:
    /Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/bin/java -jrockit   -Xms256m -Xmx512m -Dweblogic.Name=DefaultServer -Djava.security.policy=/Users/filiphuysmans/programs/JDev111240/wlserver_10.3/server/lib/weblogic.policy -Djavax.net.ssl.trustStore=/var/tmp/trustStore875832875455889226.jks -Dhttp.proxyHost=proxy.iconos.be -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=local|*.local|169.254/16|*.169.254/16|127.0.0.1|localhost|*.localhost|localhost.localdomain|::1|10.99.9.23|Filips-MacBook-Pro-2.local -Dhttps.proxyHost=proxy.iconos.be -Dhttps.proxyPort=8080 -Doracle.jdeveloper.adrs=true -Dweblogic.nodemanager.ServiceEnabled=true  -Xverify:none  -da -Dplatform.home=/Users/filiphuysmans/programs/JDev111240/wlserver_10.3 -Dwls.home=/Users/filiphuysmans/programs/JDev111240/wlserver_10.3/server -Dweblogic.home=/Users/filiphuysmans/programs/JDev111240/wlserver_10.3/server  -Djps.app.credential.overwrite.allowed=true -Dcommon.components.home=/Users/filiphuysmans/programs/JDev111240/oracle_common -Djrf.version=11.1.1 -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger -Ddomain.home=/Users/filiphuysmans/.jdeveloper/system11.1.2.4.39.64.36/DefaultDomain -Djrockit.optfile=/Users/filiphuysmans/programs/JDev111240/oracle_common/modules/oracle.jrf_11.1.1/jrocket_optfile.txt -Doracle.server.config.dir=/Users/filiphuysmans/.jdeveloper/system11.1.2.4.39.64.36/DefaultDomain/config/fmwconfig/servers/DefaultServer -Doracle.domain.config.dir=/Users/filiphuysmans/.jdeveloper/system11.1.2.4.39.64.36/DefaultDomain/config/fmwconfig  -Digf.arisidbeans.carmlloc=/Users/filiphuysmans/.jdeveloper/system11.1.2.4.39.64.36/DefaultDomain/config/fmwconfig/carml  -Digf.arisidstack.home=/Users/filiphuysmans/.jdeveloper/system11.1.2.4.39.64.36/DefaultDomain/config/fmwconfig/arisidprovider -Doracle.security.jps.config=/Users/filiphuysmans/.jdeveloper/system11.1.2.4.39.64.36/DefaultDomain/config/fmwconfig/jps-config.xml -Doracle.deployed.app.dir=/Users/filiphuysmans/.jdeveloper/system11.1.2.4.39.64.36/DefaultDomain/servers/DefaultServer/tmp/_WL_user -Doracle.deployed.app.ext=/- -Dweblogic.alternateTypesDirectory=/Users/filiphuysmans/programs/JDev111240/oracle_common/modules/oracle.ossoiap_11.1.1,/Users/filiphuysmans/programs/JDev111240/oracle_common/modules/oracle.oamprovider_11.1.1 -Djava.protocol.handler.pkgs=oracle.mds.net.protocol  -Dweblogic.jdbc.remoteEnabled=false -Dwsm.repository.path=/Users/filiphuysmans/.jdeveloper/system11.1.2.4.39.64.36/DefaultDomain/oracle/store/gmds   -Dweblogic.management.discover=true  -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=/Users/filiphuysmans/programs/JDev111240/patch_wls1035/profiles/default/sysext_manifest_classpath:/Users/filiphuysmans/programs/JDev111240/patch_jdev1112/profiles/default/sysext_manifest_classpath  weblogic.Server
    
    Unrecognized option: -jrockit
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.
    Process exited.
    
2 things go wrong here:
  • He tries to use the -jrockit VM-type.
  • There is no setting for the PermGenSpace
To solve this problem, perform the following steps:
  • Go to the domain directory to find the setDomainEnv.sh file.
    This file can be found in <your home directory>/.jdeveloper/system11.1.2.4.39.64.36/DefaultDomain/bin
  • Find the line with 'SUN_JAVA_HOME=""' and change/modify it to
      • SUN_JAVA_HOME=$BEA_JAVA_HOME
      • JAVA_VENDOR=Sun
      • export SUN_JAVA_HOME JAVA_VENDOR
  • Save the file and try to start the WLS Server