Aakash Chandel

+ Follow
since Aug 31, 2010
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 Aakash Chandel

This will help. Thanks for the reply.
8 years ago
I am using maven for the first time and currently trying to configure Hibernate using maven with spring web application. My web application is very simple. It just tries to connect to MySQL DB and fetches the number of records in a table and displays it using System.out on the index page. While building the application I get the error mentioned below. My assumption is that it is missing some dependency. I have following questions.
1) Since I am creating a web app I think I might be needing more than just Hibernate core module? Not sure what all I need. Is there a way to figure out what all jars I need for a web application that uses Hibernate with Spring?
2) How can I found out what all dependencies are there for a specific jar? Is there any web page which shows all the dependencies?
3) In Maven, is there any way to download a jar with all it's dependencies is a single shot through pom.xml?


While building the application I am getting the following error.
Error Log:

Please guide.
8 years ago
Found the problem.

Netbeans creates an instance of tomcat in C:\Documents and Settings\chandeln\.netbeans\7.1.2\apache-tomcat- Modifying C:\Documents and Settings\chandeln\.netbeans\7.1.2\apache-tomcat-\conf\tomcat-users.xml did the job.

8 years ago
I am trying out a sample Security Realm application on tomcat. The problem is that BASIC authentication does NOT succeed when running the application through NetBeans and embedded Tomcat whereas when I deploy the WAR file manually on Tomcat and start Tomcat through Windows command prompt it successfully runs the application and authentication also succeeds. Not sure why it is failing when running the application through NetBeans. I tried to run the manager app but that also failed through NetBeans-Tomcat whereas it works fine when I jump out of NetBeans environment and start tomcat manually through command prompt. Not sure what's going on here.

My sample application is very small and code chunks are shown below:


Any ideas will be helpful.
8 years ago
How is Concurrency related to Serialization? Isn't concurrency a different topic than Serialization?

The output of the above code is : 0 1 0 which flattened my understanding about post-increment operators.

Why the output of the above program is not 1 2 1 ?

Can anybody give some insight on this ?
I am planning to take SCJP 6 next week. All those who took the exam recently did any of you guys came across Serialization questions? Please let me know as I don't want to invest my time learning something which is not in the exam. I have checked Oracle's website and I couldn't find it in the "Exam Topics" section whereas in the K & B book this topic exists.

Please advise.

Much better and thanks for the very good explanation.

Paul Clapham wrote:True, you haven't implemented an equals() method. That means that your Dept class inherits its equals() method from Object, and therefore that two Dept objects are "equal" if and only if they are the same object.

But I don't understand your question. Or your code. You're asking about whether the add() method of Set notices when you add an object which is already in the set, but your code doesn't bother to find out. Which it could very easily. Read the documentation for Set's add() method and you will see.

Let me try to make this clear.
The output of the above program is :
I was hoping that the output of the program will have 3-Admin department displayed 3 times since I added it 3 times using set.add(). But that didn't happen.

So, if I try to add two String objects with same values Set won't allow because it uses the String's equals() method to determine if they are same. How does Set figure out if two objects (Dept) are equal and does not add them to Set even though we have not provided equals() method for Dept object?

Hope this makes sense.
I have a question about Set. I know that sets do not allow duplicates. I tried the following sample but didn't quite understand how did the JVM automatically understood that I have added d3 object more than once? I have not added any equals() method which would say that two objects are equal based on some instance variable. Please guide.

ArrayList orders data by index whereas LinkedHashSet orders data by insertion order. What is the difference? I wrote a sample program but both of them gave me the same output.

Are both Order By Index and Order By Insertion Order same? Please guide.
I have a simple question regarding SCJP 6 course content. Are serialization question asked in SCJP 6 exam? I have come to know that this topic is excluded from the exam.

Please guide.

I came across this question in one of the SCJP practice test and didnt quite understand why did this even got compiled.

According to the overridden method rules, the overridden method should not declare new or broader checked exceptions. Here IOException and FileNotFoundException are clearly new checked exceptions that are getting thrown.

Moreover i have one question that does java.lang.Exception class falls under checked exception category or runtime exception category?

Please guide.

Why the output of this program is "parent"? Shouldn't polymorphism apply and the output come as "child"?

Please guide.

Boris Romashov wrote:You can define this property by editing command object in the controller.
To be more exact I need to see your controller method.

I got the issue resolved by initialing command object properties with default values.

9 years ago