1

一些背景知识:我们的主要目标是在 SmartGWT 中与 Maven 集成简化开发环境,以便能够测试一些组件并验证我们是否可以在我们的软件中使用它们。

我设置了环境,并更新了 Maven 依赖项,但是当我将应用程序部署到 Glassfish 服务器时,会引发异常。

TL;DR:为了部署应用程序,我运行了这个目标clean compile gwt:compile war:war,之后,我尝试在 Glassfish 中部署项目(使用“添加/删除”)但它失败并抛出了下面的异常

[2021-03-16T17:07:59.614-0500] [glassfish 4.1] [SEVERE] [AS-WEB-CORE-00108] [javax.enterprise.web.core] [tid: _ThreadID=221 _ThreadName=admin-listener(6)] [timeMillis: 1615932479614] [levelValue: 1000] [[
    ContainerBase.addChild: start:
    org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: com.isomorphic.base.InitListener
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5898)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:691)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:1024)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2286)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1932)
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:139)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
    at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
    at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: com.isomorphic.base.InitListener
    at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:3302)
    at org.apache.catalina.core.StandardContext.addApplicationListener(StandardContext.java:2508)
    at com.sun.enterprise.web.TomcatDeploymentConfig.configureApplicationListener(TomcatDeploymentConfig.java:251)
    at com.sun.enterprise.web.TomcatDeploymentConfig.configureWebModule(TomcatDeploymentConfig.java:110)
    at com.sun.enterprise.web.WebModuleContextConfig.start(WebModuleContextConfig.java:264)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:486)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:163)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5895)
    ... 49 more
Caused by: java.lang.ClassNotFoundException: com.isomorphic.base.InitListener
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1783)
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1633)
    at org.apache.catalina.core.StandardContext.loadListener(StandardContext.java:5446)
    at com.sun.enterprise.web.WebModule.loadListener(WebModule.java:1788)
    at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:3300)
    ... 56 more
]] 

我已经尝试了一些与此异常相关的解决方案,但没有一个对我有用。

  1. 我正在与:

    • SmartGWT 6.0 专业版 (6.0-p20170526)
    • 基于内置 ds 示例的项目(来自 SGWT)
    • JDK 1.8.0_241
    • GWT 库 2.8.1
    • Eclipse 2020-03 (4.15.0) 内部版本号:20200313-1211
    • 玻璃鱼 4.1
    • 阿帕奇 Maven 3.6.3
  2. 这是我使用的 pom.xml 配置:

     <?xml version="1.0" encoding="UTF-8"?>
     <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    
     <modelVersion>4.0.0</modelVersion>
     <groupId>co.focuss</groupId>
     <artifactId>SamplesSGWT</artifactId>
     <packaging>war</packaging>
     <version>0.0.1-SNAPSHOT</version>
     <name>SamplesSGWT</name>
    
     <properties>
    
         <!-- Explictly specify a default encoding to avoid relying on the OS locale. -->
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    
         <!-- Artifact versions -->
         <gwt.version>2.8.0</gwt.version>
         <smartgwt.version>6.0-p20170526</smartgwt.version>
         <asm.version>5.0.3</asm.version>
         <dbcp.version>1.4</dbcp.version>
         <sqlserver.version>4.2</sqlserver.version>
         <servlet.api.version>3.0.1</servlet.api.version>
         <jstl.version>1.2</jstl.version>
         <junit.version>4.11</junit.version>
         <slf4j-log4j.version>1.7.12</slf4j-log4j.version>
    
         <!-- Maven GWT compiler version and parameters -->
         <maven.compiler.version>3.3</maven.compiler.version>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
         <compiler.style>OBF</compiler.style>
         <compiler.log.level>INFO</compiler.log.level>
         <glassfish.port>8188</glassfish.port>
    
         <!-- Maven War plugin version and parameters -->
         <war.plugin.version>2.6</war.plugin.version>
    
     </properties>
    
     <dependencies>
    
         <!-- Core: GWT -->
         <dependency>
             <groupId>com.google.gwt</groupId>
             <artifactId>gwt-servlet</artifactId>
             <version>${gwt.version}</version>
             <scope>runtime</scope>
         </dependency>
    
         <dependency>
             <groupId>com.google.gwt</groupId>
             <artifactId>gwt-user</artifactId>
             <version>${gwt.version}</version>
             <scope>provided</scope>
         </dependency>
    
         <!-- Core: SmartGWT -->
         <dependency>
             <groupId>com.isomorphic.smartgwt.pro</groupId>
             <artifactId>smartgwt-pro</artifactId>
             <version>${smartgwt.version}</version>
         </dependency>
    
         <!-- Core: SmartGWT Sql Tools -->
         <dependency>
             <groupId>com.isomorphic.smartgwt.pro</groupId>
             <artifactId>isomorphic-sql</artifactId>
             <version>${smartgwt.version}</version>
         </dependency>
    
         <!-- Additional Dependency: required for proper SmartGWT dev tools compilation -->      
         <dependency>
             <groupId>org.ow2.asm</groupId>
             <artifactId>asm</artifactId>
             <version>${asm.version}</version>
             <scope>compile</scope>
         </dependency>
    
         <!-- Core: SmartGWT Developer Tools -->
         <dependency>
             <groupId>com.isomorphic.smartgwt.pro</groupId>
             <artifactId>isomorphic-tools</artifactId>
             <version>${smartgwt.version}</version>
         </dependency>       
    
         <!-- Additional SmartGWT Dependencies: DBCP2-->
         <dependency>
             <groupId>commons-dbcp</groupId>
             <artifactId>commons-dbcp</artifactId>
             <version>${dbcp.version}</version>
         </dependency>
    
         <!-- SQL Server JDBC Driver -->
         <dependency>
             <groupId>com.microsoft.sqlserver</groupId>
             <artifactId>sqljdbc</artifactId>
             <version>${sqlserver.version}</version>
         </dependency>
    
         <!-- Servlets -->
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
             <version>${servlet.api.version}</version>
         </dependency>
    
         <!-- JSTL for JSP page -->
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>jstl</artifactId>
             <version>${jstl.version}</version>
         </dependency>
    
         <!-- Unit Tests: JUnit -->
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <version>${junit.version}</version>
         </dependency>
    
         <!-- Logging: Slf4j -->
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
             <version>${slf4j-log4j.version}</version>
         </dependency>
    
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
             <version>${slf4j-log4j.version}</version>
         </dependency>
    
     </dependencies>
    
     <build>
    
         <!-- This will produce a war file named SamplesSGWT.war, rather than
             SamplesSGWT-${project.version}.war. -->
         <finalName>SamplesSGWT</finalName>
    
         <!-- Make sure classes output dir matches hosted webapp WEB-INF/classes 
             folder, so GWT Hosted browser can see the classes. -->
         <directory>target</directory>
         <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
    
         <plugins>
    
             <!-- Plugin to compile Java code to JavaScript -->
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>gwt-maven-plugin</artifactId>
                 <version>${gwt.version}</version>
    
                 <executions>
                         <execution>
                             <goals>
                                 <goal>compile</goal>
                                 <goal>generateAsync</goal>
                                 <goal>test</goal>
                             </goals>
                         </execution>
                 </executions>
    
                 <configuration>
    
                         <!-- Compiler parameters -->
                         <extraJvmArgs>-Xss1024K -Xmx1024M</extraJvmArgs>    
                         <draftCompile>true</draftCompile>
                         <debugSuspend>false</debugSuspend>
                         <logLevel>${compiler.log.level}</logLevel>
                         <style>${compiler.style}</style>
    
                         <!-- Launch parameters with external server -->
                         <!-- Add the app to Glassfish embedded server and set the server to
                              publsh automatically after each compile -->
                         <noServer>true</noServer>
                         <runTarget>http://localhost:${glassfish.port}/${project.build.finalName}/${project.build.finalName}.html</runTarget>
    
                         <!-- Build parameters -->
                         <buildOutputDirectory>${project.build.outputDirectory}</buildOutputDirectory>
                         <hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
                         <copyWebapp>true</copyWebapp>
    
                 </configuration>
    
             </plugin>
    
             <!-- Plugin to compile the project. Included here only to specifically
                  define the source and target versions of the project -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <version>${maven.compiler.version}</version>
                 <configuration>
                         <source>${maven.compiler.source}</source>
                         <target>${maven.compiler.target}</target>
                 </configuration>
             </plugin>
    
             <!-- Plugin to package in war file -->
             <plugin>            
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-war-plugin</artifactId>
                 <version>${war.plugin.version}</version>
                 <configuration>
                     <webXml>src/main/webapp/WEB-INF/web.xml</webXml> 
                     <!-- Exclude what you want from the final artifact here -->
                     <!-- <warSourceExcludes>.gwt-tmp/**</warSourceExcludes> -->
                 </configuration>
             </plugin>
    
         </plugins>
     </build>
    

请您帮我找出导致此错误的原因以及如何解决它。

如果您需要其他任何内容来审查此案例,请告诉我。

我提前感谢您提供的所有帮助!

4

0 回答 0