Sunday, April 27, 2008

starting Struts2

Compared with Struts1, Struts2 seems a little bit simplied regarding configuration files. However, there's something that needs our attention, which is the location of the struts.xml file.
This file should reside in the WEB-INF/classes directory instead of the WEB-INF directory.
It could also be put into a jar file in WEB-INF/lib directory.

Thursday, April 17, 2008

CheatSheet: Installing and Configuring Oracle 10g Database with WebSphere Message Broker (Windows Platform)

By default, webSphere Message Broker uses Derby or DB2 as the broker database; and how to configure Oracle database is not very clear in the documentation. In this cheatsheet, the step-by-step instruction will be given.

1. Create an Oracle table space (TS_WSBKR).
2. Create an Oracle user (WSBKR), and grant unlimited usage on TS_WSBKR to the user.
3. Grant database previlege to the broker database user:
GRANT CREATE SESSION TO WSBKR;
GRANT CREATE TABLE TO WSBKR;

4. Define a DSN for ODBC Connection
4.1 Go to "System DSN" definition tab though "ODBC data source administrator" in windows administrative tools or Oracle menu.
4.2 Create a new datasource using driver:
MQSeries DataDirect Technologies 5.00 32-BIT Sybase Wire Protocol
4.3 Enter the DSN name (DSN_WSBKR), description, and server name (in this case, use orcl, which is a sample Oracle instance), and use 10g client.
4.4 (Optional) In the Advanced tab, Select Enable SQLDescribeParam. Select Procedure Returns Results, which results in the Windows registry a string value called ProcedureRetResults with the value 1 being created.
4.5 Test the connection using WSBKR account and click "OK" button to create the DSN.
4.6 Start Windows regedit, and locate the following value:
HKEY_LOCAL_MACHINE
SOFTWARE
ODBC
ODBC.INI
DSN_WSBKR

Add a String value to the key DSN_WSBKR, which is called "WorkArounds" with the value 536870912.
5. Create an MQ queue manager for the broker (WSBKR_QM).
6. Create a broker to populate the database. When you create a broker, if the WebSphere MQ queue manager does not already exist, the queue manager is automatically created. The broker database must already exist but the tables in which the broker stores its internal data are created automatically when the first broker to use that database is created. Subsequent brokers that you create specifying the same database and database user ID share these tables. An example is like this: C:\Program Files\IBM\MQSI\6.1>mqsicreatebroker WSMSGBROKER -i yelei -a pppassword -q WSBKR_QM -n DSN_WSBKR -u WSBKR -p pppassword.

Note the default broker creation wizard provided by websphere message broker toolkit only creates broker database. In order to store business data, user database should also be created.

Wednesday, April 16, 2008

resolving problem when starting oracle control console

When installing oracle 10g, oracle console cannot be configured and started properly on a multi-network adapter machine. Even after disabling some network adapters, using static IP address, reconfiguring listener properties, it still doesn't work.
The error looks like this:
Refer to the log file at
D:\Programs\oracle\product\10.2.0\db\cfgtoollogs\emca\orcl\emca_2008-04-16_04-18-02-PM.log
for more details.Apr 16, 2008 4:18:28 PM oracle.sysman.emcp.EMConfig
performCONFIG: Stack Trace: oracle.sysman.emcp.exception.EMConfigException:
Error creating the repository at
oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:194) at
oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:124) at
oracle.sysman.emcp.EMConfig.perform(EMConfig.java:142) at
oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:479) at
oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1123) at
oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:463) at
oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:412)

Then the following commands in %ORACLE_HOME%/bin might help resolve the problem:
Stop you dbconsole service.
emctl status dbconsole
emctl stop dbconsole

Now start the Oracle EM dbconsole Build Script
emca -repos (re)create
emca -config dbcontrol db

Using Derby database with WebSphere Message Broker 6.1

WebSphere provides built-in commands for the usage of the embedded Derby database.
mqsicreatedb can be used to create database.
The first time a Derby database is created, a Windows service called IBM® MQSeries® Broker DatabaseInstanceMgr6 is created and started. This service is required in order to access Derby databases. This service can be started or stopped by the mqsistart and mqsistop commands, and automatically starts when Windows is started, if necessary. The service is deleted when the last Derby database is deleted. At most one Database Instance manager Windows service exists, even if you install WebSphere® Message Broker more than once on your Windows computer (multiple installed instances).
The database commands affect all the databases created in any installed instance on your Windows computer, regardless of the instance under which they are created. For example, the mqsilist DatabaseInstanceMgr6 command lists all the databases that have been created using the mqsicreatedb command on this Windows computer. Use the mqsichangedbimgr command to change the user name and password under which the Database Instance manager Windows service is run. Run this command only if passwords change or if user names are updated after the initial installation and configuration. For more information, see Using Derby databases on Windows.

Monday, April 14, 2008

resolving Maven download error

"mvn archetype:create ..." is almost the first command for everybody to run when starting to use Maven. Sometimes the following problem will be shown in the console:
...
[INFO] Repository 'central' will be blacklisted
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
...


This problem is usually related to the network settings of the local machine.
By adding a settings.xml file in the repository directory, it can resolve the repository downloading issue, and you'll be able to use Maven properly.
The instructions for settings.xml (to setup the proxy) is available in http://maven.apache.org/guides/mini/guide-proxies.html .