Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!

Mishra Anshu

Ranch Hand
+ Follow
since Sep 16, 2003
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 Mishra Anshu

Because, since people normally don't watch the whole videos. If the counting mechanism is invoked after downloading the video, the view count will be too less.
Thanks Eric !
I think so too. By the way, is there a way in AJAX to set some request attribute (not parameters, which can be mimicked) value, before calling the server URL ? If yes, then the server code can find it and increment the count.
There is a page which does not need any sign in to get accessed. That means, one can directly hit the URL and see that page. When that page is loaded it loads a video and using Ajax makes a request to the server, to increment the view count of the video. Again, if somebody uses something like "firebug", he can see the URL for the request.

The problem is any body can use a load test tool, to mimic the request and increase the video view count, without actually viewing it.

Is there a way to make sure that the request comes from inside a Browser and not some tool ?
Or, how do you suggest to solve this?

I have two applications , say App1 and App1Admin. Both runs on a the JBoss server as separate wars. Both of them use Spring with Hibernate.

The scenario is if App1Admin changes something, The App1 should reload that
changes immediately in the same hibernate session, it is already running in.

So, what are the possible options to achieve this ? This is what, I could come up with, Please add/clarify :-

1. Use secondary cache (I have not explored much on that, It would be great if you can suggest any good paper/tutorial, which achieves this using Spring on top of Hibernate )

2. Write MBeans in App1, so whenever App1Admin goes to change something, it also invokes the MBean exposed by App1, so now App1 is aware that something has been changed, so it should reload that in the session it is running already..(I have not explored the JMX with Spring, so will have to do that..if you can add some references, suggestions, that would be great..)

3. Similar to the second option. But this time, whenever App1Admin goes to perform the updates, there is some listener program between Hibernate and the Database (or say a Trigger), which calls the App1 to reload the things..
(Please add your ideas..and resources..)

Thanks Carol !

I think, since I decide the name of the logfile depending upon what is passed as args, I would use :-


[ October 19, 2006: Message edited by: Mishra Anshu ]
I want to have the name of my log file to be decided at run time.
Like, suppose a command line argument is to be included in the log file name.
How to do it, declaratively..i.e. using file or log4j.xml file ?

This is how it can be done, programmatically :-

It has to be rolled.
I feel it is quite a common requirement, whenever you want to run your program everyday, for different args passed to it.
I suppose, what you mean by fully object oriented, is that, if everything is an object inside java ? There exist primitives (int,float, double, etc..) which are not object (Although you may use the Wrapper classes for them ).
17 years ago
Suppose I have an enterprise application (say , MyApp.ear), deployed on the WebSphere5. It uses, JMS, DataSource configuration, done at the Server where it has been deployed.

Now, I want to make an java application which uses some of the piece of functionalities of the MyApp.ear. So, I make a jar of such utilities/methods (say, MyUtil.jar) and use it in my Stand alone java application. It compiles fine. Now, MyUtil.jar has got code for, say, dealing with datasource (hence, database ). As, the datasource (and also JMS ques n all...)is configured on the Server, I feel I need to deploy my java application on the Server. so that my "MyUtil.jar" can use the configuration seetings done over there.

When I went to the admin console of the WebSphere server , it suggests that it will allow one to deploy the application as either, EAR, WAR or JAR file. When I tried to deploy the JAR of my application , with mainfest file containing the Main class, it produced an error, suggesting that it has to be an EAR file to deploy.

I made an EAR project and then wrapped my application in a Application Client project (I am using WSAD), and then tried to deploy my application over the WebSphere server. It did deploy, but the status of the application became "UNKNOWN".

Has anybody ever required to deploy stand alone application over the App Server, and what happens if at all a non-web project is deployed over the App Server?

Can you suggest a better way, so that the common code sitting inside the MyApp.ear could be used and also, we can run the Standalone java app inside a JVM instead of using App Server?
17 years ago
You may wish to google for detailed explanation.

A service Locator pattern, suggests you to make a class which is responsible for all the JNDI look-ups of your resources. So, the classes looking for any resource, registered in JNDI, will just call the Service Locator to give that object to it.

A business delegate reduces coupling between presentation-tier clients and business services. It hides the underlying implementation details of the business service, such as lookup (for which it will use Service Locator ) and access details of the EJB architecture.

Hope this helps !
Hi Shaila,
You need to add -ea as VM argument for enabling the assertion.

You may wish to visit this link

Hope this helps
I am not sure if it is the right forum for asking JMX question. I searched on this forum, and found some questions about JMX , so here it goes :-

Suppose, I have (say) three applications (App1, App2 and App3) all running in their own JVM's (jvm1, jvm2 and jvm3 respectively). All of applications are using Standard MBeans to expose their management.

I want to manage all the three applications. So, a distributed agent is needed, which will run in it's own JVM and using (say) an appropriate adapter, all of them will be managed. (Am I right up to this point ?)

But, my doubt is, how will I register my different MBeans , in the MBean Server contained within a distributed agent ? Please explain a bit.

Thanks !

I had tried yesterday, to change the permission on the server and it worked.
17 years ago
Suppose, I have a web application deployed.
The application uses a map service, to generate new maps for each request.
Can the map service, write its output to a directory (Say it "output") which is parallel to WEB-INF ?

Will that (output dir) be not writable? If yes, is there any way to show the dynamically generated map (the jpg files), in the application using some url ?

[ April 18, 2006: Message edited by: Mishra Anshu ]
17 years ago
Hi Jonas,
It is great to write (...and to read..too) book on JSF+Ajax.

Ajax has started to catch market. Thanks to the Google and the some of the other web2.0 startups.
I hope one will definately learn the both using your book. The JSF has been made standard tech in j2ee specs, but there are a lot competitive (existing) technology (Struts/Spring MVC/ Webwork/ etc..), so I am not sure, if in future it gets its due respect/values in the java space.

I wish, more people to know it, and use in their project(s).

Wish you all the best, and thanks for writing on such a good topic !!

17 years ago