Davie Lin

Ranch Hand
+ Follow
since Aug 05, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Davie Lin

Hi, I was wondering someone can answer this question for me.

I have implement two backing bean validator methods, when I click the save button, only one get invoked. What can I do make both run?

in xhtml like


thanks
Davie
7 years ago
JSF
Hi everyone,

I apologize if I didn't post the proper forums. I wanted to obtain a thread dump using jvisualvm.exe to diagonse a production window based pc running our java software that is unresponsive. I notice jvisualvm.exe started and I can see it listed in task manager's application tab. However, when I maximize jvisualvm.exe, I see the window border expand to the edges of monitor but the monitor was still displaying the desktop background. Basically the screen was not refreshing itself at all only if I press alt+ctrl+del and the Windows logout dialog appear. I try again to access task manager and try to max jvisualvm.exe, see the same border expansion again but monitor fail to refresh.

Should I use jstack.exe instead when it happens? but if the monitor won't refresh, will a command line window open at all?

Thanks for your input.
8 years ago

fred rosenberger wrote:According to the API:

Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence. The replacement proceeds from the beginning of the string to the end, for example, replacing "aa" with "b" in the string "aaa" will result in "ba" rather than "ab".



Of course, you could always write a quick program to test various cases and see for yourself what it does.



That sounds to me like the API is saying it check the literal target one at a time, thus iterate the entire string if the literal target is at the end of the String.
Does that sound right?

Thanks
Davie
8 years ago
Hello everyone,

Thanks for reading my question. According to String.java in 5, the implementation for String.replace(CharSequence, CharSequence) is



while the implementation for String.replace( char, char ) is



I don't quite understand how Pattern and Matcher object work, my question is does the iterate the entire string and replace the char just like

Thanks
Davie
8 years ago
Hi Guys,

I am implementing TreeMap and I have 2 String Keys one is "304000" and the other is "1026994". I thought the ordering of the key should be "304000", "1026994". But when I step through the debugger, I am seeing "1026994" as the first key. Can someone enlighten me please?

Thanks
8 years ago
Hi Tim

We brought this issue to IBM and they want us to try



Do I need to modify catalina.sh to add the above? I am not exactly sure where in catalina.sh to add the above.
8 years ago

Tim Holloway wrote:A session-scope bean and a JSF session-scope Managed Bean are one and the same thing. Which is to say, a JavaBean that can be located by obtaining the user's HttpSession object and using the getAttribute() method. The only difference between a traditional J2EE session object and the JSF one is that JSF constructed and initialized it. After that, it's completely impossible to tell the two types of session objects apart.



So I take it that I should store the byte[] in HttpSession instead of ServletContext.

Thanks a bunch again
8 years ago
JSF

Tim Holloway wrote:Just store it in a session-scope bean.



Tim,

what is this session-scope bean that you were talking about? Is the session-scope bean the same as a managed-bean in session scope? I sure hope not because I thought JSF were not suppose to handle raw binary data. Can you elaborate a little more? Are you suggesting that I don't need to use ServletContext or a servlet?

Thanks
8 years ago
JSF
Hey guys,

I hope this thread is not too old to revive. so here is what I am thinking, If I get a byte[] back from a web service call and I will save this byte[] as an attribute in ServletContext. Now this part is done in JSF backing bean. When the user click the link to display the image, I have a servlet to look up the attribute in ServletContext and flush out the byte[] to the user. Does this sound reasonable?

Thanks
8 years ago
JSF

Tim Holloway wrote:And yes, it can't hurt to try running Tomcat under the Sun/Oracle JDK VM instead of IBM's J9. J9 is supposed to work, but we all have our off-days. Just install the Oracle JDK, set JAVA_HOME to point to it and launch Tomcat.



I am all for trying a different JDK, however, we have other Java process that relies on IBM's J9 so our admin hesitate to change to different Java version. My question here is, is there a way for us to not change the default java version while download a new Oracle's JDK/JRE ( I believe Tomcat 6 will ran under a JRE ) and modify catalina.sh to start tomcat under Oracle's JDK/JRE?

Thanks again Tim
8 years ago

Tim Holloway wrote:Actually, it's more common that something goes CPU-crazy or hangs waiting for I/O or network. So looking at the stacktraces for the threads is where I usually start. And yes, the dump is what I meant.



Hi Tim,

sorry to bother you again. I have taken 2 dump files at 2 different time but both are with my problem war file and I started learning how to interpret stack trace from Oracle's site. Here is what I found interesting and I would like to know what you think



After comparing the stack trace out of 2 dump files taken different time with same condition. The condition being only have the problem war file in webapps directory.
I believe this is the current RUNNING thread based upon what I learn from Oracle's site because



State is R, which means Running and while I do have another thread that is also have state R



The priority of "Attach API wait loop" is lower than "Signal Dispatcher" thread. Therefore "Signal Dispatcher" thread is the running thread when I took the dump file both times.

Now looking at the call stack of "Signal Dispatcher" thread, I think it is stuck at



My question here is, would you say this is the IBM Java 6 issue?

Thanks again for all your help
8 years ago

Tim Holloway wrote:BTW, I do hope you removed the servlet-api.jar from the Lids webapp..



Done, servlet-api.jar has been remove out of webapp's lib directory

Tim Holloway wrote:
Tomcat isn't prone to hanging up on its own, so the fault is almost guaranteed to be in the webapp. Logging may or may not reveal the root cause. You need to fix it, but you should also consider taking a diagnostic snapshot of the running system just to see what's going on after Tomcat freezes



Does this mean triggering a java dump? I have generated a java dump by doing kill -3 <pid> but with my limited knowledge, I believe I see no lock contention, here is a snippet



I follow the IBM's tutorial a bit and my thoughts were there is no lock contention since there is only one monitor and only the "GC Daemon" is waiting to be notified. There is more stuff after but I don't understand it and the tutorial didn't elaborate

Thanks again for your help
8 years ago

Tim Holloway wrote:
Because I been there and I dun that and I have the scars to prove it!



Tim, I was just thinking. Based upon what I have Richfaces 3.1.5 and Hibernate 3 and Tomcat 6.0.35 AIX 6.1 Java 6 64 bit and the problems I am experiencing. Let's say if I need to convince a coworker or manager of mine that this hanging problem is indeed due to a Richface and Hibernate logging contention. My question is, what can I do on my side to convince them it is truely like what you mention on the previous post and thus justifiy in implementing slf4j?

Thanks again.
8 years ago

Tim Holloway wrote:Probably not. But if you have both RichFaces and Hibernate in the same app, you have 2 conflicting loggers and you need slf4j to integrate them.



WOW Tim, how do you know I have both RichFaces and Hibernate 3. so slf4j huh..., I will have to look into it tomorrow

Thanks again
8 years ago
Well, I don't know if anyone still reads this thread or not but I notice there is only one of my war not working and started to compare with other web app that works and the web app that doesn't deploy has Richfaces3.1.5 and if I took out those jar files and modify the DD, surprise, surprise, my app is started, of course, the pages that use Richfaces doesn't display anyting and get exception in the log. So what does this mean, I need to upgrade Richfaces?
8 years ago