Wednesday, January 16, 2008

Axis2 Container Error: Processing Operations Modules ClassNotFoundException Error in loading message receiver

Error:
org.apache.axis2.deployment.DeploymentException: ClassNotFoundException Error in l
oading message receiver tier.ws.migration.axis2.MLBUserWSInOutMessageReceiver; nested exception is:
java.lang.ClassNotFoundException: tier.ws.migration.axis2.MLBUserWSInOutMessageRec
eiver at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:
329)

Cause:
You are attempting to use a service compiled in JDK 1.5 in a Axis2 container running under JDK 1.4.

Solution:
Compile the service using JDK 1.4

References:
http://www.mail-archive.com/axis-user@ws.apache.org/msg21397.html
http://issues.apache.org/jira/browse/AXIS2-1670

Monday, January 14, 2008

Decompressing a tgz file

gzcat (file.tgz) | tar xvf -

or

tar -x
zvf (file.tgz)

Wednesday, December 19, 2007

Sun Java System Web Server 6.1 - Proxying

We are currently inquiring about the use of directives as a way to proxy requests from one url to another server. Proxies can be used for different use cases. For one, if you would like to simply redirect requests from a legacy web service to a new web service, you could want to use proxies.

There are three options available to proxy requests. Each provide a partial solution for proxying but none provide a full one. They are listed below in order of complexity.

A) Using the NameTrans 'redirect' directive.

The documentation indicates that this directive can redirect URLs coming into the web server to another web server at a particular path. It is configured in the following way:

Steps:
1) Make a copy of the obj.conf in the same folder and rename the file as desired. This file will contain the NameTrans directive to redirect the requests.
2) Add the following directive to the new copy of the obj.conf before the NameTrans ntrans-j2ee directive, like below:

<Object name="default">
AuthTrans fn="match-browser" browser="*MSIE*" ssl-unclean-shutdown="true"
NameTrans fn=redirect from=/ws/services/ url=http://dev-a.services.bamnetworks.com:52070/ws/services/
NameTrans fn="ntrans-j2ee" name="j2ee"
...

3) Configure a new virtual server class (VSCLASS) in server.xml.
4) Configure the new virutal server class to use the new obj.conf like below:

<VSCLASS id="vsclass2" objectfile="obj2.conf" >

5) Add the web application instance on which requests will be proxied under this virtual server class.

Disadvantages:
1) Redirect Response code: This directive actually will return a response code of 301 Permanently Moved back to the client requesting the server. The client is responsible for automatically redirecting to the new URL. This is however not default behavior of web service clients, but is for web browsers.

Note: We tried to use this solution for redirecting our web service clients but the generated client does not automatically redirect to the new URL given this HTTP response code.

2) Cross-browser issues: This directive does not solve cross-browser issues either. Although the browser will redirect automatically to a web service, it will not be able to accept incoming data from a domain different from the domain of the current page making the HTTP requests.

B) Using the Reverse Proxy Plug-in.

Monday, December 10, 2007

Actionscript Arrays displayed as objects using typeof operator

The typeof operator applied to an Array object does not display as "array". It still displays as "object".

Monday, December 3, 2007

How to Retrieve FlashVars Data in ActionScript 3.0

You would like to retrieve variables from the embed Flash object as in the following example:

root.loaderInfo.parameters

References: How to Retrieve FlashVars Data in ActionScript 3.0

Thursday, November 15, 2007

Struts Error Message - ???en.ProfileProperty.error.message???

error
???en.ProfileProperty.error.message???

environment
You have a Struts web application. The error messages are configured through the applicationResoources.properties file. Whenever these properties file is changed, the error messages may now be configured differently and will result in the above unrecognizable error message. This seems to be happening in only this particular error message. Other messages are working correctly.

possible causes:
The following Struts configuration files may be related to the misconfiguration:

struts-config.xml
applicationResources.xml

solution
You may either include dom.jar or xml-apis.jar in your classpath.

Friday, October 26, 2007

Flash verus Java: Differences

As a Java developer, moving to Flash should not be too difficult of a task. Actionscript 3.0 contains many features of the Java language, but also has tremendous amount of other features related to animations that Java does not have. It is these latter features that will require a slower learning curve for a Java developer. Here are couple of important similarities and differences that I have encountered related to the design, structure and syntax of the Actionscript language as I was reading a book. These differences are more oriented toward a Java developer moving to Actionscript as opposed to a Flash developer moving to Java.


Conceptual Differences

1. Variable declaration

Variables in Actionscript do not have a type, as opposed to Java where all variables must be assigned a type. Although one could stipulate that assigning a Java variable as a java.lang.Object could simulate an untyped Actionscript variable, the same can be done to an Actionscript variable. Although, the variable of a type Object is still a typed variable. The difference lies in the fact that an untyped Actionscript variable can be assigned a primitive data type value or an Object type, where in Java it would not be possible for a single variable to be assigned both a primitive data type and an Object at the same time.

2. Function declaration

Despite the syntactical differences, there are also two conceptual differences in function/method declarations between Actionscript and Java.

(1) The first difference is that functions do not need to declare a return type. This is to support older versions of Actionscript.

(2) The second is that functions can declare initial values for its parameters in Actionscript. Initialized parameters of a function are not required to be passed to the function, while uninitialized parameters of a function are required to be passed. Whether they will cause compile errors is something i do not yet know.

3. Function passed as value


One of the more powerful features in Actionscript is the ability to assign a variable to a reference to a function. This is quite a powerful feature in Actionscript and perhaps provides a short cut for coding.

This feature is actually used for event handling and animation, the forte of Actionscript.

4. Nested Functions

Functions can be declared within another function.

5. Package-level, Source-File-Level, And Global Functions

One can create functions within a package (package-level). Package-level functions are accessible only within the package.

Source-file-level functions are rarely used because they can be replaced with private static functions within a package.

Global functions are defined in the unnamed package and are accessible by any class or package without an import.

All these are not concepts within Java. In Java, all functions are always associated with a class.

6. Protected and default access-control modifiers.

The protected and default access modifiers of Actionscript and Java have different definitions. The protected modifier in Java allows classes within the same package and any subclasses to access the class or variable on which the protected modifier has been declared, while in Actionscript, the protected modifier allows only subclasses to access the class or variable. Therefore, the Actionscript modifier is more restrictive, but in my opinion, makes more sense.

The default modifier in Java, which is designated with no keyword but aka package-private, only allows classes within the same package to access the class or variable, while, in Actionscript, the default or internal modifier allows classes within the same package and subclasses to access the class or variable. Essentially, the internal modifier has the same access control as in Java's protected modifier.

8. Overloading Methods in Subclasses

9. No Abstract Classes

10. Reflection replaced with built-in operators.

11. Arrays are different in Actionscript.

Arrays in Actionscript are not associated with a particular class or type as in Java. So, there is only one array type in Actionscript as opposed to Java where there can be an infinite number of array types according to the type the array has been declared with. This single array type in Actionscript is used to hold all types within the same array.

The array in Actionscript is also dynamically sized and therefore will never throw an error if the initial capacity of the array has been exceeded when attempting to add new elements beyond the size of the array. In Java, an array is always initialized with an initial capacity and cannot be changed after instantiation. Instead, the ArrayList can be used in place of the fixed-sized array.

Unlike the Java array, the Actionscript array has methods used for modifying its contents. Both array types allow you to directly modify its contents using the bracket notation. However, the Actionscript array defines modification methods, listed in the following: push, unshift, splice, shift, pop, concat, delete. This allows the array to be used as a stack.

One other trivial but nice feature of the Actionscript array is that it prints out as a comma-delimited list of element values. No more weird string representations of arrays! (Athough in Java 1.5, there is a new method that prints out Arrays nicely, Arrays.toString()).

12. Dynamic Actionscript

An entirely different concept in Actionscript is the ability to dynamically create or add new instance variables and methods to classes or dynamically create new classes. There is no analogous concept in Java.

Only Actionscript classes that have been defined as

13. Actionscript Lookup Tables versus Java Collections Map

The Java Collections framework has revolutionalized the way Java developers use data structures in their programs. The lead designer of the Collections Framework, Joshua Bloch, who also wrote a highly acclaimed and one of the most useful Java programming books, called Effective Java, is a prominent Java architect among the Java community. His framework has won an award for Best Java Class Library.

One of the collection classes in the framework is a Map. There is not equivalent class in Actionscript. Instead, the ability to dynamically add instance variables to a dynamic object replaces the Map concept.

Feature Differences

1. Setter / Getter functions



2. Constants and the final modifier for instance variables.

3. The switch statement is more powerful in Actionscript.

The Java switch statement only allows the primitive data types to used as values in the switch statement. One of the complaints in Java is that you cannot use Strings or perhaps Objects within the switch statement. Fortunately, in Actionscript, you can! However, there is fine print related with this feature. In a switch statement, it uses a strict equality operator on determining equality of the switch values.

4. Actionscript has additional operators that Java does not have. Some are quite powerful.

Some of these additional operators include those that backwards-compatible for older versions of Actionscript. These will not be included here as they should not be used in new code.

5. Actionscript has built-in XML operators.


Syntactical Differences

1. Constructors

2. Overriding methods

3. void vs. null

Conceptual Similarities

1. Object-oriented programming

Actionscript 3.0 contains interfaces, classes, instance methods, static methods, instance variables, static variables.