You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sreekanth <sr...@egovernments.org> on 2018/01/02 17:06:58 UTC

Unknown Error From JSON-Plugin

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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Unknown Error From JSON-Plugin

Posted by "john@rodaxsoft.com" <jo...@rodaxsoft.com>.
Could you share the code of the offending class/interface? Also, is the deployed code being compiled on a Java version that <= to server’s Java version?

> On Jan 2, 2018, at 9:06 AM, sreekanth <sr...@egovernments.org> wrote:
> 
> 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-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: Unknown Error From JSON-Plugin

Posted by sreekanth <sr...@egovernments.org>.
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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Unknown Error From JSON-Plugin

Posted by Yasser Zamani <ya...@apache.org>.

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

Re: Unknown Error From JSON-Plugin

Posted by Yasser Zamani <ya...@apache.org>.

On 1/3/2018 10:47 AM, sreekanth wrote:
> 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)

OK, let's see what news here and finish it :)

Could you please add following conf to your current conf ...


package me.zamani.yasser.ww_convention.actions;

import org.apache.struts2.json.JSONWriter;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

public class ReflectionAction {
     private String result;
     public String getResult() {
         return result;
     }
     public String execute(){
         try {
             Field f = 
JSONWriter.class.getDeclaredField("ENUM_AS_BEAN_DEFAULT");
             result = Modifier.toString(f.getModifiers());
         } catch (NoSuchFieldException e) {
             result = e.getMessage();
         }
         return "success";
     }
}


<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
     <title>hello</title>
     <s:head />
</head>

<body>
<h1><s:property value="result"/></h1>
</body>
</html>


<action name="reflection" 
class="me.zamani.yasser.ww_convention.actions.ReflectionAction">
	<result name="success">WEB-INF/content/reflection-success.jsp</result>
</action>

Then when this issue occurred, browse 
http://yourIp:yourPort/yourContextPath/reflection and tell me what you 
see, please?



Re: Unknown Error From JSON-Plugin

Posted by sreekanth <sr...@egovernments.org>.
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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Unknown Error From JSON-Plugin

Posted by sreekanth <sr...@egovernments.org>.
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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Unknown Error From JSON-Plugin

Posted by Yasser Zamani <ya...@apache.org>.

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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

Re: Unknown Error From JSON-Plugin

Posted by Yasser Zamani <ya...@apache.org>.

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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

Re: Unknown Error From JSON-Plugin

Posted by Yasser Zamani <ya...@apache.org>.

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!