donderdag 4 mei 2017

Unused Java actions resulting in compilation error

It has been a while since my last post. I'm still working on Mendix (currently on ancient version 5.19) and just hit a snag while refactoring some code developed by a Java fan. A lot of Java actions were used in a complex piece of code, which turned out impossible to maintain. After a lot of changes, 'exclude from project' and the first part of my new code being ready to test, I tried to do a  Run Locally and failed at the Java compilation stage. Nothing worked, clean deployment directory, synchronise project directory, manually deleting the deployment directory, etc etc etc.
I kept getting these errors:

  • RestServiceHandler.java:251: warning: '_' used as an identifier
  • cannot find symbol
  • package (xyz) does not exist
  • deployment\build_core.xml:27: Compile failed; see the compiler error output for details
I checked and rechecked, all Java actions were excluded or removed, enums were removed, all seemed as it should. I re-included the Java actions and then in the Mendix modeler I would see errors comparable to the java compilation errors (for example, not being able to find one of the old enums, etc). I deleted the javaactions instead of excluding, also no joy. Only possible explanation: somewhere some garbage Java code remained on disk, which somehow remained part of the compilation. 
Checking the "javasource\(module name)\actions\" and "..\proxies" directory showed me the culprits. Deleted documents from the project were still there and that failed my compilation.

Solution: I deleted the now unused javasource files from the project directory "javasource\(module name)\actions\" and the compilation went fine.


Errors in the build xml:
    [javac]   symbol:   class AttributeSettings
    [javac]   location: package changetracking.proxies
    [javac] private changetracking.proxies.EventType eventType;
    [javac]                              ^                                                                                            ^
    [javac] List attributeSettingsList = StaticSettings
    [javac]                                                ^
    [javac]   symbol:   variable StaticSettings
    [javac]   location: class BeforeCommitChangeTracking
    [javac] D:\MendixProj\xxx - Branch - yyyy\javasource\changetracking\actions\BeforeCommitChangeTracking.java:47: error: cannot find symbol
    [javac] for (AttributeSettings attributeSettings : attributeSettingsList) {
    [javac]     ^
    [javac]   symbol:   class AttributeSettings
    [javac]   location: class BeforeCommitChangeTracking
    [javac] D:\MendixProj\xxx - Branch - yyyy\javasource\changetracking\actions\BeforeCommitChangeTracking.java:59: error: package EventType does not exist
    [javac] EventType.BeforeCommit.toString())
    [javac]         ^
    [javac] D:\MendixProj\xxx - Branch - yyyy\javasource\changetracking\actions\EventChangeTracking.java:29: error: cannot find symbol
    [javac] this.eventType = eventType == null ? null : changetracking.proxies.EventType.valueOf(eventType);
    [javac]                                                                  ^
    [javac]   symbol:   class EventType
    [javac]   location: package changetracking.proxies
    [javac] Note: D:\MendixProj\xxx - Branch - yyyy\javasource\com\mendix\core\Core.java uses unchecked or unsafe operations.


donderdag 12 november 2015

Mendix and the Simple Charts

I've been struggling a few hours with generating statistics and then looked forward to creating some bar charts and pie charts. It was supposed to be simple.

If you know what you are doing, then sure, it's simple enough :)

For the bar chart, just create some a table and some data for the X-axis and a label for the Y-axis and you're good to go.
For a pie chart, you need to create a separate table with a label and a value, then create a list of these name/value pair objects and commit. Put the label on the X-axis and the value on the Y-axis.

However, the implementation of the pie chart is not super (november 2015). In the Features tab selecting Show Legend and Show Hover have no effect. The only way to manipulate the Simple Chart is by using the Extra options field. You know, that one which says 'this property should be omitted'.

There is no error checking on this, so it's a matter of trying out the various options to see what works and what not.
When you do start on this, some pointers:



Example 1:
{
        series: {
            pie: {
                show: true,
                label: {
                  threshold: 0.02
                }
            }
        },
        legend: {
              show: 'true'
        }
}

This will show a legend.
It will show only labels on the pie chart for sections which are larger than 2%



Example 2:
{
        series: {
            pie: {
                show: true,
                combine: {
                    color: '#999',
                    threshold: 0.05,

                    label: 'different than the others'
                }

            }
        },
        legend: {
              show: 'true'
        }
}

This will do the same as example 1, but then instead of not showing a label on a section, instead it will combine all sections smaller than 5% into one big section 'Other'. If you also specify the label parameter as I did here in this example, it will change the caption of the other category into 'different than the others'.


woensdag 29 april 2015

Mendix webservices: cannot find the declaration of element 'S:Body'

While working on an integration issue between 2 Mendix Apps, we kept running into an issue where a locally developed and tested integration worked fine, but after deploying it on the Test environment, errors kept occurring. Debugging led to the specific error " cannot find the declaration of element 'S:Body' " and in the java stack trace the mention of the Xerces libray, which handles Java webservice integration. Most likely (pending further investigation...) this means it's a server environment configuration issue. It seems to be that Mendix is not able to interpret (deserialization?) the incoming request. Can it be the the SOAP library is not available?

There are 2 options we are exploring:
- newer JRE version to be installed on the server
- settings of the VM need to be updated as the server is running On Premise.
This is our current approach for further researching a solution for this error:
There is an issue since Java 7, causing timeouts when using Web Services with a certain amount of data. You can circumvent this issue by adding the VM params "-Djava.net.preferIPv4Stack=true". The Mendix Business Modeler will do this for you but if you are running Mendix on premise on a Windows server you will need to do this yourself.
As found in the Mendix System Requirements.

"An error has occurred" in the Mendix UI: webservice with bad endpoint constant configuration

When working with webservices I kept on receiving the very clear (not) message "An error has occurred" in the Mendix UI. Locally developed and tested, all was fine, but when moved to the test environment, this kept popping up.
Debugging gave no further details, stack trace and additional logging showed a SOAP "fault" HTTP 200 OK.
However, under water a webservice was invoked, and for end point resolving we used a constant which is configurable for each environment; that is where it went wrong.

Locally the endpoint was configured correctly, but on the test server environment the endpoint was set to http://something.test.local/ws-doc/GetPersonList?wsdl
Obviously not the right endpoint, but no proper error information was available hinting at this.
So, check your endpoint configuration if you run into this error, when using Mendix webservices!

Moving on.... to Mendix

Since early this year I moved to the (rather)new and exciting platform Mendix. It is a platform that allows for Model Driven Development. Mendix makes it possible to very quickly generate interpretable models for business processes, which are recognizable for business end users, but allow for (Java) developers to still do what they want, just without needing to write thousands of lines of code. So from now on I will only post about Mendix and no longer SOA Suite.

donderdag 20 januari 2011

setTitle functionality in 10g and 11g

For debugging purposes and more easily tracing issues on the middleware you may want to give your instances a name, or a title. This is possible by putting some code in BPEL to produce a title in the BPEL Console (10g) or the Fusion Middleware Control (11g), even for the SCA composites in 11g.

10g
In 10g (10.1.3.3.0) the following code with the setTitle function will work to produce a Name for the instances in the BPEL Console, resulting in the text "EMPLID" followed by the client:input value, which in this example would be the employee ID:

    <bpelx:exec name="Assign_Title" language="java" version="1.3">
<![CDATA[java.lang.String titleValue=null;                        
oracle.xml.parser.v2.XMLElement titleValueElement= (oracle.xml.parser.v2.XMLElement)getVariableData("inputVariable", "payload" , "/client:TesterProcessRequest/client:input");            
titleValue=titleValueElement.getText();        
setTitle("EMPLID " + titleValue);  
addAuditTrailEntry("EMPLID " + titleValue);]]>
</bpelx:exec>


11g
In 11g there is a comparable functionality with the function ora:setCompositeInstanceTitle("Hello World"); which can be used in for example an assign activity in the From statement and for the To variable a dummy could be used.


Other info
You can also do a direct update on the database level in the OraBPEL schema on the column "Title" in the CUBE_INSTANCE table (ORABPEL.CUBE_INSTANCE.TITLE). This works on 10g, I have not tried it on 11g. It's of course not recommended by Oracle.

Also note the following bug on Oracle support:
Bug 9953763 - SETTITLE FUNCTIONALITY IS MISSING IN INSTANCEHANDLE OF JAVA API

And I found this article to be rather interesting: http://technology.amis.nl/blog/2387/embedding-java-in-bpel-process

New features SOA Suite 11g

* Composite Applications
With a functional design on a logical level an application is one component. When building the application functionality is split up over multiple technical components, for example BPEL, Java, database or file adapters, business rules and human workflow. So complexity goes up and maintenance, build, test, etc goes up as well. By the way which SOA Suite 11g approaches composite applications using the SCA assembly model, complexity will not get out of hand, while retaining possibilities to easily reuse (previously created or out of the box supplied) assets.
* OER
Oracle Enterprise Repository will be getting more integrated as 11g matures.
* AIA PIPs
More PIPs will be created by Oracle or in conjuction with clients or third parties (like Capgemini).
* JCA
A JCA-based connectivity infrastructure will provide an embedded policy manager for security.
* Business rules
Business rules take a more important role in 11g. The 'Decide' activity is even replaced by the business rule activity. In the next release there will also be a webbased GUI for (business analysts) users to modify the business rules directly at runtime.
* SOA Fabric
In the coming releases a more integrated SOA Fabric will be introduced.

dinsdag 22 september 2009

Dynamic endpoints in BPEL

On the Oracle website there is a good document that describes how you can make your BPEL projects to use Dynamic endpoints.

http://www.oracle.com/technology/pub/articles/bpel_cookbook/carey.html

It lacks a few things. One is a link to the WS-Addressing xsd, which you can of course find on http://schemas.xmlsoap.org/ws/2004/08/addressing/addressing.xsd

Also in this example cookbook it is hardcoded, which actually is the way not to do it since that is the whole point of making endpoints dynamic: so that on deployment to another environment your sourcecode does not need to be changed/recompiled. I am using a db adapter now myself with a response time of 69ms. As long as there is a low volume of transactions this should be fine.


Related version: 10.1.3.4.0

maandag 14 september 2009

LOG files

There are multiple locations where you can find log files. See at the bottom of this post how to increase logging.

On the server there is a main directory under which most of the configuration, faultpolicy directory and log files are stored. For a Windows 2003 Server this could be:
c:\product\10.1.3.4\OracleAS\bpel\domains\default\
C:\product\10.1.3.1\OracleAS\bpel\system

Other logs are available here:

Webserver (apache) log:
C:\product\10.1.3.4\OracleAS\Apache\Apache\logs

OC4J log (java container):
C:\product\10.1.3.4\OracleAS\j2ee\oc4j_soa\log\oc4j_soa_default_group_1\oc4j

OPMN log:
C:\product\10.1.3.4\OracleAS\opmn\logs


To increase the logging some options in the BPELConsole can be modified:
Go to the BPELConsole - Configuration - Logging.
Standard almost all logging levels are set to INFO and some are on DEBUG.
DEBUG is the lowest level and produces the most logging information.

PLEASE NOTE Do not put everything on Debug!
If you set all options to DEBUG level you will risk crashing the server because of an extreme amount of logging data.

The most interesting options on which you can(should consider to) increase logging are the following 3:

default.collaxa.cube.activation = incoming queue/fileadapter logging
default.collaxa.cube.ws = outgoing messages when invoking adapters
default.collaxa.cube.xml = pickup messages and convert to xml data

Related version: 10.1.3.4.0

WSDL errors, Cannot figure out operation name. Bad SOAPAction or wsa:Action

If you get error messages like Cannot figure out operation name. Bad SOAPAction or wsa:Action or other strange things after you've changed something related to the WSDL then this might be a solution.
One of the possible error messages:

<env:Fault xmlns="http://xmlns.oracle.com/LeaveBalancePSProvABCSImpl">
  <faultcode xmlns="">null:LeaveBalancePSProvABCSImpl</faultcode>
  <faultstring xmlns="">Cannot figure out operation name. Bad SOAPAction or wsa:Action.</faultstring>
  <faultactor xmlns="">process</faultactor>
</env:Fault>

In our case we had modified the webservice LeaveBalancePSProvABCSImpl, which had 2 operations after a "get" was added next to the "process" operation and then we removed the process operation so we changed it back to only 1 operation (the "get"). The wsdl then is still cached somehow and even cleaning the cache through the BPELConsole does not fully work.

So, go to your DOMAIN directory on the Application Server (standard that is the 'default' domain), for example:
c:\product\10.1.3.4\OracleAS\bpel\domains\default and then under the \tmp\ directory, delete both references to your webservice.
You will need to stop all activities before deleting these temp files is possible (Oracle_AS\opmn\bin\opmnctl\opmnctl stopall)

Related version: 10.1.3.4.0

Available xpath functions

If you want to know the signature of a function, you can take a look at the xpath-functions.xml
This file can be found where your Application Server is installed. This has a list of all available functions and under which namespace each is registered.

For example on an MS Windows 2003 Server it could be C:\product\10.1.3.1\OracleAS\bpel\domains\default\ or under C:\product\10.1.3.4\OracleAS2\bpel\system\config

Change the title of the instances in the BPELConsole

To show a custom title in the BPELConsole it is possible to include in every .bpel process a piece of code.

Example:
<bpelx:exec name="Assign_Title" language="java" version="1.3">
  <![CDATA[java.lang.String titleValue=null;
oracle.xml.parser.v2.XMLElement titleValueElement= (oracle.xml.parser.v2.XMLElement)getVariableData("inputVariable", "payload" , "/client:TesterProcessRequest/client:input");
  titleValue=titleValueElement.getText();
  setTitle("Employee " + titleValue);
  addAuditTrailEntry("Employee " + titleValue);]]>
</bpelx:exec>

This code will result in a title starting with the text Employee followed by (concatenate) the value from the inputVariable, element input. In my case this will be the employee id.

Modifying the setTitle will improve tracebility. By doing a search on the text Employee and the id of the employee you want to find the performed data updates for, will result in a list of all instances with that title. A very useful change that I would advise to include in all BPEL processes as a Best Practice.

Passing XML as parameter to an XSLT transformation, Oracle BPEL

In this document an example is given on how to import an XML parameter into a XSLT tranformation.

Step 1) Define the variable ‘XSLTParams’

Define a variable ‘XSLTParams’, based on the element {http://schemas.oracle.com/service/bpel/common}parameters

This is defined in an external xsd which will have to be imported upon making the variable.

The xsd looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://schemas.oracle.com/service/bpel/common"
    targetNamespace="http://schemas.oracle.com/service/bpel/common"
    elementFormDefault="qualified">
<xsd:element name="parameters">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="item" minOccurs="1" maxOccurs="unbounded">
      <xsd:complexType>
        <xsd:sequence>
          <xsd:element name="name" type="xsd:string"/>
          <xsd:element name="value" type="xsd:string"/>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:element>
   </xsd:sequence>
  </xsd:complexType>
</xsd:element>
</xsd:schema>


Step 2) Assign the value and name to the XSLTParams:
<assign name="Assign_XSLTParams">
  <copy>
    <from expression="'AssignmentData'"/>
    <to variable="XSLTParams" query="/bpelcommon:parameters/bpelcommon:item/bpelcommon:name"/>
  </copy>
  <copy>
<!-- Replace the variable and namespace ns10 with your variable and namespace -->
    <from expression="ora:getContentAsString(bpws:getVariableData 'Invoke_GetAssignment_OutputVariable','payload','/ns10:EBO_GET_ASSIGNMENT_CIResponse'))"/>
    <to variable="XSLTParams" query="/bpelcommon:parameters/bpelcommon:item/bpelcommon:value"/>
  </copy>
</assign>


Step 3) Call the transformation WITH the property (parameter) XSLTParams:
<assign name="XForm_CombineInputForCheckAddressAndDistance">
  <bpelx:annotation>
    <bpelx:pattern>transformation</bpelx:pattern>
  </bpelx:annotation>
  <copy>
<!-- Replace the variable inputVariable and transformation xslt filename with your variable and file name -->
    <from expression="ora:processXSLT('XForm_CombineInputForCheckAddressAndDistance.xsl',bpws:getVariableData('inputVariable','payload'),bpws:getVariableData('XSLTParams'))"/>
    <to variable="Invoke_CheckAddressAndDistance_initiate_InputVariable" part="payload"/>
  </copy>
</assign>


Step 4) Add the parameter in the transformation:

Put the following code in your transformation, below the namespaces, above the first line of code:
<!-- import the parameter in the xslt transformation -->
<xsl:param name="AssignmentData"></xsl:param> 

<!-- replace ampersands to fix possible later issues in data exchange -->
<xsl:variable name="AmpersandReplacement">&amp;</xsl:variable>
<xsl:variable name="AssignmentData_fixed" select="str:replaceAll(string($AssignmentData),'\u0026(amp;)*+',$AmpersandReplacement)"/>
<xsl:variable name="AssignmentDataEBM"  select="orcl:parseEscapedXML($AssignmentData_fixed)"/>


Step 5) Use XML values from within the fixed parameter:
<eboupreq:ADDRESS>
  <xsl:value-of select="$AssignmentDataEBM/ns0:ADDRESS"/>
</eboupreq:ADDRESS>

Replace the namespaces, variable names, etc, where appropriate.

maandag 29 juni 2009

Welcome

Welcome to my blog.

On this blog I will keep a record of interesting things or lessons learned during my work, related to Oracle Fusion Middleware / SOA Suite.