Amey Ambulgekar

Ranch Hand
+ Follow
since Nov 22, 2011
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 Amey Ambulgekar

Hello All,

i got the solution for this struts program i just changed jar files means i changed from ::

1]struts2-core-2.3.4.jar to struts2-core-2.0.11.jar <--
2]commons-fileupload-1.2.2.jar kept as it is
3]commons-io-2.0.1.jar kept as it is
4]commons-lang-2.4.jar kept as it is
5]commons-lang3-3.1.jar kept as it is
6]commons-logging-1.1.1.jar kept as it is
7]commons-logging-api-1.1.jar kept as it is
8]freemarker-2.3.19.jar kept as it is
9]javassist-3.11.0.GA.jar kept as it is
10]ognl-3.0.5.jar to ognl-2.6.11.jar <--
11]xwork-core-2.3.4.jar to xwork-2.0.4.jar <--

so it works i am very happy

but still i have one question --> when i download struts2.1.8 jars and use for application then it gives me error such as resource not found .!
why is it so..?

Thanking you all.!

10 years ago
Hello Java friends,

I am beginner to struts2 and yesterday i did a simple Hello World Program but I got an error .

Here is my program and my exceptions .

Struts.xml file ::

<?xml version="1.0" encoding="UTF-8" ?>
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"


<package name="default" extends="struts-default" namespace="/">
<action name="getTut" class="">
<result name="success">/success.jsp</result>
<result name="failure">/error.jsp</result>


here is my web.xml ::

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="" xmlns="" xmlns:web="" xsi:schemaLocation="" id="WebApp_ID" version="2.5">




and here is my java class ::


public class TutAction {
public String execute(){
System.out.println("Hello.! from struts");
return "success";

and now what i did run an application and i appended at the end
http://localhost:8080/Struts2App/getTut.action //<--

but i got this error ::

HTTP Status 404 - There is no Action mapped for action name getTut.action/.
type Status report
message There is no Action mapped for action name getTut.action/.
description The requested resource (There is no Action mapped for action name getTut.action/.) is not available.
Apache Tomcat/6.0.35

is my method wrong or what happened and i have added following jar's ::


friends please help me out. I did program 4 times but still i got same error for that i install and uninstall tomcat6 5-6 times.! friends please help me.!

you can run my program and tell me is there any mistake i did or need to add something. i know problem arising only within either "struts.xml" or "web.xml" but where .?

Thanking you.!

10 years ago

Jesper de Jong wrote:java.lang.NoClassDefFoundError: javax/mail/MessagingException

This means that you are missing the class javax.mail.MessagingException.

You'll have to include the required JAR files in the WEB-INF/lib directory of your web application, just like you put them on the classpath for a standalone application.

Hello Jesper de Jong,

if it is so they why my normal Standalone Program means without using Servlet is running.?

It should have also given such error('s). But it works fine only i have problem is, when i embedded with Servlet it gives me error.!

I have included all jars such as javaee-api-6.0.jar , mail.jar,smtp.jar,pop3.jar,activation.jar,mailapi.jar,dsn.jar,imap.jar..

Why don't you tried my program please.!

10 years ago
Hello java friend ,

currently i am working on java mail. I am trying to send email using servlet but i am facing lots of problems.

A normal Stand alone java mail program works.

But, if i embedded it in servlet application i got various errors even i have added all jars in it.

Here is my servlet program and my exceptions

Servlet Program ::

and here are the Exceptions i got ::

HTTP Status 500 -


type Exception report


description The server encountered an internal error () that prevented it from fulfilling this request.


javax.servlet.ServletException: Error instantiating servlet class emailpckg.EmailServlet
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process($ Source)

root cause

java.lang.NoClassDefFoundError: javax/mail/MessagingException
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
java.lang.Class.getConstructor0(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process($ Source)

Please help me friends. You may run my program on your system and tell me if you are facing problems or not .?

It requires in my project so only because of this email program i am not able to submit my project.!

Thanking you.
10 years ago
hello ranchers,


i want your help please help me... i want some idea for java project it can be servlet/jsp based or can be networking based...please help me...

i did search on net but did not get any interesting topic ..please help me out ...

[**NOTE:: this is my first java project so little bit confuse to choose topic... ]

Thanking you
11 years ago
hello to all,

i have created a program using FileInputStream,DataOutputStream..etc for a file..

in that program i have created a notepad in 'E:\' directory by calling FileOutputStream fo = new FileOutputStream("E:\My_FileOutput.txt");

and it runs in well manner when i write it on console and write "ok" then it will stop taking input , & will automatically imprinted in to My_FileOutput but there is one problem i am not getting output on separate line ... if i write on console..

Hello <--line1
to all <--line2
ok <--line 3 after this separate notepad of My_FileOutput.txt created and output will be of "Helloto all ", but i want it on separate line... means:

to all in separate notepad

please help me out ... this is my program(and change the file path):

Thanking to all ... (lets hope my Q is not big to all )

[Edit - added code tags - see UseCodeTags]
11 years ago

Ian Paul Budiman wrote:Hi all,

I am a newbie here, and have tried several exercises from Head's First Java, can someone help me with the logic of this:

Where the result is:

And I have tried to change the last code to become:

Which resulted the same.

Have examined this for few days but to no avail.

Any help on the logic to get the answer "46" in both cases above mentioned would be much appreciated.


[Edit - added code tags - MB]

hello Ian Paul Budiman,


about your Q that you have posted, there is one thing is that , whenever any object is pointing to any reference variable just like Echo e1 = e2; hence whatever you do operation on either of variable it will be equally reflected to other reference variable or object...

May be you got the point

thanking you..

11 years ago
hello hari,

as you know java is an Independent Platform Lang. so jdk is also...but jdk is diff for diff platform (may be just for installation purpose) then after that you can run any java program on any where on any platform ... this link can help you --> info about jdk/jre

Mushraf Khan wrote:Thanks a lot. Yes, Amey , my question was to access interface variable from main. Its clear to me now. Thanks Sebanti also for the explaination

Welcome Khan

and thanking you Sebanti for best explanation

Mushraf Khan wrote:GoodDay EveryOne

Anyone who could help me with this doubt, I will greatly appreciate it. Please.

abstract class Test{ int i =10;}
interface inter{int i = 2;}
public class NewMain57 extends Test implements inter {
int i = 9;

public static void main(String[] args) {
inter n = new NewMain57();
System.out.println(n.i); -----> Prints 2;

Test n = new NewMain57();
System.out.println(n.i); -----> Prints 10;

NewMain57 n = new NewMain57();
System.out.println(n.i); -----> Prints 9;



Is this right(although i ran in netbeans , got these answers). Is there any way we can get the variable i of inter interface into NewMain57 class (other than this) as this class inherits the variable of inter interface which is public static and constant.

hello Mushraf Khan,

well first frankly i didn't get your Q first(about "Is this...) ... but then i run your program and from your Q may be you want, with using of NewMain()'s object you want to access inter's variable(i=2) right??

so about answer i did try and found that we cant access using NewMain 's object cause it will access only local variables(i=9) .. so we can directly call interface's variable as it is "public static variable"

so answer is System.out.println(inter.i);//answer =2

otherwise create another variable

interface inter{int i = 2;
int j=1;}

and now you can access using NewMain's object as

NewMain nw = new NewMain();
System.out.println(nw.j);//print 1

(i hope you got answer )

Thanking you.

yes object aa gets garbage collected but life of all variable('s) or Object('s) is depends on "{}" <-- so may be all gets garbage collected..

Thanking you.

Mushraf Khan wrote:GoodDay Everyone,

Anyone please who could help me to clear this doubt. I have read that objects passed to the method cannot be garbage collected inside the method, because this was not the place they were created. This program is crude, just listed the above concept in program. Is this right.

In method tt() , k is made null, means can be garbage collected, also when the method is executed all objects created are lost, unless the reference is passed. So based on the above, n is not garbage collected, as it was just passed to the method, and was created outside the method.

public class NewMain58 {

public void tt(NewMain58 k){ k = null;}

public static void main(String[] args) {
NewMain58 n = new NewMain58();;



hello Mushraf Khan,

as saahil gupta said when it will return to main method it gets GC (garbage Collected) yes...there is one more point is , Object('s) get garbage collected when it's scope gets finished means "{ }" this bracket..

(may be m right )

Thanking you.
hey all,

yesterday while in interview i faced some Questioned

1] "What is implicit and explicit interface" and its example??

2] in one line tell me definition of "Collection Frameworks" and in Industry is it frequently used or only sometimes they use?? and where they used it(any example of application of it)??

Thanking you.
11 years ago

O. Ziggy wrote:

Amey Ambulgekar wrote:

O. Ziggy wrote:

Why is the above not allowed? Ball implements Bouncable (Ball IS-A Bouncable) so i thought i should have been able to pass it a Bouncable reference.


hello O.Ziggy,

about your program i run on eclipse or even i run through notepad it is not giving me any error it works fine

well check my code if you found any error then tell me ::

interface SampleInterface{


class ClassImpl implements SampleInterface {


public class InterfaceDemo {

public static void main(String[] args) {

SampleInterface si = new ClassImpl();
fun(si);//<-- your error was here right?


public static void fun(SampleInterface si1){



Thanking you.

no it is not the same.. i am passing a Bounceable to a Ball. You are passing a SampleInterface to a SampleInterface so in your case there is no conflict..

hello O.Ziggy,

i am sorry i did not notice am doing mapping or we can say passing SampleInterface reference to SampleInterface it self you were right

any way we can not do this means passing interface reference to class which implements that interface , so we need here explicit casting that is down casting as Sebanti Sanyal said ...

Thanking you.

(how i forgot that i am passing interface reference to it self... i did not even notice )