`
lu20091563
  • 浏览: 9096 次
社区版块
存档分类
最新评论
阅读更多
org.apache.commons.logging.LogConfigurationException: java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor8 cannot access its superclass sun.reflect.ConstructorAccessorImpl (Caused by java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor8 cannot access its superclass sun.reflect.ConstructorAccessorImpl)

jetty启动报错,tomcat启动正常,jetty启动报错如下

 

[bj][ERROR] [2015-03-11 16:41:59] org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:308) - Context initialization failed
org.apache.commons.logging.LogConfigurationException: java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor8 cannot access its superclass sun.reflect.ConstructorAccessorImpl (Caused by java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor8 cannot access its superclass sun.reflect.ConstructorAccessorImpl)
	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:571)
	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:292)
	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:269)
	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
	at org.springframework.core.env.PropertySource.<init>(PropertySource.java:58)
	at org.springframework.core.env.EnumerablePropertySource.<init>(EnumerablePropertySource.java:53)
	at org.springframework.web.context.support.ServletContextPropertySource.<init>(ServletContextPropertySource.java:35)
	at org.springframework.web.context.support.WebApplicationContextUtils.initServletPropertySources(WebApplicationContextUtils.java:257)
	at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.initPropertySources(AbstractRefreshableWebApplicationContext.java:189)
	at org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:499)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:433)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
	at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
	at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
	at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1272)
	at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
	at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:489)
	at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
	at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
	at org.mortbay.jetty.Server.doStart(Server.java:224)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
	at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:441)
	at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383)
	at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
	at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
Caused by: java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor8 cannot access its superclass sun.reflect.ConstructorAccessorImpl
	at sun.misc.Unsafe.defineClass(Native Method)
	at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)
	at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:399)
	at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:396)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:395)
	at sun.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:94)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:48)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:545)
	... 55 more
[ERROR] Failed startup of context org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@1623c34c{/,E:\workspace\datamng\src\main\webapp}
org.apache.commons.logging.LogConfigurationException: java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor8 cannot access its superclass sun.reflect.ConstructorAccessorImpl (Caused by java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor8 cannot access its superclass sun.reflect.ConstructorAccessorImpl)
	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:571)
	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:292)
	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:269)
	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
	at org.springframework.core.env.PropertySource.<init>(PropertySource.java:58)
	at org.springframework.core.env.EnumerablePropertySource.<init>(EnumerablePropertySource.java:53)
	at org.springframework.web.context.support.ServletContextPropertySource.<init>(ServletContextPropertySource.java:35)
	at org.springframework.web.context.support.WebApplicationContextUtils.initServletPropertySources(WebApplicationContextUtils.java:257)
	at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.initPropertySources(AbstractRefreshableWebApplicationContext.java:189)
	at org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:499)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:433)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
	at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
	at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
	at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1272)
	at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
	at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:489)
	at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
	at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
	at org.mortbay.jetty.Server.doStart(Server.java:224)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
	at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:441)
	at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383)
	at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
	at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
Caused by: java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor8 cannot access its superclass sun.reflect.ConstructorAccessorImpl
	at sun.misc.Unsafe.defineClass(Native Method)
	at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)
	at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:399)
	at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:396)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:395)
	at sun.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:94)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:48)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:545)
	... 55 more

 

找了好久,才找到解决方案!参考http://stackoverflow.com/questions/8512207/jetty-guice-illegalaccesserror

 

maven中pom.xml中引入配置文件:

<plugin>
			<groupId>org.mortbay.jetty</groupId>
			<artifactId>maven-jetty-plugin</artifactId>
			<version>6.1.25</version>
			<configuration>
				<webAppSourceDirectory>src/main/webapp</webAppSourceDirectory>
				<!-- <scanIntervalSeconds>3</scanIntervalSeconds> -->
				<contextPath>/</contextPath>
				<jettyEnvXml>${basedir}/src/main/resources/jetty-env.xml</jettyEnvXml>
				<connectors>
					<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
						<port>80</port>
					</connector>
				</connectors>
			</configuration>
		</plugin>

  接着在jetty-env.xml加入  <Set name="parentLoaderPriority">true</Set> 这句关键语句

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
    <Set name="parentLoaderPriority">true</Set>
    <New id="DB" class="org.mortbay.jetty.plus.naming.Resource">
         <Arg>java:/comp/env/jdbc/DB</Arg> 
        <Arg>
            <New class="org.apache.commons.dbcp.BasicDataSource">
                <Set name="driverClassName">com.mysql.jdbc.Driver</Set>
                <Set name="url">jdbc:mysql://192.168.1.204:3306/dTicket?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8</Set>
                <Set name="username">web</Set>
                <Set name="password">123456</Set>
                <Set name="maxActive">20</Set>
            </New>
        </Arg>
    </New>
    <New id="Read" class="org.mortbay.jetty.plus.naming.Resource">
        <Arg>java:/comp/env/jdbc/DBRead</Arg>
        <Arg>
            <New class="org.apache.commons.dbcp.BasicDataSource">
                <Set name="driverClassName">com.mysql.jdbc.Driver</Set>
                <Set name="url">jdbc:mysql://192.168.1.204:3306/dTicket?autoReconnect=true&amp;zeroDateTimeBehavior=convertToNull</Set>
                <Set name="username">web</Set>
                <Set name="password">123456</Set>
                <Set name="maxActive">20</Set>
            </New>
        </Arg>
    </New>
    
</Configure>

 这样jetty下就能顺利启动项目成功!

 

分享到:
评论

相关推荐

    ExtJS Jetty启动报错 tag

    此问题涉及到的是一个基于Jetty服务器的ExtJS应用,在尝试启动时遇到了`JasperException`,这通常与JSP(Java Server Pages)的编译和解析有关。下面将详细解释这个问题及其解决方案。 首先,`JasperException`是...

    实战 Jetty--让你快速速学会jetty

    此外,Jetty的轻量化使得将其嵌入到Java应用程序中变得异常简单,只需少量代码即可实现。 在可扩展性方面,Jetty针对高并发和长时间连接的Web 2.0应用进行了优化。它利用Continuation机制有效地处理大量用户请求和...

    eclipsejetty 3.8.0 eclipse的jetty8插件 离线安装包

    蛋疼2&gt;启动报一些ClassNotFoundException之类奇怪的异常,具体和你的项目相关。解决方法:去到菜单Run-&gt;Debug Configurations ...-&gt;双击Jetty Webapps下你的项目-&gt;Dependencies-&gt;把WithoutScope去掉 提醒1&gt;记得给你...

    Run-Jetty 插件 离线安装

    同时,可以在菜单栏找到相关的Jetty启动和管理选项,证明插件已经可以正常使用。 4. **使用Run-Jetty插件** - **创建Jetty运行配置**:在IDE中,通过Run-Jetty插件,你可以创建一个新的Jetty服务器配置,指定项目...

    osgi-jetty-9.3.10环境配置-注册Servlet工程示例

    安装并启动OSGi容器后,我们需要添加Jetty的OSGi兼容版本。这通常意味着我们需要找到支持OSGi的Jetty 9.3.10的bundle,例如`org.eclipse.jetty.osgi.boot`,并将其导入到OSGi环境中。 接下来,创建一个简单的...

    jetty 整合spring+mybatis

    接着,创建一个启动类,通过Jetty的Server对象启动并配置监听端口。 2. **配置Spring**:在Spring的配置文件(如`applicationContext.xml`)中,定义数据源、SqlSessionFactoryBean以及MyBatis的Mapper扫描器。数据...

    jetty实施手册

    同时,手册还列举了实施过程中可能遇到的问题,如classloader系列问题和其他异常情况的解决方案,这对于顺利推进项目实施至关重要。 通过上述对“jetty实施手册”的深入解析,我们可以看到,无论是技术选型、配置...

    dwr+maven+jetty

    与Tomcat等其他Servlet容器相比,Jetty启动更快,内存占用更少。 在"描述"中提到的链接指向了一个CSDN博客文章,该文章可能详细介绍了如何结合这三个工具来建立一个Web应用。通常,这个过程可能包括以下步骤: - ...

    org.apache.jasper.JasperException: Template /template/ajax/text.ftl not found

    org.apache.jasper.JasperException: Template /template/ajax/text.ftl not found异常解决包

    UI自动化的

    - 如果Jetty启动后立即退出,可能是因为启动参数错误、日志文件满或者服务器遇到了致命错误。检查服务器日志以获取更详细的错误信息。 对于UI自动化测试,确保环境的稳定性和兼容性至关重要。同时,理解并熟练掌握...

    JettyJerseyWeldExample:一个示例项目,用于帮助解决 JavaSE 中 DeltaSpikeWeld 与 Jetty 和 Jersey 的问题

    **启动顺序**:由于Jetty、Jersey和Weld都有自己的初始化流程,正确配置它们的启动顺序至关重要,以确保依赖注入系统能够在服务启动前正确设置。\n\n2. **注解扫描**:Jersey需要扫描应用程序上下文以找到REST资源...

    本机服务自动监控服务自动重启

    用户可以选择修改源代码,添加报警功能,例如发送邮件通知、日志记录或显示警告对话框,以便及时发现并解决潜在问题。 七、源代码自定义 源代码开放性是该项目的一个亮点。用户可以根据自己的需求进行定制,比如...

    springboot-mybatis搭建

    它通过自动配置、起步依赖和内嵌Web服务器(如Tomcat或Jetty)等特性,使得创建独立的、生产级别的基于Spring的应用变得容易。 2. **MyBatis简介** MyBatis是一个轻量级的ORM(对象关系映射)框架,它允许开发者用...

    服务器升级故障及其解决方法

    服务器升级故障及其解决方法 服务器升级是指对服务器的硬件或软件进行升级,以满足不断增长的业务需求和性能要求。服务器升级可以分为在线升级和离线升级两种方式。在线升级是在系统不关机的情况下,升级某一部件,...

    jsp项目运行实践教程

    在实践中,你可能会遇到各种问题,如编译错误、运行时异常或配置问题,这些问题都需要通过阅读错误日志、检查配置文件和理解JSP生命周期来解决。同时,了解Servlet、JSTL、EL等与JSP相关的技术也会对项目的理解和...

    Dubbo监控中心的介绍与简易监控中心的安装

    - **异常调用统计**:记录服务调用过程中出现的异常情况。 - **服务列表展示**:列出当前系统中的所有服务及其状态。 - **依赖关系图**:以图形化方式展现服务之间的依赖关系。 通过这些功能,运维人员可以更加直观...

    互联网高频Java后端面试题20道(适合1~3年)V1.0.63.docx

    2. 内嵌服务器:Spring Boot 支持内嵌 Tomcat、Jetty 或 Undertow 等 Web 服务器,开发者可以直接运行 jar 包,无需额外部署到外部服务器。 3. 自动配置:Spring Boot 根据项目中的依赖自动配置 Bean,减少了大量...

    基于maven springmvc管理系统(整合版)。

    相比其他如Tomcat这样的服务器,Jetty在某些场景下可能具有更快的启动速度和更低的内存占用。 结合这些标签,我们可以推断这个管理系统是用Java开发的,使用SpringMVC作为Web层的架构,Maven作为项目管理和构建工具...

    E-Mobile2.1常见问题排查文档.pdf

    在Linux环境下,如果不确定系统是否已安装Java环境或者Java环境是否符合要求,可以通过在命令前加入JDK路径的方式来指定Java环境,例如进入到e-mobile的jetty目录后,通过指定JDK路径运行命令。 在设置e-cology系统...

Global site tag (gtag.js) - Google Analytics