当前位置: 首页 > 知识库问答 >
问题:

java.lang.NoClassDefFoundError后部署. war项目

卫沈义
2023-03-14

我在netbean中创建了一个maven web项目,当我在IDE中启动它时,它运行良好,但是当我在glass乐于服务器中部署这个项目时,我有一个错误。部署创建战争文件,并使用此命令

$ sudo asadmin deploy myproject.war

这和我得到的错误

    {loginBean.doLogin}: java.lang.NoClassDefFoundError: Could not initialize class br.com.lsitec.dao.util.HibernateUtility
javax.faces.FacesException: #{loginBean.doLogin}: java.lang.NoClassDefFoundError: Could not initialize class br.com.lsitec.dao.util.HibernateUtility
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
    at javax.faces.component.UICommand.broadcast(UICommand.java:315)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:745)
Caused by: javax.faces.el.EvaluationException: java.lang.NoClassDefFoundError: Could not initialize class br.com.lsitec.dao.util.HibernateUtility
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    ... 34 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class br.com.lsitec.dao.util.HibernateUtility
    at br.com.lsitec.dao.impl.GenericDaoImpl.listByQuery(GenericDaoImpl.java:68)
    at br.com.lsitec.controller.impl.UserControllerImpl.getUsersByFilter(UserControllerImpl.java:108)
    at br.com.lsitec.business.impl.UserBusinessImpl.getUsersByFilter(UserBusinessImpl.java:82)
    at br.com.lsitec.managedbean.LoginBean.doLogin(LoginBean.java:83)
    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 com.sun.el.parser.AstValue.invoke(AstValue.java:275)
    at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
    at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
    at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
    ... 35 more

共有1个答案

危钱明
2023-03-14

这就是由于找不到类或找不到相应的 LIB 而获得的异常。确保所有必需的 JAR 文件都存在于 WAR 文件下。否则,重新导入所有 LIB 文件并重新创建 WAR 文件并尝试部署。

 类似资料:
  • 我正试图将一个。war项目部署到我的tomcat7安装中。 我使用的是Ubuntu12.04和Tomcat7。

  • 我使用的是Tomcat7.0.20和Grails1.3.7,在部署war文件时,我遇到了这个错误。 AM org.apache.Catalina.startup.hostconfig deployWAR信息:部署web应用程序存档ih-core.war 2013年2月25日1:55:35AM org.apache.Catalina.core.containerbase AddChildinal严重

  • 我正在使用Java和Tomcat开发一个API项目。星期五一切都很好,但今天我不能在服务器上部署战争。下面是Tomcat中的堆栈错误: 以下是日志中的错误:

  • 我已经在archlinux上安装了tomcat,我尝试了tomcat7和Tomcat8。根据包括官方文档在内的多个来源,部署WAR文件就像将其放入webapps文件夹(在我的示例中是/var/lib/tomcat7/webapps)一样容易。WAR文件被分解。但我不知道如何访问我的web应用程序。在localhost:8080上有一个tomcat网页。我还尝试了localhost:8080/nam

  • 我有Jboss 7.1.1。最终安装,我正在尝试部署独立/部署中的war。同一场战争的部署在我同事的电脑上可以,但在我的电脑上失败了。 任何想法都好!这是我的网站。xml:http://textuploader.com/1oam.以下是日志(完整日志:http://textuploader.com/1oaq): 谢谢 菲利普 ------------------编辑 我找到了解决方案,我在独立/部

  • 问题内容: 我想将Spring Boot应用程序部署到Tomcat,因为我想部署到AWS。我创建了一个WAR文件,但是即使它可见,它似乎也不能在Tomcat上运行。 详细信息: 0。这是我的应用程序: 具有以下内容: 阅读了许多页面和问题后,我在POM中添加了以下内容: http://maven.apache.org/xsd/maven-4.0.0.xsd“> 4.0.0 我运行了“ mvn软件包