0

I am trying to use wildfly-swarm with a hello world web project (having a single index.html file) already running on glassfish. Here is my 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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
    <artifactId>MongoDBDemo</artifactId>
    <groupId>com.test</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>

    <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.wildfly.swarm</groupId>
            <artifactId>bom</artifactId>
            <version>${version.wildfly.swarm}</version>
            <scope>import</scope>
            <type>pom</type>
          </dependency>
        </dependencies>
    </dependencyManagement>

    <groupId>com.test</groupId>
    <artifactId>MongoDBDemo-web</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>MongoDBDemo-web</name>

    <properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <version.wildfly.swarm>2016.8.1</version.wildfly.swarm>
    </properties>

    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>7.0</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.wildfly.swarm</groupId>
                <artifactId>wildfly-swarm-plugin</artifactId>
                <version>${version.wildfly.swarm}</version>
                <executions>
                  <execution>
                    <goals>
                      <goal>package</goal>
                    </goals>
                  </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

I am having this exception:

2016-09-01 16:37:10,543 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-1) RESTEASY002010: Failed to execute: javax.ws.rs.NotFoundException: RESTEASY003210: Could not find resource for full path: http://localhost:8080/MongoDBDemo-web/index.html
        at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:75)
        at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48)
        at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:445)

I am running it using:

mvn wildfly-swarm:run

I don't know why I can't see any output on my browser, not even exception. Could you please tell me why its assuming index.html as a JAX-RS resource instead of a physical HTML file?

index.html is in src\main\webapp folder

Prakhar Mishra
  • 1,586
  • 4
  • 28
  • 52

1 Answers1

0

By default WildFly Swarm doesn't add a context path to your application.

Have you tried accessing http://localhost:8080/index.html ??

Ken
  • 835
  • 4
  • 11
  • Yup. Tried that already.... Its not working even if I run the ${project.name}-swarm.jar, which contains `index.html` in WAR file inside its `_bootstrap` folder. – Prakhar Mishra Sep 02 '16 at 11:40
  • Can you try with 2016.9 as there were some issues with 2016.8.1 – Ken Sep 13 '16 at 15:15