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.