You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Laurie Harper <la...@holoweb.net> on 2008/04/30 19:56:05 UTC

Re: java.lang.InstantiationException: org.apache.struts.action.ActionForm

Sandy143 wrote:
> Hello Everyone :
> 
> [Servlet Error]-[org.apache.struts.action.ActionForm]:
> java.lang.InstantiationException: org.apache.struts.action.ActionForm
> 
> I get this error when I try to migrate from Struts 1.2.8 to Struts2.
> 
> I have validations to the form. I am using interceptors for the same.
> 
> Please let me know ... if I am missing something or need to add something.

Your question is far too vague. ActionFrom is a Struts1 type; 
interceptors are a Struts2 concept; saying 'I have validations' or 'I am 
using interceptors' tells us nothing about how you have these configured.

Since you seem to be struggling with integrating S1 and S2 in the same 
app, I suggest you go back to basics and create a minimal, empty app 
using S1 and S2 together and use it as a starting point to explore each 
issue you find in isolation. That way you can post complete but concise 
examples of code and configuration that demonstrate the problem.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: java.lang.InstantiationException: org.apache.struts.action.ActionForm

Posted by Sandy143 <sj...@gmail.com>.
Sorry ...

This error is produced when I enter something in jsp and click on a button
...

Thanks,
Sandy

Sandy143 wrote:
> 
> Hi,
> 
> Now I am migrating from struts1 to struts2.
> 
> In struts1 I have a homeAction which extends dispatchAction and it uses
> homeActionForm.
> 
> I have configured it this way in struts.xml:
> 
> <interceptors>
> <interceptor name="homeActionForm"
> 					
> class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor">
> 	
> 		com.XXX.XXX.HomeActionForm
> 	
> 	homeActionForm
> </interceptor>
> <interceptor name="homePage"
> 						class="org.apache.struts2.s1.ActionFormValidationInterceptor">
> 	
> 														/org/apache/struts/validator/validator-rules.xml,
> 		/WEB-INF/validation-rules.xml, /WEB-INF/Validation.xml
> 	
> </interceptor>
> 
> <interceptor-stack name="homeActionForm">
> 	<interceptor-ref name="staticParams" />
> 	<interceptor-ref name="homeActionForm" />
> 	<interceptor-ref name="modelDriven" />
> 	<interceptor-ref name="actionForm-reset" />
> 	<interceptor-ref name="basicStack" />
> 	<interceptor-ref name="homePage" />
> 	<interceptor-ref name="workflow" />
> </interceptor-stack>
> </interceptors>
> 
> <action name="loadPage"
> 	class="org.apache.struts2.s1.Struts1Action">
> 	
> 		com.XXX.XXX.homeAction
> 	
> 	<result name="load" type="tiles">/home.jsp</result>
> </action>
> 
> 
> 
> 
> Laurie Harper wrote:
>> 
>> Sandy143 wrote:
>>> Hello Everyone :
>>> 
>>> [Servlet Error]-[org.apache.struts.action.ActionForm]:
>>> java.lang.InstantiationException: org.apache.struts.action.ActionForm
>>> 
>>> I get this error when I try to migrate from Struts 1.2.8 to Struts2.
>>> 
>>> I have validations to the form. I am using interceptors for the same.
>>> 
>>> Please let me know ... if I am missing something or need to add
>>> something.
>> 
>> Your question is far too vague. ActionFrom is a Struts1 type; 
>> interceptors are a Struts2 concept; saying 'I have validations' or 'I am 
>> using interceptors' tells us nothing about how you have these configured.
>> 
>> Since you seem to be struggling with integrating S1 and S2 in the same 
>> app, I suggest you go back to basics and create a minimal, empty app 
>> using S1 and S2 together and use it as a starting point to explore each 
>> issue you find in isolation. That way you can post complete but concise 
>> examples of code and configuration that demonstrate the problem.
>> 
>> L.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/java.lang.InstantiationException%3A-org.apache.struts.action.ActionForm-tp16986858p16989209.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: java.lang.InstantiationException: org.apache.struts.action.ActionForm

Posted by Dave Newton <ne...@yahoo.com>.
--- Sandy143 <sj...@gmail.com> wrote:
> I have replaced <html:rewrite> with normal href ...
> 
> I am able to view Login.jsp. But when I click on submit ...it throws me
> out.
> 
> Please let me know at your earliest possible

Are you billing by the hour for this?

Seriously, have you seen the last three times where I said that in order to
help we need to see the complete configuration and code necessary to
duplicate the problem? Can you post that on pastebin.com?

Dave

> newton.dave wrote:
> > --- Sandy143 <sj...@gmail.com> wrote:
> >> Let me be clear then ...
> >> 
> >> I am trying to migrate from struts1.2 to struts2.
> > 
> > So you're using the S1 Plugin, correct?
> > 
> > Do you understand you will have to re-write all your JSPs to use Struts 2
> > tags?
> > 
> >> LoginActionForm is extending ValidatorActionForm. I defined an
> >> interceptor
> >> for it in struts.xml. Validation is form based.
> > 
> > You need to send a text-format message (not HTML) with your configuration
> > file or use a service like pastebin.com, as I said before. The latter is
> > preferable; it's nicely highlighted and you can paste all of the relevant
> > code and configs.
> > 
> > Dave
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context:
>
http://www.nabble.com/java.lang.InstantiationException%3A-org.apache.struts.action.ActionForm-tp16986858p16993835.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: java.lang.InstantiationException: org.apache.struts.action.ActionForm

Posted by Sandy143 <sj...@gmail.com>.
Yes ...

I have replaced <html:rewrite> with normal href ...

I am able to view Login.jsp. But when I click on submit ...it throws me out.

Please let me know at your earliest possible


newton.dave wrote:
> 
> --- Sandy143 <sj...@gmail.com> wrote:
>> Let me be clear then ...
>> 
>> I am trying to migrate from struts1.2 to struts2.
> 
> So you're using the S1 Plugin, correct?
> 
> Do you understand you will have to re-write all your JSPs to use Struts 2
> tags?
> 
>> LoginActionForm is extending ValidatorActionForm. I defined an
>> interceptor
>> for it in struts.xml. Validation is form based.
> 
> You need to send a text-format message (not HTML) with your configuration
> file or use a service like pastebin.com, as I said before. The latter is
> preferable; it's nicely highlighted and you can paste all of the relevant
> code and configs.
> 
> Dave
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/java.lang.InstantiationException%3A-org.apache.struts.action.ActionForm-tp16986858p16993835.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: java.lang.InstantiationException: org.apache.struts.action.ActionForm

Posted by Dave Newton <ne...@yahoo.com>.
--- Sandy143 <sj...@gmail.com> wrote:
> Let me be clear then ...
> 
> I am trying to migrate from struts1.2 to struts2.

So you're using the S1 Plugin, correct?

Do you understand you will have to re-write all your JSPs to use Struts 2
tags?

> LoginActionForm is extending ValidatorActionForm. I defined an interceptor
> for it in struts.xml. Validation is form based.

You need to send a text-format message (not HTML) with your configuration
file or use a service like pastebin.com, as I said before. The latter is
preferable; it's nicely highlighted and you can paste all of the relevant
code and configs.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: java.lang.InstantiationException: org.apache.struts.action.ActionForm

Posted by Sandy143 <sj...@gmail.com>.
Let me be clear then ...

I am trying to migrate from struts1.2 to struts2.

I did all the required configuration. I could get the login page.

LoginActionForm is extending ValidatorActionForm. I defined an interceptor
for it in struts.xml. Validation is form based.

BUT when I enter username and password and click submit... it throws me this
error :

[Servlet Error]-[org.apache.struts.action.ActionForm]:
java.lang.InstantiationException: org.apache.struts.action.ActionForm
	at java.lang.Class.newInstanceImpl(Native Method)
	at java.lang.Class.newInstance(Class.java:1263)
	at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:123)
	at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:154)
.....

I have the required jars.... Please let me know how I can take care about
the validations during migration.

Thanks,



-- 
View this message in context: http://www.nabble.com/java.lang.InstantiationException%3A-org.apache.struts.action.ActionForm-tp16986858p16992734.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: java.lang.InstantiationException: org.apache.struts.action.ActionForm

Posted by Dave Newton <ne...@yahoo.com>.
--- Sandy143 <sj...@gmail.com> wrote:
> Now I am migrating from struts1 to struts2.

What were you doing before?

Please note: your configuration files aren't getting to everybody properly
(me, at least), so it's even more difficult to help. Consider configuring
your email client to send text-only messages to the list or using a service
such as pastebin.com. Thanks :)

> <interceptor name="homeActionForm"
> 					
> class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor">
> 	
> 		com.XXX.XXX.HomeActionForm
> 	
> 	homeActionForm
> </interceptor>

I'm not sure what all I'm not seeing here, so I can't really comment.

> <interceptor-stack name="homeActionForm">
> 	<interceptor-ref name="staticParams" />
> 	<interceptor-ref name="homeActionForm" />
> 	<interceptor-ref name="modelDriven" />
> 	<interceptor-ref name="actionForm-reset" />
> 	<interceptor-ref name="basicStack" />
> 	<interceptor-ref name="homePage" />
> 	<interceptor-ref name="workflow" />
> </interceptor-stack>

I would assume that an interceptor-stack can have the same name as an
interceptor-ref, but as a matter of style I wouldn't do it; because it's
confusing.


> <action name="loadPage"
> 	class="org.apache.struts2.s1.Struts1Action">
> 	
> 		com.XXX.XXX.homeAction
> 	
> 	<result name="load" type="tiles">/home.jsp</result>
> </action>

Again, not sure what all we're missing.

Just to be perfectly clear: you are attempting to use the S1 Plugin, so that
your existing S1 actions etc. will be configured only in the Struts *2*
configuration file (there will be *no* Struts 1 configuration file)?

Note: According to the S1 Plugin documentation [1] you *cannot* use the S1
tags in your JSP pages, meaning you are forcing yourself to JSP rewrites.

(The other option is running the two apps more or less indepedently, but
still in the same webapp: no JSP rewrites, no plugin issues.)

Sometimes it's easier to introduce a new framework and any associated costs
(training, learning curve, etc.) on a greenfield project rather than attempt
to shoehorn it into an existing ecosystem.

Dave

[1] http://struts.apache.org/2.x/docs/struts-1-plugin.html

> Laurie Harper wrote:
> > 
> > Sandy143 wrote:
> >> Hello Everyone :
> >> 
> >> [Servlet Error]-[org.apache.struts.action.ActionForm]:
> >> java.lang.InstantiationException: org.apache.struts.action.ActionForm
> >> 
> >> I get this error when I try to migrate from Struts 1.2.8 to Struts2.
> >> 
> >> I have validations to the form. I am using interceptors for the same.
> >> 
> >> Please let me know ... if I am missing something or need to add
> >> something.
> > 
> > Your question is far too vague. ActionFrom is a Struts1 type; 
> > interceptors are a Struts2 concept; saying 'I have validations' or 'I am 
> > using interceptors' tells us nothing about how you have these configured.
> > 
> > Since you seem to be struggling with integrating S1 and S2 in the same 
> > app, I suggest you go back to basics and create a minimal, empty app 
> > using S1 and S2 together and use it as a starting point to explore each 
> > issue you find in isolation. That way you can post complete but concise 
> > examples of code and configuration that demonstrate the problem.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: java.lang.InstantiationException: org.apache.struts.action.ActionForm

Posted by Sandy143 <sj...@gmail.com>.
Hi,

Now I am migrating from struts1 to struts2.

In struts1 I have a homeAction which extends dispatchAction and it uses
homeActionForm.

I have configured it this way in struts.xml:

<interceptors>
<interceptor name="homeActionForm"
					
class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor">
	
		com.XXX.XXX.HomeActionForm
	
	homeActionForm
</interceptor>
<interceptor name="homePage"
						class="org.apache.struts2.s1.ActionFormValidationInterceptor">
	
														/org/apache/struts/validator/validator-rules.xml,
		/WEB-INF/validation-rules.xml, /WEB-INF/Validation.xml
	
</interceptor>

<interceptor-stack name="homeActionForm">
	<interceptor-ref name="staticParams" />
	<interceptor-ref name="homeActionForm" />
	<interceptor-ref name="modelDriven" />
	<interceptor-ref name="actionForm-reset" />
	<interceptor-ref name="basicStack" />
	<interceptor-ref name="homePage" />
	<interceptor-ref name="workflow" />
</interceptor-stack>
</interceptors>

<action name="loadPage"
	class="org.apache.struts2.s1.Struts1Action">
	
		com.XXX.XXX.homeAction
	
	<result name="load" type="tiles">/home.jsp</result>
</action>




Laurie Harper wrote:
> 
> Sandy143 wrote:
>> Hello Everyone :
>> 
>> [Servlet Error]-[org.apache.struts.action.ActionForm]:
>> java.lang.InstantiationException: org.apache.struts.action.ActionForm
>> 
>> I get this error when I try to migrate from Struts 1.2.8 to Struts2.
>> 
>> I have validations to the form. I am using interceptors for the same.
>> 
>> Please let me know ... if I am missing something or need to add
>> something.
> 
> Your question is far too vague. ActionFrom is a Struts1 type; 
> interceptors are a Struts2 concept; saying 'I have validations' or 'I am 
> using interceptors' tells us nothing about how you have these configured.
> 
> Since you seem to be struggling with integrating S1 and S2 in the same 
> app, I suggest you go back to basics and create a minimal, empty app 
> using S1 and S2 together and use it as a starting point to explore each 
> issue you find in isolation. That way you can post complete but concise 
> examples of code and configuration that demonstrate the problem.
> 
> L.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/java.lang.InstantiationException%3A-org.apache.struts.action.ActionForm-tp16986858p16988637.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org