... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)


Eclipse TreeViewer

I tried an experiment to explore the behaviour of Eclipse TreeViewers when their input model was changed.  I was hoping that if the new model was equivalent to the old using equals(), then the tree would not collapse and lose its selection.  No such luck.  The new model must be '==' the old model to retain tree state.


Eclipse Bundles vs. BEA SDO Classloaders

I had a set of Eclipse plug-ins, one of which contained BEA's SDO implementation and another that used it.  Most of the time, SDO objects could be loaded and manipulated without problems.  But when I tried this snippet:

String graphXml = originalObject.getDataGraph().toString();
DataGraph newGraph = new DataGraphImpl(graphXml);

I got the exception:

SDO generated classes for: {http://www.mm.com/xmlns/2006/esi.manage/api/}DataModelis not in the classpath

The fix was to adjust the manifest for the SDO plug-in so that it would look in dependent plug-ins when trying to load classes.  The relevant entry in MANIFEST.MF was:

Eclipse-BuddyPolicy: dependent


Eclipse RCP Forms

On forms at least, if you create a composite but do not associate a layout with it, none of the component widgets will appear within the composite.

If you are using a managed block on a form, but you do not set the text ("title") of the form to anything, the detail panel will not resize properly when the window is resized.  The detail panel will remain a fixed size and a scrollbar will appear on the bottom.

Many types of changes (like changing the form text to fix the detail panel resizing problem, above) do not take full effect if you are relying upon hot code downloading in a debugging session.  You have to exit the application and restart it.


Eclipse RCP Forms

If you are using a MasterDetailBlock, if you try to create content for an IDetailsPage setting the marginHeight on a Section to anything other than zero, the content of the whole section will be displayed incorrectly.  e.g.

    public void createContents(Composite parent) {
        TableWrapLayout layout = new TableWrapLayout();
        layout.topMargin = 5;
        layout.leftMargin = 5;
        layout.rightMargin = 2;
        layout.bottomMargin = 2;

        FormToolkit toolkit = _managedForm.getToolkit();
        Section section = toolkit.createSection(parent, Section.DESCRIPTION);
        section.marginWidth = 10;
        section.marginHeight = 5; // don't try to do this
        section.setText("Lookup Types");
        section.setDescription("Some description...");

Also, if you do not set the layout on the parent of a details page, the details won't show up at all.


BEA Workshop vs. EsiPlatformDataDS Build Process

The problem was that the JAR file wlsdo.jar was not accessible to Workshop.  It is not clear why this is the case.  Three solutions were identified:

  1. Add wlsdo.jar to the application in the Libraries folder.
  2. Add wlsdo.jar as an additional classpath entry in the application preferences.
  3. Add wlsdo.jar as an additional classpath entry in C:\esidev\bea\weblogic81\workshop\Workshop.cfg.

We chose #3.  #1 had the problem it creates a copy of the JAR, so it just creates one more place that needs to be updated if we ever change versions.  #2 had the problem that we could not locate where the additional entry was being stored -- it was not anywhere within the application source directory.

Another problem we noted was that if you attempt to build a data service project when some of the underlying XSD files are missing, then you will get a cryptic error message suggesting that you verify that the temp folder is writable.  In our case, the XSD files were being copied into the project by a previous step.  If you missed that step, the error message was not much good a reminding you to do the copy.  The same 'temp folder' message will also appear if the APP-INF/lib directory does not exist.


BEA Workshop vs. EsiPlatformDataDS Build Process

I discovered today that you cannot build our EsiPlatformDataDS project from within BEA workshop after performing a 'clean'.  The error is 'package commonj.sdo does not exist'.  If you run our automated build within Eclipse for that project, then BEA workshop will start working as well -- until the next 'clean'.

Further investigation is needed to figure out why this is happening.

On a related note... don't give BEA Workshop focus while running a build of the application from outside (e.g. from within Eclipse).  If you do, then workshop will note that project files have changed and will kick off a build of its own.  The two builds will conflict and neither will work properly.


Oracle 9.2 Client Installer

Under Windows at least, the Oracle 9.2 Client Installer prepends a JRE 1.3.1 to the front of the system PATH.  This changes the ambient JRE and thus has the potential to break various Java components -- especially those that need a more current (i.e. not totally obsolete) version of Java.  A quick solution is to move Oracle's PATH entries to the end of the PATH instead of at the beginning.

Universal Data Link Files

A quick to construct OLE DB or ODBC connection strings on Windows is through Universal Data Link or .UDL files.  Create an empty file with a .UDL extension.  Then open it, which will bring up a nice UI for configuring the data source.  When finished, the file will contain the appropriate connection parameters.


Apache Tomcat

I noticed that when I was deploying (and especially reploying) WAR files to Apache Tomcat, sometimes the deployment would not be complete.  In particular, the exploded WAR directory only contained a small subset of the files in the WAR.  Furthermore, when I undeployed the WAR, portions of the exploded directory would not be deleted.  I found a solution, however.  Edit the CONTEXT element in context.xml to have the attribute antiJARLocking="true".  You can do this for the context descriptor for the individual application (if any), or by editing the global context.xml in the Tomcat configuration directory.


Eclipse Forms

The Eclipse Forms Programming Guide is a tutorial about creating forms in Eclipse.  One of its first example creates a text box that is supposed to have a 'flat' border.  However, if you actually run the sample code, it does not work -- no border is drawn.  After much gnashing of teeth, I determined that a line of code was missing from the example:


You must use this incantation to get field borders drawn.


Wiki Password Lists

When storing passwords in protected HTML files, I have routinely set the text to black on black so that the passwords cannot be read by people wandering by, and also so that they are not readable when printed.  Some wikis, don't allow black on black text, so here is another cheesy alternative... create a hyperlink that pops up the the password, which is trivially encoded to stymie the passers-by:

<a href="javascript:alert(String.fromCharCode(112,97,115,115,119,111,114,100));">?</a>

Here is a snippet to URL-encode a password using a Javascript console:

var p="password"; var s = ""; for (var i = 0; i < p.length; ++i) { s += (i>0?",":"") + p.charCodeAt(i) }; s;


Oracle 10g

Oracle now has a "recycle bin" for dropped tables.  A DROP command now just renames a table to a long obnoxious name and marks it a being in the recycle bin.  To delete it permanently, you must either use DROP TABLE XXX PURGE or PURGE RECYCLEBIN.  A DBA can use PURGE RECYCLEBIN_DBA to purge all recycle bins for all users.

This functionality is known as the "flashback feature".


Eclipse vs BEA ALDSP Client JARs

For reasons unknown, occasionally if I rebuild an ALDSP Client JAR in Workshop, then refresh a project which references the JAR in Eclipse, Eclipse still does completely pick up any new classes and packages.  The code completion will recognize them, but the compiler does not.  Closing and re-opening the Eclipse project corrects the situation.


Here is the final result.  ALDSP uses the first function in a data service as the submission function, regardless of which function was used to actually retrieve the data.  Therefore, that function must conform to the ALDSP rules, which are:

  1. The return type must match the return type of the data service (like all functions in a data service).
  2. The return type must have cardinality 1 or 0..1.
  3.  (i.e. a declaration like:  declare function submitter(args) as ReturnType*).

In addition, you must build the application before any submissions will work, unlike reader functions which will work right away.

The second requirement is not entirely obvious because by default the Workshop generates reader functions with cardinality 0..*.  However, somewhere in the ALDSP machinery this case is detected and the infrastructure quietly wraps a new cardinality 1 element around the result, typically named 'ArrayOfYourType' (or sometimes 'YourTypeArray' for nested elements).

I don't understand why ALDSP requires a wrapper element in the 0..N case, but not the 0..1 case.

Build Issues

Another thing I discovered is that if you accidentally add a BEA function pragma to a function (e.g. by copy-and-paste from another function) they will work when you test from within workshop.  But when you go to build the application you will get an error message like:

ERROR: workflow3.ds:1:: [ld:DsTest/MmSandbox/workflow3.ds]: The namespace of the function "{http://www.w3.org/2004/07/xquery-local-functions}wraprow" with arity 1 does not match the expected namespace "ld:DsTest/MmSandbox/workflow3".

The Workshop XQuery editor will complain about any functions (including local functions) in a data service file whose namespace does not match the target namespace of the service, but this warning is spurious as the file will still build, deploy, and function properly.  If you want to avoid the warning, declare the function in the target namespace instead.

Apparently, using "build application" in BEA Workshop is not sufficient for the environment pick up certain changes.  I moved a data service file from ".../schemas//bestpractice.ds" to ".../bestpractice.ds".  The environment did not pick up the change even after I did "build application" and even after a "clean" followed by a "build".  Only after I chose "Build EAR" was the change noticed.

Furthermore, some classes of changes (e.g. renaming a data service) may not be picked up by the Workshop test tool until after exiting and re-entering the Workshop application.



I was struggling with submitting updated data graphs through BEA.  My data source looked something like this:

declare function tns:getWrapper() as element(ns0:TestWrapper) {
    let $TEST_TABLE := ns1:TEST_TABLE()[ID=1]

where ns1:TEST_TABLE was a physical data source.  However, whenever I tried to submit changes to this function, I would get the dreaded "no lineage" exception.  I tried various other forms for the data source, such as:

declare function tns:getWrapperForUpdate() as element(ns0:TestWrapper)* {
    for $TEST_TABLE in ns1:TEST_TABLE()

Depending upon how aggressive I got with the various wrapping elements, the submits may or may not work.  Then...

I discovered that the data service test tool in BEA Workshop supported submits.  So I tried using it to test various combinations.  One thing I noticed right away was that when I pressed the 'edit' button, the data would be retrieved in a completely different form with various "holder" elements supplied automatically.  For example, the first data service shown above would have all of its data returned in a wrapping TestWrapperDocument element.  The second data service had ArrayOfTestWrapperDocument and TestWrapperArray elements introduced throughout the tree.  Now comes the strangest part...

After messing around with various submissions through the test tool, suddenly submits that formerly didn't work started working.  Even my external Java client started working.  Apparently, the mere act of testing submissions through the test tool is enough to either change internal configuration information or perhaps even generate more classes that makes things work.  I have been unable to determine the exact sequence of events to make this magic happen.  More investigation is needed, and it seems important to build the application and/or the EAR after getting a successful submission.  Stay tuned.

Apache Tomcat 5.5 Java Options

If you try to configure debugging using the Tomcat 5.5 monitor/configuration applet, make sure that you separate the individual options under Java/Java Options with newlines (e.g. put -Xdebug on a separate line from -Xrunjdwp).  If you don't, then the settings are quietly ignored (or, at least, I couldn't find any evidence of their failure).

Oxygen SOAP Analyser vs. Eclipse

If you attach a debugging session to a web server, set a breakpoint in a web service, and then invoke the web service from the Oxygen SOAP analyser, a dialog will come up saying that the analyser is awaiting a response from the server.  However, the server is not going to respond because the breakpoint is hit.  The dialog is modal, so you can't do anything.  To make matters worse, the cancel button does nothing.  The only way out of this situation is to kill the Eclipse process.

Blog Archive