zoukankan      html  css  js  c++  java
  • 异常HTTP Status 500

    Exception report

    message Illegal access to constructor, is it public?

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

    exception

    Illegal access to constructor, is it public?
    	com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:297)
    	com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:393)
    	com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)
    	org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
    	org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
    	com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
    	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:534)
    	org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    	org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    

    root cause

    java.lang.IllegalAccessException: Class com.opensymphony.xwork2.ObjectFactory can not access a member of class action.CoreAction with modifiers ""
    	sun.reflect.Reflection.ensureMemberAccess(Reflection.java:109)
    	java.lang.Class.newInstance(Class.java:368)
    	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:131)
    	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:162)
    	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:151)
    	com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:121)
    	com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:293)
    	com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:393)
    	com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)
    	org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
    	org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
    	com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
    	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:534)
    	org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    	org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    解决办法:有两个办法

    1、原因是 自己的粗心造成的你的javaBean忘记写public关键字了

    解决方法:javaBean类前加上public的修饰符

    2、原因是 Class com.opensymphony.xwork2.ObjectFactory与JavaBean不在同一个包下,java的默认修饰符范围在同一个包下

    解决方法:javaBean的构造方法不写或者加个public的修饰符

  • 相关阅读:
    一文了解网络编程之走进TCP三次握手和HTTP那些你不知道的事
    并发编程面试必备之ConcurrentHashMap源码解析
    java延迟队列DelayQueue及底层优先队列PriorityQueue实现原理源码详解
    聊一聊面试中常问的延时队列
    面试必备HashMap源码解析
    synchronized解锁源码分析
    synchronized的jvm源码加锁流程分析聊锁的意义
    jvm源码解析java对象头
    从ReentrantLock源码入手看锁的实现
    从synchronized和lock区别入手聊聊java锁机制
  • 原文地址:https://www.cnblogs.com/XiDaPuBen/p/8723103.html
Copyright © 2011-2022 走看看