... 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 :)

2005-12-20

BEA Aqualogic DSP

I tried to do a federated update using Aqualogic DSP.  I got this error message:

java.rmi.RemoteException: EJB Exception: ; nested exception is: com.bea.ld.dsmediator.DataServiceException: java.sql.SQLException: Connection has already been created in this tx context for pool named inventoryMM. Illegal attempt to create connection from another pool: inventoryDev2

This issue appears to be that the JDBC driver that I was using is not XA compliant.  I tried switching to the XA version of the BEA MS SQL Server JDBC driver, but it required changes to the underlying SQL Servers to function correctly.  So I tried the jTDS XA driver instead, in 'XA emulation' mode where it pretends to participate in XA transactions, but doesn't.  That didn't work -- I got the error message:

Error obtaining database connection 'inventoryDev1': SQL operations are not allowed with no global transaction by default for XA drivers. If the XA driver supports performing SQL operations with no global transaction, explicitly allow it by setting "SupportsLocalTransaction" JDBC connection pool property to true. In this case, also remember to complete the local transaction before using the connection again for global transaction, else a XAER_OUTSIDE XAException may result. To complete a local transaction, you can either set auto commit to true or call Connection.commit() or Connection.rollback().

I tried the 'supportsLocalTransaction' suggestion, but then I got another error message (which I forgot to write down).  [After trying the steps that follow, I wonder whether it all would have worked if I had just restarted the servers in the right order...]

I decided to bite the bullet and use BEA's XA drivers.  The first step is to install a DLL and some stored procedures in each server, following the instructions in Installing Stored Procedures for JTA from the WebLogic JDBC driver manual.  I then created drivers for three machines.  Two were Windows 2003 Server boxes and the connection pools came up right away.  However, the third machine was my XP workstation, and when I tried to test the connection pool, I got a message saying the SQL Server was unable to contact the DTC service.  I tried to start the service, but I still got the error message:

java.sql.SQLException: [BEA][SQLServer JDBC Driver][SQLServer]xa_open (0) returns -3

After much fiddling about, I discovered that I had to restart all the relevant services after making changes.

I tried to run some data service functions in WebLogic Workshop, but once again I got the "no global transaction" error.  So once again I tried setting the 'supportsLocalTransaction' option, but this time the data service worked... as did a single-source read through the SDO client, and a single-source write, and a multi-source write (which was the problem to be solved).

  So, the winning formula was:

  1. Install the required DLL and stored procedures in SQL Server (Installing Stored Procedures for JTA).
  2. Start the DTC service.
  3. Use Component Services administrative tool to enable remote logins and XA transactions in the DTC service, and to start the service.
  4. Restart SQL Server.
  5. Start the WebLogic server.
  6. Create the connection pool in WebLogic using the BEA XA SQL Server driver.
  7. Set the 'support local transactions' option on the pool.
  8. Repeat steps 6 and 7 as many times as needed.

A posting on the BEA JDBC newsgroup was helpful, SQLException when creating XA connection pool.

2005-12-19

TortoiseSVN

I noticed that the TortoiseSVN process TSVNCache was growing by 4K every few seconds.  At times, it was also consuming 50% of the CPU.  Since my machine was acting sluggish from time-to-time, I suspected that TSVNCache might be the problem.  The TortoiseSVN mailing list was full of people discussing/complaining about the performance of the cache feature.  The general consensus was that while the caching thread was running with 'idle' priority, it was performing a large number of uninterruptible I/Os.  The net result was that the process was too resource intensive.  The solution is to turn of 'recursive processing' in the TortoiseSVN settings.  Note that this setting was removed from early versions of TSVN 1.2, only to be re-introduced in later versions as a result of this issue.  TSVN 1.2.6 has the setting.  See http://svn.haxx.se/tsvn/archive-2005-05/1219.shtml.

2005-12-13

Aqualogic

BEA Aqualogic has difficulty with database objects with non-standard SQL names.  For example, when I tried to import metadata from a table with a dash in its name, none of the table's columns were retrieved.  No errors were reported, neither in the Workshop UI nor in the various log files.  I traced the SQL and noticed that Aqualogic was not escaping any of the SQL identifiers.

If you execute an ad hoc query using DataServiceFactory.prepareExpression(), you must return a single element as the result.  If you return...

  • ... an atomic type, the error is "Unexpected element: CDATA"
  • ... multiple elements, the error is "Unexpected element: OPEN_TAG"
  • ... zero elements, the error is "Unexpected end of file after null"

2005-12-12

Maven

I was looking at Maven again today.  Version 2.0 looks quite impressive.  The features that caught my eye were the dependency management and the automatic Eclipse project generation function.  Lots of useful information can be found in the Maven Blogs.  Also of interest are the Maven SCM plug-ins, and a continuous build server from the Maven team called Continuum.

BEA Aqualogic

Using the BEA Aqualogic Data Services Platform, Workshop version 8.1.4, I had trouble building the SDO mediator client JAR.  The problem was that none of my changes were making it into the client JAR.  I discovered that you must manually rebuild the application EAR file first -- rebuilding the application alone is not enough.  Apparently, Workshop never rebuilds the EAR file automatically -- at least I haven't found a way to do so.  The 'clean application' command does not delete the EAR file.  Note it doesn't matter whether or not the WebLogic server is running during any of these activities.

As an aside, I cannot find any way at all to delete an imported relational data service.  I had imported a table called 'well'.  I manually deleted the DS file, and rebuilt the application.  It was unable to compile another data service that referenced 'well' as a relationship.  I manually deleted the relationship function, and then the application built completely.  However... when I created the client JAR, 'well' was still there.  I can't find any reference to it anywhere, so I'm not sure why it is still turning up.

ibiblio

Maven interacts with ibiblio, self-styled as "the public's library and digital archive".

2005-12-01

JUnit Fixture Setup

suite() method as follows:

    public static Test suite()
    {
        return new TestSetup(new TestSuite(ThisClass.class)) {
            protected void setUp() { setUpFixture(); };
            protected void tearDown() { tearDownFixture(); };
        };
    }

It doesn't work properly in Eclipse, however, if you try to run a single test method -- the fixture set-up and tear-down are not run.  SingleSetupTestSuite defined in my SQL testhelpers library does not suffer from this problem (perhaps I should make a general version of that class some day).

2005-11-30

BEA vs JDK 1.5

When I tried to run the SDO client tutorial code from the AquaLogic Data Services Platform example, I got an obnoxious stack trace:

Exception in thread "main" com.bea.ld.dsmediator.client.exception.SDOMediatorException: com.bea.ld.dsmediator.client.exception.SDOMediatorException: weblogic.rjvm.PeerGoneException: ; nested exception is: 
	java.io.EOFException
	at com.bea.ld.dsmediator.client.XmlDataServiceBase.invoke(XmlDataServiceBase.java:117)
	at com.mm.provisional.bea.sandbox.SdoReader.test(SdoReader.java:34)
	at com.mm.provisional.bea.sandbox.SdoReader.main(SdoReader.java:64)
Caused by: com.bea.ld.dsmediator.client.exception.SDOMediatorException: weblogic.rjvm.PeerGoneException: ; nested exception is: 
	java.io.EOFException
	at com.bea.ld.dsmediator.client.XmlDataServiceBase.invokeQuery(XmlDataServiceBase.java:188)
	at com.bea.ld.dsmediator.client.XmlDataServiceBase.invoke(XmlDataServiceBase.java:105)
	... 2 more
Caused by: weblogic.rjvm.PeerGoneException: ; nested exception is: 
	java.io.EOFException
	at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
	at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:290)
	at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:247)
	at com.bea.ld.Server_ydm4ie_EOImpl_814_WLStub.executeFunction(Unknown Source)
	at com.bea.ld.dsmediator.client.XmlDataServiceBase.invokeQuery(XmlDataServiceBase.java:160)
	... 3 more
Caused by: java.io.EOFException
	at weblogic.rjvm.t3.T3JVMConnection.endOfStream(T3JVMConnection.java:874))
	at weblogic.socket.SocketMuxer.deliverExceptionAndCleanup(SocketMuxer.java:583)
	at weblogic.socket.SocketMuxer.deliverEndOfStream(SocketMuxer.java:533)
	at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:691)
	at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:638)
	at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:282)
	at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:32)
	at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
	at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

On the server side, the stacktrace is:

java.io.InvalidClassException: javax.xml.namespace.QName; local class incompatible: stream classdesc serialVersionUID = 4418622981026545151, local class serialVersionUID = -9120448754896609940
        at java.io.ObjectStreamClass.initNonProxy(Ljava.io.ObjectStreamClass;Ljava.lang.Class;Ljava.lang.ClassNotFoundException;Ljava.io.ObjectStreamClass;)V(Unknown Source)
        at java.io.ObjectInputStream.readNonProxyDesc(Z)Ljava.io.ObjectStreamClass;(Unknown Source)
        at java.io.ObjectInputStream.readClassDesc(Z)Ljava.io.ObjectStreamClass;(Unknown Source)
        at java.io.ObjectInputStream.readObject0(Z)Ljava.lang.Object;(Unknown Source)
        at java.io.ObjectInputStream.readObject()Ljava.lang.Object;(Unknown Source)
        at weblogic.rjvm.ClassTableEntry.readExternal(Ljava.io.ObjectInput;)V(ClassTableEntry.java:33)
        at java.io.ObjectInputStream.readExternalData(Ljava.io.Externalizable;Ljava.io.ObjectStreamClass;)V(Unknown Source)
        at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava.lang.Object;(Unknown Source)
        at java.io.ObjectInputStream.readObject0(Z)Ljava.lang.Object;(Unknown Source)
        at java.io.ObjectInputStream.readObject()Ljava.lang.Object;(Unknown Source)
        at weblogic.rjvm.InboundMsgAbbrev.readObject(Lweblogic.common.internal.ChunkedObjectInputStream;)Ljava.lang.Object;(InboundMsgAbbrev.java:65)
        at weblogic.rjvm.InboundMsgAbbrev.read(Lweblogic.common.internal.ChunkedObjectInputStream;Lweblogic.rjvm.BubblingAbbrever;)V(InboundMsgAbbrev.java:37)
        at weblogic.rjvm.MsgAbbrevJVMConnection.readMsgAbbrevs(Lweblogic.rjvm.MsgAbbrevInputStream;)V(MsgAbbrevJVMConnection.java:210)
        at weblogic.rjvm.MsgAbbrevInputStream.readMessageContext()V(MsgAbbrevInputStream.java:235)
        at weblogic.rjvm.ConnectionManager.dispatch(Lweblogic.rjvm.MsgAbbrevJVMConnection;Lweblogic.utils.io.Chunk;)V(ConnectionManager.java:735)
        at weblogic.rjvm.t3.T3JVMConnection.dispatch()V(T3JVMConnection.java:760)
        at weblogic.socket.NTSocketMuxer.processSockets()V(NTSocketMuxer.java:105)
        at weblogic.socket.SocketReaderRequest.execute(Lweblogic.kernel.ExecuteThread;)V(SocketReaderRequest.java:32)
        at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:219)
        at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
        at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)

This indicates that the standard Java class QName has changed.

The BEA support pages were no help, but after some experimentation I found out that the error only occurred using JDK 1.5.  If I ran under JDK 1.4.2, the problem disappeared.  This was the second JDK 1.5 incompatibility that I have observed in the last few days, but I cannot remember what the other one was (should have written a diary entry).

2005-11-28

If you attempt to edit an XQuery in an AquaLogic Data Service and you find that you cannot associate an entity with a zone, it might be too late.  The BEA documentation cryptically states that the order that you wire things together might be significant.  In particular, you should create all zones prior to creating any WHERE clauses in the query.

2005-11-18

Thick Web App vs. Thin Web App -- The Back Button Test

There is great debate about when a web application is "thick" versus when it is "thin".  As a result, application thickness has a spectrum rather than a boundary.  However, here is a rule of thumb to help make the determination -- the "back button test".  If the back button doesn't work in a web app, it is almost certainly a thick app.  If it does work, then the app is quite likely to be thin.  The test isn't perfect, but it works quite well in practice.

MS Exchange / Outlook Web Access

Outlook Web Access does not appear to be proxy friendly.  It uses non-standard HTTP verbs.  I observed SEARCH and SUBSCRIBE.  SEARCH appears to be a old proposed extension to WebDAV.  I can't find anything about SUBSCRIBE.  Interestingly, the MS web sites don't seem to have any information about these verbs.  OWA only appears to use these verbs when talking to IE -- when I tried FF, only standard HTTP verbs were used (and the application looks quite different).

2005-11-17

Internet Explorer XSLT Output

I always have trouble locating the IE extension that allows you to view XSLT output, so I thought I'd capture the URL for future reference:

Internet Explorer Tools for Validating XML and Viewing XSLT Output

The file is called iexmltls.exe.

2005-11-16

oXygen

I posted a message on the oXygen forum:

Is there a way to install a custom URI resolver for use in Saxon XQuery? I would like to achieve the equivalent of using the Saxon command line argument '-r', but within the context of an oXygen session.

2005-11-10

MS SQL Server

Here is an MS SQL query that writes an SQL query to show the row counts for all user tables:

select line
from (
  select 0 seq, 'select null table_name, null row_count where 1=2' line
  union select 1, 'union select '''+name+''', count(*) from ['+name+']'
    from dbo.sysobjects where type='U' and name<>'dtproperties'
  union select 2, 'order by 1'
) lines
order by seq, line

2005-11-03

IIS Virtual Hosts

If you create multiple web sites in IIS (i.e. virtual hosts), you may see an error like this when trying to access anything other than the default web site:

Bad Request (Invalid Hostname)

For example, on the domain mm.local, we created a new web site called wiki on the collaboration server.  If you tried to hit the server using the address wiki.mm.local, all would work properly.  But if you tried just wiki, then you would get the exhibited error message.  To correct this, open the properties page for the web site, select the Web Site tab and click the Advanced button.  In the Multiple identities for this Web site section, ensure that both the long and short names for the web site are listed (e.g. both wiki.mm.local and wiki).

XQuery Engines

A site that lists many XQuery engines can be found at:

SQL Summit Catalog of XQuery Engines, Processors and Tools

2005-10-17

JIRA

In JIRA 3.3.2-#98, there is a bug when you delete a project that has the only reference to a workflow scheme.  JIRA will think the scheme is still active, and will not allow you to edit it.  This appears to be a caching problem as restarting the JIRA service will correct the problem.

2005-10-10

Visual Studio Web Projects (Again)

As usual, I received the error message "Unable to retrieve folder information from the server" for a VS web project that contained a filename

starting with a dot (i.e. .SVN).  I am used to simply acknowledging this message and continuing, but for some reason this time the web project would not even open.  I was able to solve this, using the following steps:

  1. Change the setting Tools/Options/Projects/Web Settings/Preferred access method to FrontPage Extensions and reload the project.  It will fail, showing the error message.
  2. Reset that setting to File Share and reload -- again, failure with the message.
  3. Reload the project again -- it will fail again.
  4. Reload the project again -- the message will appear, but the project will load.

Thereafter, the project will load successfully (even though the error message is shown every time the project is loaded).  Black magic, to be sure.  This problem is supposedly fixed in VS2005, but I haven't tried that yet.

(this entry was updated on 2005-10-17)

2005-09-29

Protege, FaCT++

The old RACER OWL reasoner is no longer open source, but I found a decent replacement called FaCT++.

2005-09-26

ActiveDirectory Domain Controller

Today I solved an issue with an ActiveDirectory Domain Controller.  It started when my workstation could not find a domain controller (DC).  The DC's event log was showing errors with the event ID 5781:

Dynamic registration or deletion of one or more DNS records associated with DNS domain 'mm.local.' failed. These records are used by other computers to locate this server as a domain controller (if the specified domain is an Active Directory domain) or as an LDAP server (if the specified domain is an application partition).

The problem was caused by a misconfiguration of the DC's network adapter.  The upstream DNS servers were being used instead of the DC itself.  This caused meant that the various ActiveDirectory DNS entries were being sought on the ISP's DNS servers where, of course, they would not be found.

The correction was to configure the network adapter to use the DC itself for DNS and to change the DC's DNS configuration to have forwarder entries for the upstream servers.

2005-09-22

SVNSERVE Windows Service

Here are the steps for installing SVNSERVE as a Windows service:

  1. Download and install the Windows server resource kit.
  2. Run the command line:
    resource-kit-dir\instsrv.exe "Subversion" "resource-kit-dir\srvany.exe"
  3. Make registry entries like this:
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Subversion\Parameters]
    "Application"="subversion-dir\\bin\\svnserve.exe"
    "AppParameters"="-d -r repository-path"

2005-09-14

SQL Server 2005 SSIS

SQL Server 2005 introduces the "SQL Server Integration Service" (SSIS), formerly known as "Data Transformation Service" (DTS).  The new version comes with a data flow editor that is a lot like QueryJoiner.  There is not a lot of documentation available on-line at the moment, but there is a lessons-learned article.

2005-09-01

Javascript

If you write Javascript that looks like this:

function x()
{
    return
        something() + somethingElse();
}

The function will return an undefined result.  Why?  Because semicolons are optional in Javascript.  It sees the newline after the RETURN and thinks that it has found the end of the statement.  The following expression apparently is parsed as a valid statement, so the compiler doesn't complain.

2005-08-26

Firefox and NTLM

An old trick, but I'd thought I'd write it down anyway... You can configure Firefox to automatically send NTLM credentials without prompting for certain web sites by setting the about:config property network.automatic-ntlm-auth.trusted-uris to a comma-separated list of host names.

2005-08-19

MS WFetch

WFetch is a handy tool from Microsoft that can be used to troubleshoot HTTP requests, especially ones involving NTLM authentication.

2005-08-18

XML Encoding on Windows

If your XML document uses the Windows character set, you must set the encoding of the XML document to "ISO-8859-1".  Otherwise, some XML processors (like Internet Explorer) will complain about an invalid character.  A particularly common case of non-ASCII characters in an otherwise normal file occurs when the text was generated in Microsoft Word and included quote characters that had been converted into "smart quotes".

2005-07-29

Windows Script Components and DCOM

I created a sample Windows Script Component (WSC).  It also illustrates the use of DCOM.  I had a devil of a time configuring the

Windows XP server and client DCOM environments using the Component Services control panel.  It has always been hard --SP2 has made it even harder.  In the end I just turned off the firewalls (on both the client and server sides) and made the DCOM server run as the logged in user.  Obviously, those measures are only good for testing purposes.  If I'm feeling masochistic, I might try to figure out the right way to do it some day.  Right after I internalize the MS SharePoint security configuration...

2005-07-27

MS SQL Server Bug

The PATINDEX function doesn't seem to handle brackets properly.  The statement:

select patindex('%[%', 'abc[]def')

returns '0' instead of '4'.

After some experimentation, I see that brackets are being interpreted according to the usual regexp syntax.  PATINDEX is not documented to support regular expressions, so this is unexpected.  As per regexps, the following statement works:

select patindex('%[[]%', 'abc[]def')

2005-07-05

DAEMON Tools

DAEMON Tools is a handy program that allows CD ISO images to be mounted as devices.

2005-06-29

Foundstone

The Foundstone web site has a nice set of security resources, especially in the 'free tools' section.

2005-06-21

BPMN

BPMN, 'Business Process Modeling Notation', is a competitor to UML for diagramming business processes.  The BPMN group claims that UML and BPMN are complementary, the former focused on object-oriented modeling and the latter on process-oriented modeling.

2005-06-20

Firebird, Delphi, and XCore

Firebird supports three dialects of SQL.  Dialect '1' is the original Interbase SQL dialect.  Dialect '3' is a newer dialect that attempts to be closer to the ANSI standard.  Dialect '2' is used only for debugging: it throws errors for any SQL statement whose behaviour has changed between dialects '1' and '3'.  Starting with Firebird 1.5, dialect '3' is now the default.

A Firebird client must indicate which dialect it is using.  It does this using:

set sql dialect 1;

The default dialect for a new database is set to whatever dialect the client happens to be using at the instant the database is created.  So, to force a particular dialect, use:

set sql dialect 1;
create database 'c:\dir\mydb.fdb' page_size 8192 user 'me' password 'secret';

You can change the dialect of an existing database using the gfix command line tool:

gfix -sql_dialect 1 -user 'me' -password 'secret' 'c:\dir\mydb.fdb'

I haven't tried it, but supposedly you can set the SQL dialect in Delphi using:

TIBDatabase.SQLDialect = 1;

The default value is '1' in Delphi 5 and '3' in Delphi 6.

This all came up when I tried to use XModel to create a new model in an empty Firebird 1.5 database.  The error message was:

SQL error code = -817
Metadata update statement is not allowed by the current database SQL dialect 3.

WinHex

WinHex is a good computer forensics tool.  There is a free 'personal' edition..

2005-06-17

Want (Windows Ant)

There is a bug in want in that the dir attribute of the want target does not expand variables.

2005-06-14

Xbeans

I came across Xbeans, a tool used to create XML processing pipelines using Java Beans.  As it stands, the intent is that a Bean-aware IDE would be used to assemble the pipelines without coding.  They are appealing for someone to develop a standalone assembler (QueryJoiner anyone?).

2005-06-08

Tricky

Here is Gosling's tricky sort, ported from Pascal to Javascript.  Or was it from Pyxis?  I can't remember...

Firefox focus()

IE supports the focus() function on all HTML elements.  Unfortunately, Firefox does not (following the DOM spec).  Firefox does support focus() on anchors and form elements, so depending upon what you are trying to do you might be able to just introduce an anchor near where you want the focus.  Also, the select() method works on form input fields.

2005-06-07

Anonymous Web Tools

MyTrashMail provides a service where they will create an anonymous email account automatically upon receiving email -- you don't have to preregister the account.  You pick up the email at the MyTrashMail web site.

I've been using it for a year or two now, but in case I forget... www.bugmenot.com is a great place to get temporary registered user identifiers for lots of sites.

2005-06-06

Oracle

Here is an Oracle SQL statement that will return a script to convert all LONG columns into CLOBs:

select 'alter table '||table_name||' modify ('||column_name||' clob);'
from user_tab_columns
where data_type='LONG';

Doing this might invalidate some indexes, reported by a message such as:

ORA-01502: index 'SOME_SCHEMA.SOME_INDEX' or partition of
such index is in unusable state

Here is a statement that will create a script to rebuild all invalid indexes:

select 'alter index '||index_name||' rebuild;'
from user_indexes
where status<>'VALID';

2005-06-01

Oracle 9i

Under Oracle 9.2.0.1.0, the following statement fails with the nonsensical error 'ORA-00979: not a GROUP BY expression':

select (select max(dummy) from dual where dummy=a.dummy)
from dual a
, ( select dummy from dual group by dummy ) b
where a.dummy = b.dummy
and a.dummy = 'X'

Under Oracle 8.1.7.0.0, the statement works.

2005-05-26

JBoss/Tomcat Access Logging

To enable a standard web access log for Tomcat, you must uncomment the 'AccessLogValve' directive in the Tomcat server.xml file.  Under JBoss, this file is typically found at:

server\default\deploy\jbossweb-tomcat50.sar\server.xml

Note that the valve does not report the authenticated user if you are using the JCIFS NTLM filter.

JCIFS Logging

You can make JCIFS log all authentication attempts by configuring the following filter initialization parameter:

<init-param>
  <param-name>jcifs.util.loglevel</param-name>
  <param-value>3</param-value>
</init-param>

The log level must be greater than two to show logins.

2005-05-19

Running JBoss as an XP Service

I used JavaService and the following BAT file:

"%~dp0JavaService.exe" -install JBoss ^
  "%JAVA_HOME%\jre\bin\server\jvm.dll" ^
  "-Djava.class.path=%JAVA_HOME%\lib\tools.jar;%~dp0run.jar" ^
  -start org.jboss.Main ^
  -stop org.jboss.Main -method systemExit ^
  -out "%~dp0jbossservice-stdout.log" ^
  -err "%~dp0jbossservice-stderr.log" ^
  -current "%~dp0." ^
  -manual

The -out and -err switches are good for debugging, but in normal JBoss operation they simply echo the JBoss server log.  Also, they are not cleared whenever the service is started, so they grow indefinitely.

2005-05-17

Jetty Dump Servlet

A convenient on-line debugging tool for HTTP requests is the Jetty Dump Servlet:

http://jetty.mortbay.org/jetty/dump

It echoes the request, much like SnoopServlet.

2005-05-10

JBOSS

By default, JBoss uses a unified class loader model where the JARs from all archives are shared.  This is contrary to the Servlet specification which says that each application should be isolated from the others.  Fortunately, this behaviour can be turned off by changing an entry in server\default\deploy\jbossweb-tomcat50.sar\META-INF\jboss-service.xml:

 <attribute name="UseJBossWebLoader">false</attribute>

As of JBoss 4.0.2, this is the default setting.  See also:

http://www.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration

and

http://jira.jboss.com/jira/browse/JBAS-1691

2005-04-28

Oracle NLS

You can make Oracle change the character sort order using the NLSSORT function, eg:

select * from (
  select 'ab' x from dual
  union select 'Az' from dual
  union select 'Bz' from dual
  union select 'äm' from dual
  union select 'ba' from dual ) x
order by nlssort(x, 'NLS_SORT=LATIN')

will give the results:

ab
äm
Az
ba
Bz

You can obtain a list of valid sort orders by running the query:

select * from v$nls_valid_values where parameter='SORT' order by 1, 2

2005-04-21

AutoIt

I stumbled across an interesting freeware robot tool for driving Win32 applications:

http://www.autoitscript.com/

2005-04-20

Windows XP Find Bug

The 'Find Files' feature in Windows XP can never seem to find files that contain text.  The problem appears to be caused by the fact the only files with 'known extensions' are searched.  This can be overridden by setting a registry key to DWORD 1:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex\FilterFilesWithUnknownExtensions

This can also be done through the UI for the Indexing Service by setting the property 'Index files with unknown extensions'.  Note that it is not necessary to turn on the indexing service.  This is covered in detail in the KB article:

http://support.microsoft.com/?kbid=309173

MS SQL Server, invalid dates, and jTDS

We ran into a problem with the way SQL Server handles invalid dates.  If you attempt to execute a query with a date that is outside the SQL Server accept range, you get the message:

Only dates between January 1, 1753 and December 31, 9999 are accepted.

Furthermore, the server logs show messages like:

2004-08-12 15:56:47.77 spid51 Error: 17805, Severity: 20, State: 3
2004-08-12 15:56:47.77 spid51 Invalid buffer received from client.

Any finally, the server feels that the error is severe enough that it terminates the connection.  This is clearly a bug.  It is discussed in the Microsoft knowledge base article:

http://support.microsoft.com/default.aspx?scid=kb;en-us;894557

Notwithstanding the reference of the Microsoft JDBC driver in the article, this behaviour also occurs when using jTDS.  The only solution at this time is make sure that you don't send dates outside the mandated date range to the server.

This bug is particularly nasty when connection pooling is being used.  Pooled connections are rendered broken after this error occurs.  It is important to use some sort of dead connection testing

2005-02-17

Eclipse and Java Remote Debugging

To enable Java remote debugging on the Sun JVM, use the command line:

java ... -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=6666,suspend=n

In Eclipse, go to the Debug launch configuration screen and create a new "Remote Java Application" configuration that uses the address specified in the -Xrunjdwp argument.  Once you are finished debugging, click on the 'disconnect' button in the Debug view.

2005-02-11

NTFS

To create an NTFS hard link from the command line:

fsutil hardlink create new-file.txt old-file.txt

2005-02-07

Oracle Dates

Oracle seems to think that SYSDATE is some strange species of date.  If you try a statement like this:

select case when some_flag=1 then sysdate else some_date end from some_table;

Then Oracle will complain with 'ORA-00932: inconsistent datatypes'. The workaround is to use cast(sysdate as date).

2005-02-04

Oracle

Here is an Oracle SQL statement that generates a DDL script to recreate all of the existing indexes:

select
  case when c.column_position=1
    then 'CREATE'||case when I.UNIQUENESS='UNIQUE' then ' UNIQUE' else '' end
        ||' INDEX '||I.INDEX_NAME||' ON '||I.TABLE_OWNER||'.'||I.TABLE_NAME||' ('
    else '' end,
  c.column_name,
  case when c.column_position <> all(
        select max(column_position) from user_ind_columns where index_name=i.index_name )
    then ', '
    else ');' end
from user_indexes i
, user_ind_columns c
where (c.index_name=i.index_name)

Oracle Plan Tool (ASP)

I created the Oracle plan tool, an ASP page that can be used to view Oracle SQL execution plans.

2005-01-25

Oracle Plan Table

Here are SQL scripts to use the Oracle plan table:

CREATE TABLE TEMP_PLAN_TABLE (
  STATEMENT_ID VARCHAR2(30),
  TIMESTAMP DATE,
  REMARKS VARCHAR2(80),
  OPERATION VARCHAR2(30),
  OPTIONS VARCHAR2(30),
  OBJECT_NODE VARCHAR2(128),
  OBJECT_OWNER VARCHAR2(30),
  OBJECT_NAME VARCHAR2(30),
  OBJECT_INSTANCE NUMBER(38),
  OBJECT_TYPE VARCHAR2(30),
  OPTIMIZER VARCHAR2(255),
  SEARCH_COLUMNS NUMBER,
  ID NUMBER(38),
  PARENT_ID NUMBER(38),
  POSITION NUMBER(38),
  COST NUMBER(38),
  CARDINALITY NUMBER(38),
  BYTES NUMBER(38),
  OTHER_TAG VARCHAR2(255),
  PARTITION_START VARCHAR2(255),
  PARTITION_STOP VARCHAR2(255),
  PARTITION_ID NUMBER(38),
  OTHER LONG,
  DISTRIBUTION VARCHAR2(30)
);

DELETE FROM TEMP_PLAN_TABLE;
EXPLAIN PLAN INTO TEMP_PLAN_TABLE FOR
SELECT * FROM DUAL
;

SELECT LPAD(' ', level-1) || operation || ' (' || options || ')' "Operation"
, object_owner||'.'||object_name||
  (SELECT ' (on '||TABLE_OWNER||'.'||TABLE_NAME||')'
   FROM ALL_INDEXES
   WHERE OWNER=TPT.OBJECT_OWNER
   AND INDEX_NAME=TPT.OBJECT_NAME
   AND TPT.OPERATION='INDEX' ) "Object"
FROM TEMP_PLAN_TABLE TPT
START WITH ID = 0
CONNECT BY PRIOR ID=PARENT_ID

DROP TABLE TEMP_PLAN_TABLE;

2005-01-14

Hibernate

Here are some general Hibernate gotchas:

  • Property names that begin or end with an underscore give Hibernate grief.  It issues error messages that it cannot find properties that exist.  In the case I was trying, the identifiers were all caps (other than the underscores).  Perhaps it works for identifiers in normal Java case?
  • When trying to use Oracle LONG columns, Hibernate would issue the error message 'Stream has already been closed' when trying to materialize the containing objects.  This only occurs when the containing objects have container relationships to other objects.  This error usually occurs in JDBC when ResultSet columns are not read in left-to-right order and an attempt is made to backtrack to a LONG column.  An inspection of the Hibernate code suggests that this is a possibility.  The Hibernate forums contain references to this problem, but no-one has posted a solution.  I tried changing the mapping so that a LONG property appears:
    • as the last property for a class -- no effect.
    • in a new class mapped as a self-join to the table, with a one-to-one relationship to the original class -- this worked, but further testing is needed to verify that it works in all scenarios.  Also, this mapping does not work for updates since Hibernate will think that a new row needs to be created.
    • in a new component class -- no effect.

2005-01-04

JScript

JScript has no direct way of creating Variant arrays (aka SafeArrays or VBArrays).  However, here is a hack to create one:

function makeVBArray(elements)
{
    var dictionary = new ActiveXObject("Scripting.Dictionary");
    for (var i = 0; i < elements.length; ++i) {
        dictionary.add(elements[i], "");
    }
    return dictionary.Keys();
}

ADSI

I came across the Variant array problem while using an ADSI collection.  The Filter property only worked when set to a variant array -- JScript array object did not work.

I wrote a script, cycle-password.js, that repeatedly changes your password until it overflows the NT password history.  This is useful to avoid an administrative policy that forces you to change your password every so often (which is less secure than a good password).

Blog Archive