Win a copy of Spring Boot in Practice this week in the Spring forum!

R Naijat

Ranch Hand
+ Follow
since Nov 01, 2011
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 R Naijat

Hi all,
I have the following class. I use ConcurrentHashMap. I have many threads writing to the maps and a Timer that saves the data in the map every 5 minutes. I manage to achieve thread safety by using putIfAbsent() when I write entries in the map. However, when I read from it and then remove all entries by clear() method, I want no other thread writes to map while I’m in the process of reading the map contents and then removing them. Obviously my code is not threadsafe even with synchronized(lock){}, b/c the thread that owns the lock in saveEntries(), is not necessarily the same thread that writes into my maps in log() method! Unless I lock the whole code in log() with the same lock object!

I was wondering is there any other way to achieve thread safety w/o enforcing synchronizing by an external lock? Any help is greatly appreciated.
Hi all,
I have a web service call: javax.xml.rpc.Stub that needs to be proxied.

The actual proxy is created like below:

The stub object has:

But when it gets proxied and returned, the cachedEndPoint becomes null which throws NoEndPointException later in the code. Does anybody have any idea why this property becomes null? Is there any other way I can create the proxy instance in a way that this returned object saves all the properties of the original object?

Any help is greatly appreciated.
10 years ago
Found the problem! Needed to remove the open and close () from the beginning and end of SELECT statement which got rid of the first error. Then I got "cannot be bound" error which I resolved when I replaced the actual table names with the names which was defined in from statement: kwd for table and k for keyword.

Thanks anyway.
Hi all,
I use MS SQL Server. I don't know what I'm doing wrong in the following query.

I receive this error:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ','.

select (table.isNegative, matchType.code,, status.code, keyword.lastUpdate, syncStatus.code)
from table kwd, matchType, keyword k, status, syncStatus
and kwd.umbrellaId=1080
and matchType.code='P'
and status.code='A'
and syncStatus.code='B';

Any help would be greatly appreciated.

Hi all,
I’m very new to maven. I’m using wsdl2java to get the Java files and then create the jar file I need. The problem is that my urls comes from different sources and eventually I need to have 4 different jar files.

So far, I tried to create the first two jar files and deal with the next two later... So I created two different <execution> blocks in the <build> block; each <execution> block downloads each own wsdl files, so far so good. The following plugin:


Works this way: it first compiles all the generated Java files and then generates the jar file out of all the files, meaning it creates only one jar file.

Is there anyway, I ask wsdl2java to compile and then create the jar files right after each <execution> block? That I can get two different jar file each relating only to the wsdl files I downloaded in that <execution> block?

Following is pom.xml. At this point the generated jar file consists of the Java files generated from: file1, file2, file3, file4 and file5.

Where I want one jar from: file1, file2 and file3 and the other from: file4 and file5.

Any help would be greatly appreciated.

10 years ago
In the query, UserName and UserId refer to the columns in the db which actually are not case sensitive; however, :username and :userId are parameters that we need to set values for, so setString("username", username), the first item is case sensitive and should match what we have in :username, and setInteger("userId", userId): the first parameter should match what we have in :userId.

So the following works with no error:

Thought it might help somebody.

Hi everybody,
I connect and run queries against Oracle DB using Hibernate. I have the following piece of code:

I receive the following error:

Does anybody know what am I doing wrong? Any help is greatly appreciated.

I changed the <form> in the jsp to <div> and its working fine. I do not need to have comments in JavaScript funcion() anymore. I don't know why that made the difference though? According to:

The <form> tag is used to create an HTML form for user input.

The <form> element can contain one or more of the following form elements:

An HTML form is used to pass data to a server.

I do have <button> and also send the data - the value of checkboxes - to server. So I think it should also work with <form>.

Please let me know if you have any idea. Thanks.
10 years ago
Hi all,
I have a jsp file which loads a page at this address: http://localhost:8080/dir/list/

I've added two checkboxes to the page; user can check both checkboxes, only one or none. Following is code I have in jsp file:

This is my Controller class:

The way my jsp code is written now, it calls the correct method and displays the correct url. When page loads for the first time, it calls method1 and the url is:

When the user checks/unchecks one or both checkboxes and clicks on apply button, method3 is called and this url is displayed:

If both checkboxes are checked which both booleans are set to true:


Everything is fine... however, if I comment these two lines at the end of JavaScript apply() function,

Then method3 will never gets called; only method1 gets called and I see this url:

I do not know why it gets confused bet. method1 and method3 and cannot pick the right method?

I tried to use the POST method instead, but the page goes directly to our internal error page and it never reaches the method I wrote in my controller for POST:

So I got rid of POST alltogether...

I cannot use the GET method correctly either... I don't really know what I'm doing wrong? Any help is greatly appraciated.
10 years ago
Hi everybody,
I have a Java code which is a controller for a jsp page, called: Code is as follows:

There is nothing especial in the jsp page: home.jsp. If I go to this url:


I can view mypage and everything works fine. Also in the tomcat Dos page I can see the comment:

As expected.

Now under the same directory that I have, I've created another file called: Following is the code:

And under the same place which I have home.jsp, I've created login.jsp.

Also under tomcat folders, LoginController.class exists under the same folder that HomeController.class exists and login.jsp exists under the same folder which home.jsp exists.

But when I go to this url: http://localhost:8080/adcopyqueue/loginpage

Nothing is displayed! I think tomcat does not pick up LoginController.class b/c on the tomcat Dos window, I do NOT see this comment:

Instead I see following which I do not know what do they mean?

The structure and the code for and plus the jsp files match. I have no idea why tomcat sees one of the files and not the other?

Clean build did not help. Does anybody have any idea? Any help is greatly appreciated.
10 years ago
Hi everybody,
I have a text input field, when the user typing in the field, onKeyUp() function is called and I do some processing on the content in the field. In order to set the focus and cursor back to the filed, I use the focus() function as follows:

My OS is Windows 7. focus() works correctly in Chrome 15.0, meaning if the contents of the field is already ABC, the cursor appears right after C, so if the user enters D, the contents of the field would be: ABCD.

In FireFox 8.0, the cursor appears at the beginning of the field, meaning if the contents of the field is already ABC, the cursor appears before A, so if the user enters D, the contents of the field would be: DABC.

And in IE 8.0, the focus() does not work at all! The field looses the focus completely and I need to use the mouse to set the focus back to the field.

Two questions:

1) Does anybody know why this function does not work properly in IE?

2) For FireFox: is there anyway, I can make the focus appears at the end of the field instead? Or on the other words is there anyway I can make the functionality the same in FireFox as it does in Chrome?
Some correction to the code! I modified the code as following; when the script executes for the first time, it gets inside charCounter() function and does calculate the remaining chars correctly, b/c I get:

TITLE: Auto Body and Paint
16 characters left

But then it does not do anything else as I type in Title field. So can you help me fix this in a way that does NOT go inside charCounter() when the script executes for the first time and instead gets in that function when user enters anything in the field?

Hi everybody,
I have this piece of code which calls the charCounter() function anytime user enters any letter in the input. Its working properly:

Now I am trying to mimc the above code, sending the title and left objects instead:

I have defined the following objects:

I think 'a' and 'b' are correct objects b/c a.value and b.value are the correct values, so I send the 'a' and 'b' objects to charCounter() function and expect the charCounter() function gets called anytime user
enters any letter in the Title or Left fields. Following is how I tried to attach the even listeners to the objects, also call the function.

How can I fix this?
If I go to the Chrome JavaScript debugger, this is what I have:

I think first I need to refer to the input objects that I have - the following objects or elements - and then get the value from the object:

If my assumption is correct, I have difficulty referring to those objects within the code. I need to find out how can I refer to these two elements, b/c need to pass these elements to other function which then the function tries to access the values: "Auto Body and Paint" and "35".