Ahsan Habib

+ Follow
since Sep 17, 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 Ahsan Habib

I am using spring webflow 2 with richfaces. There is one flow with two views. First view presents send email form with fields like sender, destinations, subject, message, scheduled delivery (richfaces calendar). In order to facilitate user to import contacts from contacts list, 2nd form displays list of contacts from where user can select destinations. This 2nd form is shown as popup and in transition actions, tries to append 1st forms destinations field with newly selected destinations. Destinations field get updated when 2nd view transitions back to 1st form but the problem is 1st forms input values are lost.

I have declared one backing bean in flow. It seems while transition to 2nd view does not bind data to bean and that is why when returned back to 1st form, other fields have no data which was entered before going to 2nd. Googling for couple of days but no luck. Any suggestion is appreciated.

14 years ago
I finally get it solved.

Springsource profides library of richfaces and impl version 3.1.4.GA and 3.2.1.GA. I used 2 jars of 3.1.4.GA and corresponding richfaces ui library from jboss repo, and all problem gone. Last time this ui lib was missing. Now I can play with swf with richfaces and spring security.
14 years ago
That problem is solved. I download richfaces resources from springsource repository. But now i get different error -

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.ajax4jsf.resource.ResourceNotFoundException: Static resource not found for path /org/richfaces/renderkit/html/css/basic.xcss

Any suggestion is appreciated.
14 years ago
I am a newbee in swf. While exploring I felt to use richfaces UI. According to swf manual, i updated web.xml to include richfaces filter. Included richfaces lib richfaces-ui3.2.2.GA (which includes dependency richfaces-impl as well).
Following is spring lib versions -
spring 3.0.0.RELEASE, swf 2.0.8.RELEASE, security 3.0.0.RELEASE

After deploy in tomcat 6 I get NoSuchMethodError. Stacktrace below. Googling not showing much help, guessing I'm doing some wrong with library version or richfaces configuration. Note that when I remove richfaces config, it works fine.

Any help is appreciated.

14 years ago

Anjali GauravSingh wrote:Thanks for your advice but will you please elaborate your suggestion little bit more.

You can get lots of example on how to use HttpClient. Here I am attaching one sample code to do so. Hope it helps. You have to write one function (see comments)

Right now I could not explain why HttpURLConnection gets 4xx errors, in spite of adding User-Agent property. I let you know if I find.">

Anjali GauravSingh wrote:Well, I am still trying to debug the application. Could not find the solution. URL is valid when i execute it from browser. Any advice is appreciable


I had same issue as your's and ONLY work-around I found was to use apache commons http-client. Usng HttpURLConnection, I can not connect several web servers, and I use http-client from commons in that case. Still exploring the root cause of failure.
Holy cow! I pointed out the problem. It is in the worker's infinite loop inside catch block (line number 18 of last code fragment)-

I believe even a dumb guy can imagine what happens when e.getCause() is null which I failed to locate so far. The catch bock was throwing some exception and thts why the loop breaks.

Thanks Bueno for your help so far.
I agree with you that I should examine method processJobs carefully. But what is not clear to me what why processJobs is not throwing NullPointerException which should be caught at the top level? The exception only caught by UncaughtExcptionHandler. What should be preferred coding convention to address such situation then - try/catch or UncaughtExcptionHandler?
Here is the entity pojo -

Dao goes below -

Here is the spring config xml -

Finally here is how worker uses dao -

Thats all. Hope it helps to figure out the big picture of the scenario.
Thank you very much for your time.
Previously i was using spring jdbc template for persistence. Recently I was trying to use hibernate 3.2 while JPA annotations which eliminates the need for hibernate mapping xml files - all these are manged with Spring framework. Now I encounter one strange problem. I have one worker thread which retrieves some requests periodically and service them accordingly. I wrapped my code inside try{}catch(Throwable e){} within an infinite loop but i noticed that worker thread some times disappears (loop breaks) and it does not enter the catch block! Naturally I was confused with this behaviour since i believe that any exception should enter catch block.

After some googling i found UncaughtExceptionHandler. Inside uncaughtException function i simply log the error and its was great NullPointerException. So i was assuming that while hibernate making some query and finding NULL in some column, it catches the exception and not allowing it to bubble up. But i am not getting why the thread crashed !! It is making me really confused. Can you please show me some light.

Thanks in advance.
For java app, I log output into file, and I run servlet in tomcat from eclipse - so, can see output in eclipse console.

I guess i figured out the problem. It was not jdbc driver problem. I changed Standards and Formats in Regional and Language settings (windows control panel) to Thai (before it was english) and now java app logs unicode data (read from mssql table) properly in log file. But eclipse console still show question marks. Later, I switched to jetty, and eclipse console prints Thai character properly. It was tomcat limitation. Adding UTF-8 for url handling in server.xml in tomcat solved the problem.

Worth to note that I was using apache HttpClient to forward data to servlet.
Java application reads mssql table data (unicode data) and forward to servlet. This scenario works fine when I run application in Ubuntu. But performance changes for these following scenarios:

secnario1: i move java application to windows which forwards database data to servlet running in ubuntu. Output in java app shows question marks (unicode issue) but servlet shows them correctly.

Scenario2: move both java app and servlet to windows, now both modules displaying question marks.

What I think - it should not be problem with database data since jdbc driver in linux works fine. But when I read data from windows (using same driver, later different versions of jdbc driver), though it shows ?? but servlet in linux could manage to get unicode data. What could be the problem and what should I do?

Thank you in advance.
The problem was solved! I was using drawing panle's graphics object to drawlines but using Graphics, what i shud do is to cast it to Graphics2D. I guess parent class Graphics doesn't do coordinate transformations. Thats why when nodes go beyond normal view and scroll enables, lines get shifted when drawing lines using Graphics. Use of Graphics2D takes care of this transformation.

Thanks all.
15 years ago
1) DrawingPanel class; Sub-class of JPanel for drawing (JLabels as node and line as links). Nodes are added and linked dynamically.

2) DrawingPanelMouseListener subclasses MouseInputAdapter.

3) Node class extends JLabel. It maintains list of adjacent neighbors to draw line between nodes along with utility data elements.

4) MainPanel extends JPanel. It adds JScrollPanel(drawingPanel) in border layout center and one toolbar is added at north.

5) AppFrame is main class which display GUI

Problem: Inside un-scrolled area, every thing works fine. New nodes created, line is drawn between two nodes, when node dragged corresponding link also redrawn accurately. But when one node taken beyond display area and left/right scroller appears, then link shifts from both src and dst node. It seems calculation for line end points disturbed with new scrolled area. The far I drag that node, line shifts from src(or dest) node proportionately. When that node taken back to normal display area, link connect both nodes in proper point. Might be some viewport issue.

Hope you could figure out my design. Please let me know if further code need to be shown.
[ January 01, 2009: Message edited by: Rob Prime ]
15 years ago
I want to design call flow builder. States are nodes,links connect them. I subclass JPanel which is main drawing area. I sub-class JLabel to create nodes and they can be dragged over drawing panel. Node overrides paintComponent and use drawing panel graphics object to draw corresponding link. Whenever one node is dragged, it draws it is neighbour links. When node is dragged beyond view area, scroll pane gets activated. My problem also occurs at this point. Whenever node is dragged beyond display region and scroll bar appears, link gets distorted and they no more connect nodes exactly. When nodes dragged back to normal view area, they are fine again.

If somebody could catch my problem from this scenario, please suggest what should be done. If required I can post the logic.

Thanks in advance.
15 years ago