Life of a java disciple




J2EE Blogs:

J2ME Blogs:

.NET Blogs:

Important Links:

International Users:


















This page is powered by Blogger. Isn't yours?
Monday, March 31, 2003
 

SUN: Free J2EE classes starts again on April 16th


Sun's J2EE Programming (with Passion!) Course starts again on April 16th. This is very much like a regular college course in which the students have to do weekly homework and final project after studying the presenation material but it is free and can be taken online.

If you are an entry level J2EE programmer, this is a must course.




 

Eclipse: Mirror for faster downloads here


With Taiwan mirror for eclipse download seems pretty fast. I could download 2.1 in less than 30 mins.


Thursday, March 20, 2003
 

Security: A Security Shorthand from SUN


The Future of Web Services Security from sun gave dictionary of security aspects. Here is simplified form of the same:

TermProtective GoalsMatching Security Technologies
ConfidentialityCan prying eyes see it?Key-based digital encryption and decryption.
AuthenticationAre you who you say you are?Username/password, key-based digital signing and signature verification, challenge-response, biometrics, smart cards, etc.
TrustHave I agreed to work with you?Key-based digital signing and signature verification.
Non-repudiationCan you claim that you didn't send or receive it even if you did? Key-based digital signing and signature verification, message reliability.
IntegrityWas it altered before I got it?Message Digest, itself authenticated with a digital signature.
AuthorizationAre you allowed to have it?Application of policy, access control, digital rights management.
AuditingCan I prove what happened?Various forms of logging, themselves secured to avoid tampering.






Tuesday, March 18, 2003
 

Weblogic:8.1 Supports getting vendor JDBC connection


Never understood why BEA wouldn't support this feature. This is a critical feature for many applications like the one's that use Oracle Spatial Extensions. Here is the docs for the same.


 

Weblogic: 6.1SP4 Supports Console Extensions


Never seen any docs related to this but weblogic6.1sp4 supports console extensions. Follow the instructions as per 7.0 docs. But here is the trick though, your java class that extends weblogic.management.console.extensibility.Extension should not implement weblogic.management.console.extensibility.NavTreeExtension. Note that NavTreeExtension exists in 7.0 but not in 6.1sp4.


Thursday, March 13, 2003
 

M$ can't host .NET based sites


A very interesting read. If it takes M$ so long to be able to host .NET based sites how long would it take for you?


Tuesday, March 11, 2003
 

J2SE: 1.3.1 GC References


1. Tuning 1.3.1 GC.
2. Big Heaps and Intimate Shared Memory.


 

J2SE: 1.4.1 GC Analyzer


Got GC Analyzer for J2SE1.4.1 working. The script downloaded has illegal line seperators that prevents it from working. Pretty cool script.
Since this scripts writes to STDERR, when using this script redirect STDERR to a file to see proper output.


Monday, March 10, 2003
 

Eclipse: 2.1RC2 released


Eclipse 2.1RC2 is released. Here are the list of defect fixes that made it to RC2.


Friday, March 07, 2003
 

J2SE: 1.4.1 boosts garbage collection


A pretty good article on 1.4.1 GC from JavaWorld.

Other 1.4.1 GC Tutorials:
1. From java.sun.com.
2. From Wireless Java. Note that this replaces the famous GC Article for 1.2.2
3. From JavaPerformanceTuning.

Some Benchmarks:
1. From JavaLobby.
2. From NetBeans.


Wednesday, March 05, 2003
 

JSF: EA3 Released


JavaServer Faces Early Access 3 has been posted at java.sun.com. Tutorial for JSF is available here.


 

Weblogic: Starting ManagedServer Programmatically


Weblogic6.1 Node Manager do *not* attempt to restart a Managed Server when its goes down or provide a mechanism where user can use some compand line tool to start the managed server using Node Manager. The following is the example code to start a managed server using nodemanager programmatically. This code when used in combination with script that detects when a server goes down (Example: SNMP management tools which get a trap when managed server goes down), will automate server restart when a problem occurs.

Tested with weblogic6.1SP4.

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;

import weblogic.management.MBeanHome;
import weblogic.management.configuration.ServerMBean;

/**
* This tools starts a managed server when node manager corresponding
* to that server is already running.
* Usage : StartManagedServer -adminurl <> -user <> -pass <> -domain <> -managedserver <>
*/

public class StartManagedServer {

public static void main(String[] args) {

ServerMBean serverMBean = null;

String url = "t3://localhost:7001";
String username = "system";
String password = "password";
String domain = "yourdomain";
String managedServer = "Server1";

int i = 0;

try {

for (; i < args.length; i++) {

if (args[i].equals("-adminurl"))
url = args[++i];

else if (args[i].equals("-user"))
username = args[++i];

else if (args[i].equals("-pass"))
password = args[++i];

else if (args[i].equals("-domain"))
domain = args[++i];

else if (args[i].equals("-managedserver"))
managedServer = args[++i];
}
} catch (ArrayIndexOutOfBoundsException aio) {
log("Missing value for arguement '" + args[--i] + "'");
log("Usage : StartManagedServer -adminurl <> -user <> -pass <> -domain <> -managedserver <>");
return;
}

try {

Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
props.put(Context.PROVIDER_URL, url);
props.put(Context.SECURITY_PRINCIPAL, username);
props.put(Context.SECURITY_CREDENTIALS, password);
Context ctx = new InitialContext(props);

MBeanHome home = (MBeanHome) ctx.lookup("weblogic.management.adminhome");
serverMBean = (ServerMBean) home.getMBean(managedServer, "Server", domain);

} catch (Exception e) {
log("Exception in getting Admin home & serverMBean: " + e);
}

try {
log("Sending a start command to the AdminServer ...");
serverMBean.start();
} catch (weblogic.rmi.extensions.RemoteRuntimeException rre) {
//The java.io.Reader returned which is not serializable :-)
log("Ignorable Exception occured ...");
} catch (Exception e) {
//InsufficientConfigurationException?? Couldn't find JavaDocs for exception
//mentioned in javadocs.:-)
log("Unexpected exception: " + e);
return;
}

log("NodeManager initiated the server");

}
private static void log(String s) {
System.out.println(s);
}
}



Starting weblogic7 Node Manager attempts to restart a Managed Server whose health state is "failed".



Monday, March 03, 2003
 

General: Redirecting Std err


Most Java Programmers I know are unaware of how to redirect Stderr to a file. Here is a 1 minute tutorial on the same. For both Unix and Windows:

When writing shell scripts, you can control input/output redirection. Input redirection is the ability to force a command to read any necessary input from a file instead of from the keyboard. Output redirection is the ability to send the output from a command into a file or pipe instead of to the screen.
Each process created by a shell script begins with three file descriptors associated with it:
0 stdin
1 stdout
2 stderr


You can use the file descriptor numbers 0 (standard input), 1 (standard output), and 2 (standard error) together with the redirection metacharacters to control input and output in the Bourne and Korn shells.

Bourne and Korn Shell Redirection
DescriptionCommand
Take STDIN from file<file, or 0<file
Redirect STDOUT to file> file, or 1>file
Redirect STDERR to file2> file
Append STDOUT to end of file>> file
Redirect STDERR to STDOUT2>&1
Pipe standard output of cmd1 as standard input to cmd2cmd1 | cmd2
Use file as both STDIN and STDOUT<> file
Close STDIN<&-
Close STDOUT>&-
Close STDERR2>&-

When redirecting STDIN and STDOUT in the Bourne and Korn shells, you can omit the file descriptors 0 and 1 from the redirection symbols. You must always use the file descriptor 2 with the redirection symbol.


The 0 and 1 file descriptors are implied, and not used explicitly for the C shell. The C shell representation for standard error (2) is an ampersand (&). STDERR can only be redirected when redirecting STDOUT.

C Shell Redirection Metacharacters
DescriptionCommand
Redirect STDOUT to file> file
Take input from file< file
Append STDOUT to end of file>> file
Redirect STDOUT and STDERR to file>& file
Append STDOUT and STDERR to file>>& file


For windows:
The command shell provides facilities to change the default stream input and output. These facilities are accessed by placing special command redirection symbols in a command.
Windows Command Redirection Symbols
Symbol
Description
>file

Redirects command output to the file specified. You can also use a standard device name such as LPT1, CON, PRN or CONOUT$ as the file name. Any preexisting contents of the file are lost.

>>file

Redirects command output to the file specified. If the file already exists, all command output is appended to the end of the file.

<file

Redirects command input from the file specified. You can also use a standard device name such as CON or CONIN$.

2>file

Redirects command error output to the file specified. You can also use a standard device name such as LPT1, CON, PRN or CONOUT$ as the file name. Any preexisting contents of the file are lost.

2>&1

Redirects command error output to the same location as command output. This makes any command output redirection also apply to command error output.

cmd1 | cmd2

Pipes the command output of cmd1 to the command input of cmd2. Multiple pipe characters are allowed, creating a chain of commands, each sending output to the next command in the chain.




Saturday, March 01, 2003
 

J2SE: 1.4.1_02 available


Download for J2se1.4.1_02 is available for download. Release Notes here

Also noticed that Oracle has changed the way JDBC drivers are named. An excerpt from What Is New In This Release Since 9.2.0.1:

New classes file name for JDK 1.4 and beyond Beginning with this release the classes files for JDK 1.4 and beyond will be named ojdbc<jdk ver>.jar. So, the classes file for JDK 1.4 is named ojdbc14.jar. The names for the JDK 1.1 and 1.2 classes files will not be changed. We will not provide .zip versions of the classes files beyond JDK 1.2.