Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

karthik doppala

Greenhorn
+ Follow
since Feb 17, 2010
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 karthik doppala

Hi,
I am trying to build switch user functionality in our application using spring-security. The functionality works fine when I use the url in the browser:

http://localhost:8080/testApp/j_spring_security_switch_user?j_username=testUser


But my use case requires me to forward to this url from a controller. I get mapping not found exception when I try to forward the request to this url from a controller method.

noHandlerFound No mapping found for HTTP request with URI [/testApp/j_spring_security_switch_user] in DispatcherServlet with name 'testApp'

.
I am not sure why spring dispatcherServlet cannot find the mapping when called from with in a controller. I would appreciate your response.


Thanks,
Karthik
4 years ago
Hi,
I finally figured out what the issue was. I am using spring dependency injection for object creation by setting the scope property to prototype

which should be equivalent to

I am still not sure why its causing the slow down when I instantiate the object using spring. So it works fine when I use the new operator to create the new object but slows down when I create the object using spring.
Thanks Everyone for your suggestions. I at least zeroed in on the what was causing the slow down.

Karthik
7 years ago

Koen Aerts wrote:At least now you know where to start looking. Are the exact same credentials used for authentication from IDE vs jar (i.e. domain name, username, password, ...)? Is the same LDAP server used each time?


Yes, everything is the same.
7 years ago

Koen Aerts wrote:What if you insert log statements in some strategic places in your code, make sure to include the timestamps, and write to a file. Then compare the IDE and jar logs and see where the time differences start to increase.


As you suggested I included log statements and what I have noticed is the LDAP calls are taking a lot of time to retrieve the data. On eclipse its taking about .1 seconds where as when I run the jar its almost taking 1sec for retrieval. I using spring LDAP to talk to the enterprise directory. I would appreciate it if someone could throw some light on this issue.

Thanks,
Karthik
7 years ago

Koen Aerts wrote:Do they use the exact same JVM? Also, you mentioned there is some DB stuff going on. In your IDE do you retrieve approximately the same dataset (number of rows) as the one from the command line (jar)? Do you access the same DB both in IDE and jar?



Yes, I'm using the same JVM. I am creating the jar from the eclipse project so both the processes use the same external resources and retrieve the same dataset from the DB and ED.

Karthik
7 years ago
Interestingly CPU consumption is almost 90-95% when I run it through Eclipse and its 40% when I run the jar file.

Karthik
7 years ago
Well, I am querying a database and also enterprise directory, I consolidate the data and write it to a flat file. If this is the reason shouldn't it take the same time when I run the job on eclipse?

Thanks,
Karthik
7 years ago
I am not printing anything to the console so I don't think that is the issue. I am even using the same vm arguments eclipse has; but its still slow. I suspect it has something to do with the build. Thanks for your input.
7 years ago
Hi,
My program works perfectly fine when I run from eclipse but I package it to an executable jar and run it from command line, it runs much slower (almost five times slower). I am even setting the -vmargs while executing the jar
java -Xms40m -Xmx512m -jar jarFile.jar
I do not have any older version of java on my machine. I am not able to understand what I am missing over here. How can eclipse run the same program faster while using the same version of java and same vm arguments. Any help would be appreciated.

Thanks,
karthik
7 years ago
My screen contains multiple entities like borrower, coborrower of type Borrower which contain other properties like firstName, lastName etc. Instead of using each of these properties i am trying to use ArrayList containing borrower objects. please find the code below.


following is the code from my jsp


when I submit the form, the text entered in the firstName field is coming up as null. is there something i am missing. Any help is appreciated

Thanks,
Karthik
9 years ago
JSF