3 Replies Latest reply on Jul 15, 2014 2:01 AM by maxandersen

    Error 404 on Java Servlet Project. Open-Shift

    chase22

      Hey Comunity,

       

      I have written a little Serverlet. At the moment its pretty much empty. But i want to test the rouge code. And simple sites.

      But even this empty project got a problem. Everytime i try to start it with the "run on server" -option it throws an "Error 404, Site not found" Exception.

       

      Here is a picture from the Folder-Structure, the index.html and the Servlet. The reponse.jsp is empty.

      http://puu.sh/a7Y1V.png

       

      <?xml version='1.0' encoding='utf-8'?>
      <Server port="-1" shutdown="SHUTDOWN">
        <!-- Security listener. Documentation at /docs/config/listeners.html
        <Listener className="org.apache.catalina.security.SecurityListener" />
        -->
        <!--APR library loader. Documentation at /docs/apr.html -->
        <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
        <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
        <Listener className="org.apache.catalina.core.JasperListener" />
        <!-- Prevent memory leaks due to use of particular java/javax APIs-->
        <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
        <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
        <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
      
        <!-- Global JNDI resources
             Documentation at /docs/jndi-resources-howto.html
        -->
        <GlobalNamingResources>
          <!-- Editable user database that can also be used by
               UserDatabaseRealm to authenticate users
          -->
          <Resource name="UserDatabase" auth="Container"
                    type="org.apache.catalina.UserDatabase"
                    description="User database that can be updated and saved"
                    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
                    pathname="conf/tomcat-users.xml" />
        </GlobalNamingResources>
      
        <!-- A "Service" is a collection of one or more "Connectors" that share
             a single "Container" Note:  A "Service" is not itself a "Container",
             so you may not define subcomponents such as "Valves" at this level.
             Documentation at /docs/config/service.html
         -->
        <Service name="Catalina">
      
          <!--The connectors can use a shared executor, you can define one or more named thread pools-->
          <!--
          <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
              maxThreads="150" minSpareThreads="4"/>
          -->
      
      
          <!-- A "Connector" represents an endpoint by which requests are received
               and responses are returned. Documentation at :
               Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
               Java AJP  Connector: /docs/config/ajp.html
               APR (HTTP/AJP) Connector: /docs/apr.html
               Define a non-SSL HTTP/1.1 Connector on port 8080
          -->
          <Connector address="${OPENSHIFT_JBOSSEWS_IP}"
                     port="${OPENSHIFT_JBOSSEWS_HTTP_PORT}"
                     protocol="HTTP/1.1"
                     connectionTimeout="20000"
                     redirectPort="8443"/>
      
          <!-- A "Connector" using the shared thread pool-->
          <!--
          <Connector executor="tomcatThreadPool"
                     port="8080" protocol="HTTP/1.1"
                     connectionTimeout="20000"
                     redirectPort="8443" />
          -->
          <!-- Define a SSL HTTP/1.1 Connector on port 8443
               This connector uses the JSSE configuration, when using APR, the
               connector should be using the OpenSSL style configuration
               described in the APR documentation -->
          <!--
          <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
                     maxThreads="150" scheme="https" secure="true"
                     clientAuth="false" sslProtocol="TLS" />
          -->
      
          <!-- Define an AJP 1.3 Connector on port 8009 -->
          <!--Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /-->
      
      
          <!-- An Engine represents the entry point (within Catalina) that processes
               every request.  The Engine implementation for Tomcat stand alone
               analyzes the HTTP headers included with the request, and passes them
               on to the appropriate Host (virtual host).
               Documentation at /docs/config/engine.html -->
      
          <!-- You should set jvmRoute to support load-balancing via AJP ie :
          <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
          -->
          <Engine name="Catalina" defaultHost="localhost">
      
            <!--For clustering, please take a look at documentation at:
                /docs/cluster-howto.html  (simple how to)
                /docs/config/cluster.html (reference documentation) -->
            <!--
            <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
            -->
      
            <!-- Use the LockOutRealm to prevent attempts to guess user passwords
                 via a brute-force attack -->
            <Realm className="org.apache.catalina.realm.LockOutRealm">
              <!-- This Realm uses the UserDatabase configured in the global JNDI
                   resources under the key "UserDatabase".  Any edits
                   that are performed against this UserDatabase are immediately
                   available for use by the Realm.  -->
              <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                     resourceName="UserDatabase"/>
            </Realm>
      
            <Host name="localhost"  appBase="webapps"
                  unpackWARs="false" autoDeploy="true">
      
              <!-- SingleSignOn valve, share authentication between web applications
                   Documentation at: /docs/config/valve.html -->
              <!--
              <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
              -->
      
              <!-- RemoteIp valve, pass protocol header from proxy. -
                  http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/valves/RemoteIpValve.html
              -->
              
              <Valve
                className="org.apache.catalina.valves.RemoteIpValve"
                protocolHeader="x-forwarded-proto"
              />
      
              <!-- Access log processes all example.
                   Documentation at: /docs/config/valve.html
                   Note: The pattern used is equivalent to using pattern="common" -->
              <!--
              <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
                     prefix="localhost_access_log." suffix=".txt"
                     pattern="%h %l %u %t &quot;%r&quot; %s %b" />
              -->
            </Host>
          </Engine>
        </Service>
      </Server>
      

       

      the effective pom

       

      <?xml version="1.0"?>
      <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <modelVersion>4.0.0</modelVersion>
        <groupId>beschweren</groupId>
        <artifactId>beschweren</artifactId>
        <version>1.0</version>
        <packaging>war</packaging>
        <name>beschweren</name>
        <properties>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          <maven.compiler.source>1.6</maven.compiler.source>
          <maven.compiler.target>1.6</maven.compiler.target>
        </properties>
        <dependencies>
          <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.2-1003-jdbc4</version>
            <scope>compile</scope>
          </dependency>
          <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.25</version>
            <scope>compile</scope>
          </dependency>
          <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
          </dependency>
        </dependencies>
        <repositories>
          <repository>
            <releases>
              <enabled>true</enabled>
            </releases>
            <snapshots>
              <enabled>true</enabled>
            </snapshots>
            <id>eap</id>
            <url>http://maven.repository.redhat.com/techpreview/all</url>
          </repository>
          <repository>
            <snapshots>
              <enabled>false</enabled>
            </snapshots>
            <id>central</id>
            <name>Central Repository</name>
            <url>http://repo.maven.apache.org/maven2</url>
          </repository>
        </repositories>
        <pluginRepositories>
          <pluginRepository>
            <releases>
              <enabled>true</enabled>
            </releases>
            <snapshots>
              <enabled>true</enabled>
            </snapshots>
            <id>eap</id>
            <url>http://maven.repository.redhat.com/techpreview/all</url>
          </pluginRepository>
          <pluginRepository>
            <releases>
              <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
              <enabled>false</enabled>
            </snapshots>
            <id>central</id>
            <name>Central Repository</name>
            <url>http://repo.maven.apache.org/maven2</url>
          </pluginRepository>
        </pluginRepositories>
        <build>
          <sourceDirectory>C:\Users\lukas\git\beschweren\src\main\java</sourceDirectory>
          <scriptSourceDirectory>C:\Users\lukas\git\beschweren\src\main\scripts</scriptSourceDirectory>
          <testSourceDirectory>C:\Users\lukas\git\beschweren\src\test\java</testSourceDirectory>
          <outputDirectory>C:\Users\lukas\git\beschweren\target\classes</outputDirectory>
          <testOutputDirectory>C:\Users\lukas\git\beschweren\target\test-classes</testOutputDirectory>
          <resources>
            <resource>
              <directory>C:\Users\lukas\git\beschweren\src\main\resources</directory>
            </resource>
          </resources>
          <testResources>
            <testResource>
              <directory>C:\Users\lukas\git\beschweren\src\test\resources</directory>
            </testResource>
          </testResources>
          <directory>C:\Users\lukas\git\beschweren\target</directory>
          <finalName>beschweren-1.0</finalName>
          <pluginManagement>
            <plugins>
              <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.3</version>
              </plugin>
              <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2-beta-5</version>
              </plugin>
              <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.1</version>
              </plugin>
              <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.0</version>
              </plugin>
            </plugins>
          </pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-clean-plugin</artifactId>
              <version>2.4.1</version>
              <executions>
                <execution>
                  <id>default-clean</id>
                  <phase>clean</phase>
                  <goals>
                    <goal>clean</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <artifactId>maven-install-plugin</artifactId>
              <version>2.3.1</version>
              <executions>
                <execution>
                  <id>default-install</id>
                  <phase>install</phase>
                  <goals>
                    <goal>install</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <artifactId>maven-resources-plugin</artifactId>
              <version>2.5</version>
              <executions>
                <execution>
                  <id>default-resources</id>
                  <phase>process-resources</phase>
                  <goals>
                    <goal>resources</goal>
                  </goals>
                </execution>
                <execution>
                  <id>default-testResources</id>
                  <phase>process-test-resources</phase>
                  <goals>
                    <goal>testResources</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>2.10</version>
              <executions>
                <execution>
                  <id>default-test</id>
                  <phase>test</phase>
                  <goals>
                    <goal>test</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>2.3.2</version>
              <executions>
                <execution>
                  <id>default-testCompile</id>
                  <phase>test-compile</phase>
                  <goals>
                    <goal>testCompile</goal>
                  </goals>
                </execution>
                <execution>
                  <id>default-compile</id>
                  <phase>compile</phase>
                  <goals>
                    <goal>compile</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <artifactId>maven-war-plugin</artifactId>
              <version>2.1.1</version>
              <executions>
                <execution>
                  <id>default-war</id>
                  <phase>package</phase>
                  <goals>
                    <goal>war</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <artifactId>maven-deploy-plugin</artifactId>
              <version>2.7</version>
              <executions>
                <execution>
                  <id>default-deploy</id>
                  <phase>deploy</phase>
                  <goals>
                    <goal>deploy</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <artifactId>maven-site-plugin</artifactId>
              <version>3.0</version>
              <executions>
                <execution>
                  <id>default-site</id>
                  <phase>site</phase>
                  <goals>
                    <goal>site</goal>
                  </goals>
                  <configuration>
                    <outputDirectory>C:\Users\lukas\git\beschweren\target\site</outputDirectory>
                    <reportPlugins>
                      <reportPlugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-project-info-reports-plugin</artifactId>
                      </reportPlugin>
                    </reportPlugins>
                  </configuration>
                </execution>
                <execution>
                  <id>default-deploy</id>
                  <phase>site-deploy</phase>
                  <goals>
                    <goal>deploy</goal>
                  </goals>
                  <configuration>
                    <outputDirectory>C:\Users\lukas\git\beschweren\target\site</outputDirectory>
                    <reportPlugins>
                      <reportPlugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-project-info-reports-plugin</artifactId>
                      </reportPlugin>
                    </reportPlugins>
                  </configuration>
                </execution>
              </executions>
              <configuration>
                <outputDirectory>C:\Users\lukas\git\beschweren\target\site</outputDirectory>
                <reportPlugins>
                  <reportPlugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                  </reportPlugin>
                </reportPlugins>
              </configuration>
            </plugin>
          </plugins>
        </build>
        <reporting>
          <outputDirectory>C:\Users\lukas\git\beschweren\target\site</outputDirectory>
        </reporting>
        <profiles>
          <profile>
            <id>openshift</id>
            <build>
              <finalName>beschweren</finalName>
              <plugins>
                <plugin>
                  <artifactId>maven-war-plugin</artifactId>
                  <version>2.1.1</version>
                  <configuration>
                    <outputDirectory>webapps</outputDirectory>
                    <warName>ROOT</warName>
                  </configuration>
                </plugin>
              </plugins>
            </build>
          </profile>
        </profiles>
      </project>