Tuesday, November 27, 2007

IE Auto completion and javascript events for 'text' input.

When auto completion feature is turned on for Forms in IE, it sends a 'property change' event when a text input is auto completed while it sends a 'change' event when a user types in a value.

Listen for both 'propert change' and 'change' on a 'text' input if your form behaves depending on the value entered either manually or by browser's auto completion feature.

OC4J Start up problem - DMS NounType Iterator

OC4J fails to start up by throwing this error when an ias-instance 'id' and 'name' are changed in opmn/conf/opmn.xml.

An unknown OPMN error has occured.
DMS NounType Iterator.

Change 'IASname' under section '[InstallData]' in $ORACLE_HOME/config/ias.properties to be in sync with ias-instance attributes in opmn.xml

Tuesday, July 24, 2007

OC4J Fails to come up after restart - Win 2005

Problem:
OC4J succeeds only when installed first time, but fails with the following error message in opmn.log after a restart.

Stack trace:

-------- Start process--------
Error initializing server: Unable to initialize transport managers: java.net.UnknownHostException: localhost: localhost
OC4J startup failed
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invokeDelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at oracle.classloader.util.MainClass.invoke(MainClass.java:94)
at oracle.oc4j.loader.boot.BootStrap.main(BootStrap.java:30)

Caused by: java.lang.NullPointerException
at oracle.oc4j.admin.management.mbeans.J2EEServer.notifyServerReady(J2EEServer.java:1864)
at com.evermind.server.ApplicationServer.launchCommandline(ApplicationServer.java:654)
at com.evermind.server.OC4JServer.launchOC4JCommandline(OC4JServer.java:202)
at com.evermind.server.OC4JServer.main(OC4JServer.java:399) ... 6 more


Resolution:
OC4J's javaw.exe is looking for the following dlls under"C:/Documents and Settings/${user}/Windows/System32" directory instead of"C:/Windows/System32" directory.


Copy the following from C:/Windows/System32 to the above user specific directory to fix this issue.

- mswsock.dll
- winrnr.dll
- wshtcpip.dll

OC4J Fails to Deploy Applications on Windows 2005 Server

Application deployment console(em) spins its wheel but fails to complete deployment.

Resolution:
This happens because of missing temp directory.
Check ias-instance/environment/variable@value in opmn/conf/opmn.xml for id="TMP".
If this directory does not exist on the server, then the console fails to complete,but does not error out while deploying an application.

A more descriptive message can be seen while deploying from command line.

Tuesday, June 5, 2007

Importing a CVS module into myEclipse Web Project

This may sound very easy, but it is not so if your directory structure
in CVS looks like the following and you want to mirror the same in your
IDE's package explorer.

webappname
...
webappname/WEB-INF/web.xml
webappname/WEB-INF/build.xml
...
webappname/WEB-INF/src - Java source files
webappname/WEB-INF/src/...
...
webappname/WEB-INF/classes - output directory for class files.
...


Without manually changing myEclipse project meta files, it is not quite
easy to get it right. Here are the steps that would help you save a lot
of time without manual modifications.


- Create a regular web project in myEclipse and give it a name, say "myproject".

- The important step is giving names for the folders in this window.
# "Source folder" - src, by default, do not change it.
# "Web root folder" - webappname, in other words, CVS module name
# "Context root URL" - webappname, in other words, CVS module name

- Finish creating the application

- When the application shows up on "Package Explorer" (left pane), right click
on webappname folder to delete it - This step is required to overwrite default
web.xml created by myEclipse under WEB-INF directory.

- Right click on the project name "myproject" to select "import" to configure
CVS repository location to check out your code.

- Now right click on "myproject" to open properties window.

- Select "Java build Path" on the left pane, and then select "Source" tab on the
right pane.

- Select the current source folder "src" to remove it.

- Click on "Add folder" button to traverse CVS module to choose
"webappname/WEB-INF/src" as the source directory.

- After choosing source folder, check the bottom of the current window to make
sure the output directory is "myproject/webappname/WEB-INF/classes.

Tuesday, May 1, 2007

Sighting design patterns(G4) in Java SE/EE

    This is a work in progress ...
      Structural Patterns
    • Decorator - Servlet and Http Servlet request/response wrapper classes
    • Proxy - Dynamic proxy - java.lang.reflect.Proxy
      Behavioral Patterns
    • Chain of Responsibility - Servlet filters

    • Iterator - Collection iterators

      Thursday, April 26, 2007

      Vim syntax highlighting for log files

      If you are a "vim" user and looking for a quick way to do"syntax highlighting" for log files, created using "log4j", try this. The following was used in Vim 7.0.

      Just make sure the log priority level("%p") is present in the log output.

      # ~/.vim/filetype.vim should have at least the following.

      if exists("did_load_filetypes")
      finish
      endif

      augroup filetypedetect
      " log files such as catalina.out or log4j files.
      au! BufRead,BufNewFile catalina.out,*.out,*.out.*,*.log,*.log.* setf log
      augroup END

      # ~/.vim/syntax/log.vim - create this file

      " Vim syntax file
      " file type: log files
      " Quit when a (custom) syntax file was already loaded
      if exists("b:current_syntax")
      finish
      endif
      syn match fatal ".* FATAL .*"
      syn match fatal "^FATAL: .*"
      syn match error ".* ERROR .*"
      syn match error "^ERROR: .*"
      syn match warn ".* WARN .*"
      syn match warn "^WARN: .*"
      syn match info ".* INFO .*"
      syn match info "^INFO: .*"
      syn match debug ".* DEBUG .*"
      syn match debug "^DEBUG: .*"

      syn match error "^java.*Exception.*"
      syn match error "^java.*Error.*"
      syn match error "^\tat .*"

      " Highlight colors for log levels.
      hi fatal ctermfg=Red ctermbg=Black
      hi error ctermfg=Red ctermbg=Black
      hi warn ctermfg=Yellow ctermbg=Black
      hi info ctermfg=Green ctermbg=Black
      hi debug ctermfg=Gray ctermbg=Black

      let b:current_syntax = "log"

      " vim: ts=2 sw=2