Siva Masilamani

Ranch Hand
+ Follow
since Sep 19, 2008
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Siva Masilamani

Thanks for your input but I was able to prove that this is not threadsafe (atleast in this case) by adding Thread.sleep(200) in the Facotry method and I see that thread started getting wrong object.

I am trying to understand if I should synchronize the below factory method.I tested the code with three sample thread and I am always getting the correct object for each thread(meaning Thread 1 always shows TYPE1,thread2 always show TYPE2 and thread3 always shows TYPE3 but I am still thinking that this may not be the case always unless I synchronize the factory method else it will not be thread safe meaning thread 1 could get type 2 or type 3 also.

Also another option is moving the static field b inside method so that it will be a local variable.

Please correct me If am wrong.

Thanks in advance.

Factory Class:

Thanks Dieter..Exactly what I was looking for.

Tested the same with sample application.

Appreciate your help.
I think I did not post my question properly.

We are using EJB 3.1 which has been exposed as Webserice and this webservice will be consumed by the application outside of our company.

The same EJB can be used by our other part of our applications like another EJB//Servlet running under the same JVM but in different ear or war file.

My question here is can I inject this EJB into another EJB/Servlet or should I call them using Webserice?

Hope my question is clear to you.


I am trying to understand how browser loads and display the pages and as per research below are my finding and questions.

What I learnt:

Browser tokenize the content and send it to the parser.

Parser creates the document tree by reading the input sent by the tokenizer and it blocks the parsing if it has to download the Javascript and execute the script and then continue parsing.


If my javascript contains document.write(),Can I safely assume that before browser starts parsing the page,it will create the document object as I am wondering how the document is available before even the DOM is constructed?

Thanks in advance.

This is what I did .Currently the application code is compiled using the JDK 4 provided by Weblogic server.

Below are the step I did to run the WAS on JDK 7

Installed the Developer Edition WAS 8.5

Created the profile and ran the managesdk command to make JDK 7 as the defaule JDK for all the profiles.(I can also verify that the cmdDefaultProperties which shows JDK 7 as the JVM)

Used ws_ant.bat as the ant tool for building my application.( this is where it is showing the java version as 1.5 instead of 1.7)

Our build scripts is below where we set JAVA_HOME which points to the JDK 7 dir in the WAS_ROOT dir

As a matter of fact, I put echo %JAVA_HOME% on ws_ant.bat before they call the Ant main class and I can see that the JDK version is 7 but some how when the Ant class is running it is picking JDK5

Let me know if you need any more details.
10 years ago

We are migrating our application from Weblogic to WAS 8.5 JDK 7 64 bit and Im trying to modify the build script written in ant for our application.

We ran all the respective command to set JDK 7 as as default JDK for the profiles etc.But however when I run the build using ws_ant command,I see that the java version is 1.5 and I have set JAVA_HOME to IBM JDK 7 path but to no avail the command still uses Java 1.5 .

Can somebody help me to understand how to set up ws_ant so that it uses JDK 7?

10 years ago

I have a requirement to use EJB 3.1 where only some of its methods will be exposed as webservices and will be consumed by our external client applications where as other components of our application(Servlet etc) should have access to all of its method. At this point,Im not even sure if it is possible with single EJB to achieve both.

E.g. If EJB has 3 method,the external client will be exposed to 1 or 2 method where as the other component of the application should have access to all of the EJB methods.

Thanks in advance.

Hello All

I have given my exam today and passed with 86%.

was expecting more than 90% but still happy with my result ....

Thanks for everyone who helped me to clear my doubts during my preparation and especially to enthuware exam kit....
13 years ago

i was going through one of web site and came across the following code.

Why do we need to use DeclareRoles annotation in the above code?

I thought we would be using this annotatation only when we use programmatic security,but as we can clearly see there is no such a code ?

Also if container can built up a role by inspecting the RolesAllowed annotation why do we need to use DeclareRoles in the code?


I am preparing for SCBCD5 exam and have some doubts about these annotations.

I have good knowledge about security in older version of EJBs. But finding it hard to understand in EJB3.

RolesAllowed annotation is used to declare logical roles instead of declaring them in the deployment descriptor?

What is the use of DeclareRoles annotation? is it also used to declare new logical role name ?e.g.

or used to refer the name used programmatically in ejb?


in the above code i have declared two roles "employee","manager" but the code itself uses only one role.So the container will create a new role called employee which is equivalent to <security-role><role-name>employee</role-name></security-role>?

i got the above question as i was going through the specification and it says :

The set of security roles used by the application is taken to be the aggregation of the security roles defined by the security role names used in the DeclareRoles and RolesAllowed annotations. The Bean Provider may augment the set of security roles defined for the application by annotations in this way by means of the security-role deployment descriptor element.


Yes.But i think the concepts are still same.

please let me know your thoughts about my questions.

I was going through this post webpage and have some questions about it.

1. MDB with BMT throws System Exception :
Log the exception,Rollback the started transaction,discard the bean and throws exception back to resource adapter.But in this case the message is acknowledged anyway right? Because the message receipt is part of transaction that the containter starts and once it is received it will commit the tx and hence acknowledged the message and then call onMessage.Please correct me if i am wrong?

2. MDB with BMT throws System Exception but no transaction :
Discard the bean and throws the exception back to resource adapter. What about message acknowledgement?. The Tx started by container for message receipt will get committed or suspended before call to onMessage?

3. MDB with CMT but NOT_SUPPORTED throws System exception.
Log the exception,discard the bean and rethrow the exception to resource adapter but what about message acknowledgement?what about the transaction started by the container for message receipt, does it commit before call to onMessage or get Suspended?

I am using apache poi api to read data from the excel file and having problem with particular data format.

One of the coumns in the excel file had formula type whose value will be in the below format


Note : the no of digits between each dash and the number of dash itself may vary but the format will always be numbers followed by - and end with numbers.

The api successfully find the field type as formula and consider it as numeric type but it throws NumberFormatException as it contains -.

I am using DataFormat class to read all the numeric cell value as we need to read the data as it is (no round up or truncate) in the cell value.

I was going through the genral format available in the api but could not understand how to add custom format to the list of available formats.
I was trying to use DataFormat.addFormat(String,Format) from the api but did not understand what to pass in the String argument and how to define the Format for this custom format.

Your help is appreciated.

java.lang.NumberFormatException: For input string: "2001-160101100-22110-0000-000"
at java.lang.NumberFormatException.forInputString(
at java.lang.FloatingDecimal.readJavaFormatString(
at java.lang.Double.parseDouble(
at org.apache.poi.xssf.usermodel.XSSFCell.getNumericCellValue(
at com.excel.reader.ExcelDataReader.isNumberOrDate(
at com.excel.reader.ExcelDataReader.getCellValue(
at com.excel.reader.ExcelDataReader.process(
at com.excel.reader.ExcelDataReader.main(
Exception in thread "main" ACBS 2001 7528080 Java Result: 1


I am assigned with a task to read data from the excel file.

I am using Apache POI api 3.6 to read the date.

Please find below the code:

The code is working fine but i just wanted to know that if there is any room for code improvement,efficiency etc.

Please help me with your suggesstion.
14 years ago