This week's book giveaway is in the Web Services forum.
We're giving away four copies of Microservices in Action and have Morgan Bruce & Paulo A. Pereira on-line!
See this thread for details.
Win a copy of Microservices in Action this week in the Web Services forum!

nazzy khan

Ranch Hand
+ Follow
since May 06, 2010
nazzy likes ...
Android Eclipse IDE Spring
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by nazzy khan

Please refer to attached flow diagram.

As per high level flow diagram, my webservice 1 perform three tasks in one JTA transaction.

1.DML operation on database 1
2.DML operation on database 2
3.In the end, Web service 2 invocation.

If there is a transaction timeout while I'm still in middle of service 2 call, can I commit the two database calls (1 & 2) provided no errors received while executing the queries?

Regards,
2 weeks ago


I've a MQ Spring Boot PaaS application where I need to implement exception handling via a common exception handler class (GlobalExceptionHandler). My PaaS application receives message from a source queue, perform some database operations via spring jpa and write the response back to a destination queue.

I need to handle all the database RuntimeException, custom business exceptions and other checked exceptions via GlobalExceptionHandler class.

My GlobalExceptionHandler will have handlers (method) defined for every exception. In my handler, I will be logging the exception first and then I will be creating a [error code, desc] and then I need to return it back to main flow.

I do not have any controller in my application. So I think, I can't use @ControllerAdvice. Currently I'm using spring AOP @AfterThrowing as below but I'm not able to return the


Can anyone please guide me in implementing exception handling here.
8 months ago
Hi,

I've a AWT Java application which is accessible by a JSP page. JSP pages are deployed in a web application and AWT classes are inside a Java application. Both web and Java is bundled in an ear file which is installed on an IBM websphere application server 7.

AWT application is launched by a JSP login page. There are different buttons in that AWT app to access different functionalities of the application. They all makes database call (simple CRUD operation) to save/update database record.

When multiple user (5 user) log in to the system with their credentials, after sometime, AWT application stops responding. Application starts hanging/freezing after sometime. When you click on one functionality, the child frame does not paint correctly and due to this, input form fields of child frame does not load. You have to close the AWT main window and then re-login to access the AWT application.


We're not able to replicate this with single user. We've then tested it with 4 user and there was no issue. When we've increased user to 5 i.e., 5 users concurrently accessing AWT application, then we have got this screen freezing problem (child frame components not loading correctly after sometime of access).

Does anyone have faced this issue in AWT?

Any idea how to approach and find the root cause for this.

Thanks,
Nazz
6 years ago
oh is it? I'll look ito that then..
7 years ago
Hi Mohana,

Yes I'm using struts 2. and basically I have two kind of users defined in my application: normal user and super-user

super-user actions are under admin package and normal user are under user package.

and both packages are protected by common Interceptor (AuthenticationInterceptor). There I need the package name to redirect admin users to a different login page.


Thanks
7 years ago
Thanks.. I'm now using the same way

Regards,
Nazzy
7 years ago
yeah the namespace..

I got it using below code...


Struts 2 ActionConfig class exposes the package name

Thanks
7 years ago
Hi,

How do I get the name of package in intercetor.

Let's say I have interceptor applied on a package, I can get the name of the action using ActionInvocation class.


Is there any way to get the name of package as well.
7 years ago
Hi Maneesh,

Thanks for your reply. If I'm not wrong, with quartz I can write unix like expressions and can schedule classes but my main class needs to be started once by some mechanism.

What I'm looking for is some tool similar like crontab in unix which can directly start my java program (by invoking bat file). Further execution I can either use tool's cron feature or Cron4J/Quartz scheduling mechansim or simply by Java TimerThread and Timer task.

As Quartz or Cron4J both are purely in Java, so initially first call has to be from outside like windows scheduled task.

I have got few cron tool similar to crontab in unix like pycron, CRONw or 'AT' command on windows.

Have you came across any such/similar tool which is widely used on windows plateform to schedule jobs and can run as windows service.

Thanks!
7 years ago
Hi,

I have a requirement to setup a cron on windows plateform. Cron application that I have built is purely in java and that internally uses workflow system using spring. It has main method which starts the workflow. Now, I want to start this application automatically at some time as set.

This can be done by:

1. Create a bat file for running main method. (jar filename.jar) jar has main class name entry in manifest file. Next set this bat file in windows scheduled task to schedule this at some time.

2. Create a web application. Create a servlet and call the same main class from servlet. Configure the servlet on server startup by adding an entry in web.xml load-on-startup tag. To reschedule again after some interval, use java timer task class or some tool like cron4j.

Could you please suggest which one is better approach. Is there any other approach to do this whole cron activuty. My java application basically does some database operation, refreshes some cache, create xml file, validates it and then send email.
7 years ago
I have managed to resolve the issue.

I have changed my sybase driver from com.sybase.jdbc2.jdbc.SybDriver to com.sybase.jdbc3.jdbc.SybDriver. With jconn3.jar, there is no exception and JTA transaction is working like a charm : )

Thanks & Regards,
Nazz
Hi Both,

Thanks for your reply : ).

Jeanne Boyarsky wrote: The solution would be to not use "set chained" since XA is taking care of transactions for you.



Jeanne: Before calling the actual database call, I have explicitly called the query:

but now the code is breaking at this line with the same exception. Sorry I didn't get you on that line.

Hi Sunil,

Are you trying to say I should explicitly call setAutoCommit(true) on connection. If yes, where exactly should I call. Should I extend TransactionProxyFactoryBean or JtaTransactionManager class and override doBegin() method and there change the auto commit behaviour.

I'm posting my Spring bean configuration and datasource bean.

Is there any class which is creating problem with Sybase may be Driver class (com.sybase.jdbc2.jdbc.SybDriver) jconn2.jar or jotm or enhydra XADataSource. I'm only getting this error on Sybase and not on Oracle database.

Spring Service Bean Configuration:



Data Source Configuration:

Hi,

I'm getting below error while using JTA transaction. I have two datasources one for sybase database and other is for Oracle.

Also, I'm using jotm for JTA transaction. Server is Tomcat.

com.sybase.jdbc2.SybConnection@12833ff) start:javax.transaction.xa.XAException:
com.sybase.jdbc2.SybConnection: SET CHAINED command not allowed within multi-statement transaction.
(error code=0) --com.sybase.jdbc2.jdbc.SybSQLException: SET CHAINED command not allowed within multi-statement transaction.


Any idea why I'm getting below error on sybase?

I'm using Sybase thin driver com.sybase.jdbc2.jdbc.SybDriver and org.enhydra.jdbc.pool.StandardXAPoolDataSource.

Thanks & Regards,
Nazz
Hi Fatih,

Thanks for your reply. I will explore it further.

Regards,
nazzy
Well if you don't have Aqua Studio, you can use any other tool like Toad or even SQL Plus that comes with Oracle itself.

Idea here is to check whether are you able to connect to oracle database. If connection from Toad or SQL Plus is also not working then the problem lies at somewhere else.

If connection is fine with the same jdbc url details which you have used in your code, then we need to look code further.