Re: Unknown Error From JSON-Plugin

2018-01-02 Thread sreekanth
I have a view page for displaying some already persisted data, this page most
of the time loads without any error (with the same set of data) and rarely
throws the exception which i have shared here. 75% time i've experienced
this exception when there is class reload happens (as a part of hot
deployment)



--
Sent from: http://struts.1045723.n5.nabble.com/Struts-User-f3426046.html

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



Re: Unknown Error From JSON-Plugin

2018-01-02 Thread Yasser Zamani


On 1/3/2018 9:58 AM, Yasser Zamani wrote:
> 
> 
> On 1/2/2018 10:31 PM, Yasser Zamani wrote:
>>
>>
>> On 1/2/2018 9:26 PM, Yasser Zamani wrote:
>>> Illegal field modifiers in class
>>> org/apache/struts2/json/JSONWriter: 0xA
>>
>> I'm confused :( 0xA means `JVM_ACC_PRIVATE | JVM_ACC_STATIC` but the
>> fields in an interface are implicitly public static final i.e.
>> org/apache/struts2/json/JSONWriter.ENUM_AS_BEAN_DEFAULT implicitly is
>> public static final. I have no idea while your compiler sees it as
>> private static!
> 
> and I see you say it happens rarely; This makes it even more confusing :S

May I know what did you mean by `rarely`? You have some json actions 
which being called rarely but always fail when called? Or when a 
specific json action being called, a few of calls fail rarely?


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


Re: Unknown Error From JSON-Plugin

2018-01-02 Thread sreekanth
That's why i have given the title as Unknow error , the one possible cause i
can think of is, i experienced mostly when i'm doing hot deployment to some
service classes (but that class is nowhere referenced in the struts2 Action
class )




--
Sent from: http://struts.1045723.n5.nabble.com/Struts-User-f3426046.html

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


From user-return-218744-archive=jab@struts.apache.org Tue Jan 02 22:51:07 
2018
Return-path: 

Re: Instancia the bean

2018-01-02 Thread Lukasz Lenart
2018-01-03 7:23 GMT+01:00 Yasser Zamani :
> On 1/3/2018 1:08 AM, José Antonio Delgado Trujillo wrote:
>> If you have a form linked to a bean using key attribute, then when you 
>> submitted, must you instantiate the bean before the call action populate the 
>> properties? Or Strust2 instantiate automatically after you call the action.
>
> You must instantiate bean like below 

Nope, you do not have to, Struts/OGNL will do it for you

https://struts.apache.org/core-developers/type-conversion.html#null-property-handling


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Re: Unknown Error From JSON-Plugin

2018-01-02 Thread Yasser Zamani


On 1/2/2018 10:31 PM, Yasser Zamani wrote:
> 
> 
> On 1/2/2018 9:26 PM, Yasser Zamani wrote:
>> Illegal field modifiers in class
>> org/apache/struts2/json/JSONWriter: 0xA
> 
> I'm confused :( 0xA means `JVM_ACC_PRIVATE | JVM_ACC_STATIC` but the
> fields in an interface are implicitly public static final i.e.
> org/apache/struts2/json/JSONWriter.ENUM_AS_BEAN_DEFAULT implicitly is
> public static final. I have no idea while your compiler sees it as
> private static!

and I see you say it happens rarely; This makes it even more confusing :S



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


Re: Instancia the bean

2018-01-02 Thread Yasser Zamani


On 1/3/2018 1:08 AM, José Antonio Delgado Trujillo wrote:
> If you have a form linked to a bean using key attribute, then when you 
> submitted, must you instantiate the bean before the call action populate the 
> properties? Or Strust2 instantiate automatically after you call the action.

You must instantiate bean like below 

> 
> 
>   
> 
> 
> //The method execute of the A class action
> 
> public class A extends AcctionSupport{
>  private Object bean;

private Object bean = new ...; //because for "bean.t" Struts calls 
getBean().getT() on get and getBean().setT() on post.


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


Re: Instancia the bean

2018-01-02 Thread Lukasz Lenart
2018-01-02 22:38 GMT+01:00 José Antonio Delgado Trujillo :
> If you have a form linked to a bean using key attribute, then when you 
> submitted, must you instantiate the bean before the call action populate the 
> properties? Or Strust2 instantiate automatically after you call the action.
>
> 
> 
> 
>
> //The method execute of the A class action
>
> public class A extends AcctionSupport{
> private Object bean;
>
> public String void execute(){
> //Call business logic method
> control(bean);
> return SUCCESS;
> }
> }
>
> This throws a NullpointerException???

Do you have a setter and getter setBean/getBean ?
Does the bean have a default contructor?
And I assume the type is not Object as Object doesn't have a property "t"


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Re: Populate nested properties

2018-01-02 Thread Yasser Zamani


On 1/3/2018 1:30 AM, José Antonio Delgado Trujillo wrote:
> Suppose that i have a nested Bean in a model class.
> 
> 
> public Class Bean_B{
> private String text;
> private int number;
> ...
> }
> 
> public Class Bean_A{
>   private Bean_B beanB;
> ...
> }
> 
> A form
> 
> 
> 
> 
>   …
> 
> 
> When i submit the form the action class populate the nested properties text 
> and number?

If your action has getBeanA() method and your Bean_A class has 
getBeanB() method and your Bean_B class has setText() and setNumber() 
method then yes, it should be able to populate them, isn't it?


Re: exclude params submit

2018-01-02 Thread Yasser Zamani


On 1/2/2018 10:38 PM, José Antonio Delgado Trujillo wrote:
> So  produces the next error:
> 18:27:10,990 ERROR [stderr] (default task-9) Unexpected Exception caught 
> setting 'submit' on 'class uoc.jdelgadot.loginstruts.action.Login: Error 
> setting expression 'submit' with value ['Acceder', ]

When there is no setter for given parameter name, a warning message like 
above will be logged in devMode. Thus is expected behaviour to allow 
developer to spot missing setter or typo in either parameter name or 
setter. You can simply ignore this one and if all such warning logs were 
ok, set struts.devMode to false to disable this message when you deploy 
to production.

Hope this helps.


Re: Instancia the bean

2018-01-02 Thread José Antonio Delgado Trujillo
I think Strus2 don’t instantiate the bean so you must instantiate perhaps in 
the prepare method or in the definition of the property class.

> On 2 Jan 2018, at 21:38, José Antonio Delgado Trujillo  
> wrote:
> 
> If you have a form linked to a bean using key attribute, then when you 
> submitted, must you instantiate the bean before the call action populate the 
> properties? Or Strust2 instantiate automatically after you call the action.
> 
> 
>   
> 
> 
> //The method execute of the A class action
> 
> public class A extends AcctionSupport{
> private Object bean;
> 
> public String void execute(){
> //Call business logic method
> control(bean);
>   return SUCCESS;
> }
> }
> 
> This throws a NullpointerException???
> 
> 
> 
> Un saludo,
> José A.
> 



Populate nested properties

2018-01-02 Thread José Antonio Delgado Trujillo
Suppose that i have a nested Bean in a model class.


public Class Bean_B{
   private String text;
   private int number;
...
}

public Class Bean_A{
private Bean_B beanB;
...
}

A form 


   
   
…
   

When i submit the form the action class populate the nested properties text and 
number?





Un saludo,
José A.



Instancia the bean

2018-01-02 Thread José Antonio Delgado Trujillo
If you have a form linked to a bean using key attribute, then when you 
submitted, must you instantiate the bean before the call action populate the 
properties? Or Strust2 instantiate automatically after you call the action.





//The method execute of the A class action

public class A extends AcctionSupport{
private Object bean;

public String void execute(){
//Call business logic method
control(bean);
return SUCCESS;
}
}

This throws a NullpointerException???



Un saludo,
José A.



exclude params submit

2018-01-02 Thread José Antonio Delgado Trujillo
I have a form with several tags using the attribute key.

As it is said in getting started / message resource file
Key is used to substitute tag’s value and label attributes.

For example: 

To put the tag label Struts2 look for property file.
To put the tag value Struts2 look for setName of a bean person instantiated by 
the action class.

So  produces the next error:
18:27:10,990 ERROR [stderr] (default task-9) Unexpected Exception caught 
setting 'submit' on 'class uoc.jdelgadot.loginstruts.action.Login: Error 
setting expression 'submit' with value ['Acceder', ]

To avoid this in getting started / elude params say to configure a new stack 
filter with exclude params.


I have the next Form
——





——


This is my properties file
—
credentialBean.user=Usuario
credentialBean.pass=Contraseña
submit=Acceder

—

This is my trusts.xml configuration
—





dojo..*,^struts..*,^session..*,^request..*,^application..*,^servlet(Request|Response)..*,parameters...*,submit






...
—

Still i’ve got submit error.
What am i doing wrong?


Un saludo,
José A.



Re: Unknown Error From JSON-Plugin

2018-01-02 Thread Yasser Zamani


On 1/2/2018 9:26 PM, Yasser Zamani wrote:
> Illegal field modifiers in class
> org/apache/struts2/json/JSONWriter: 0xA

I'm confused :( 0xA means `JVM_ACC_PRIVATE | JVM_ACC_STATIC` but the 
fields in an interface are implicitly public static final i.e. 
org/apache/struts2/json/JSONWriter.ENUM_AS_BEAN_DEFAULT implicitly is 
public static final. I have no idea while your compiler sees it as 
private static!


Re: Unknown Error From JSON-Plugin

2018-01-02 Thread sreekanth
I'm already using the latest of JDK 8 :- jdk1.8.0_152 (Linux)



--
Sent from: http://struts.1045723.n5.nabble.com/Struts-User-f3426046.html

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



Re: Unknown Error From JSON-Plugin

2018-01-02 Thread Yasser Zamani


On 1/2/2018 8:36 PM, sreekanth wrote:
> Caused by: java.lang.ClassFormatError: Failed to link
> org/apache/struts2/json/DefaultJSONWriter (Module "deployment.my-app.ear"
> from Service Module Loader): Failed to link
> org/apache/struts2/json/JSONWriter (Module "deployment.my-app.ear" from
> Service Module Loader): Illegal field modifiers in class
> org/apache/struts2/json/JSONWriter: 0xA

It seems a jdk bug according to [1]. Could you try an update and see if 
disappears.

[1] https://bugs.openjdk.java.net/browse/JDK-8025141


Unknown Error From JSON-Plugin

2018-01-02 Thread sreekanth
Hi,
I'm using struts2-2.5.14.1 in my EAR deployed in wildfly server, rarely
we are getting the following error when i'm accessing struts2 page. 

Caused by: Unable to load configuration. - bean -
vfs:/content/my-app.ear/lib/struts2-json-plugin-2.5.14.1.jar/struts-plugin.xml:28:30
at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
at
org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:957)
at
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:463)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496)
... 107 more
Caused by: Unable to load bean: type:org.apache.struts2.json.JSONWriter
class:org.apache.struts2.json.DefaultJSONWriter - bean -
vfs:/content/my-app.ear/lib/struts2-json-plugin-2.5.14.1.jar/struts-plugin.xml:28:30
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:274)
at
org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:95)
at
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:167)
at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
... 110 more
Caused by: java.lang.ClassFormatError: Failed to link
org/apache/struts2/json/DefaultJSONWriter (Module "deployment.my-app.ear"
from Service Module Loader): Failed to link
org/apache/struts2/json/JSONWriter (Module "deployment.my-app.ear" from
Service Module Loader): Illegal field modifiers in class
org/apache/struts2/json/JSONWriter: 0xA
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.__newInstance(DelegatingConstructorAccessorImpl.java:45)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at
org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at
org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at
org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77)
at org.jboss.modules.Module.loadModuleClass(Module.java:713)
at
org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
at
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at
com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:171)
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:247)



--
Sent from: http://struts.1045723.n5.nabble.com/Struts-User-f3426046.html

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