Pages

Wednesday, February 2, 2011

JNDI Datasource Names in WPF Designer

A common problem when working with data sources configured in the application server and the sql call builder is tying the two together. The builder provides a dropdown list of JNDI names that it thinks are
defined, but sometimes the name that you're looking for isn't there.


Ensure that your project is deployed

A typical scenario is starting a new project which contains a service provider model that retrieves data from a data source. You figure you've done this before so you know what you're doing, but somehow the JNDI name just isn't there.

Here's the problem - the designer needs to communicate with the server to retrieve the list of JNDI names, and it does this by issuing an http call to a model on the server from within the eclipse tool. So if the project hasn't been deployed or the server is not running, then the names cannot be retrieved.


Digging deeper

So you're sure that the project has been deployed and the server is running because you successfully executed another model in your project, but still no JNDI name. Here's where we can open up the hood and take a look at what's really going on. Navigate to \WebContent\WEB-INF\models\factory\core\db_utils.model, don't look for it in the \model folder because it's been hidden from view by the designer. Open the model and find a method builder called getDataSourceNames:


The coordinator for the sql call builder attempts to invoke this model at design time to retrieve the JNDI names, so any debugging is easily pinpointed here. It appears that the developers of WPF were kind enough to add some debugging logic in their code, try changing the debug value to true and watch for output in the server's system out log.
Please note that generic comments containing links with the intent of self promotion will be flagged as spam and deleted.

2 comments:

  1. seems in WEF7 this is different : there's an LJO com.bowstreet.builders.webapp.methods.SqlMetaDataUtil called from a method, but no way to set a debug property

    ReplyDelete
  2. Peter - you're right, looks like they've made some changes. But it appears that the code from the method builder has been moved into a proper java class then used as an LJO. I think it may be possible to subclass and override the method...

    ReplyDelete

Are you about to post a generic comment that has nothing to do with this post? Something like "Hey thanks for this very valuable information, BTW here's my website". If so, it will be marked as spam and deleted within 24 hours.

Note: Only a member of this blog may post a comment.