On 4 September 2012 09:26, Olivier Lamy <ol...@apache.org> wrote:
>
> 2012/9/3 Sérgio Areias <juger.on.n...@gmail.com>:
> > Hi.
> >
> > On 31 August 2012 21:24, Olivier Lamy <ol...@apache.org> wrote:
> >
> >> 2012/8/27 Sérgio <juger.on.n...@gmail.com>:
> >> > Hi.
> >> >
> >> > I am trying to use the Tomcat Maven Plugin to create an executable jar
> >> file
> >> > with an embedded Tomcat7, but I am having two issues when trying to do
> >> so.
> >> >
> >> > The first one, is that I am not getting how I can stop my executable
> >> jar. I
> >> > want to run it in from a script (like the shutdown.sh/bat from tomcat).
> >> I
> >> > was not able to find any documentation about that particular issue.
> >> nope not supported.
> >>
> > Can you give me some pointers of where I should look at if I decide to
> > implement it? I could kill the process but that does not look a solution
> > but a workaround instead.
> >
> >
> >> >
> >> > The second issue, is that when I run my executable jar it loads my webapp
> >> > context twice (it tries because it will not be able to do it as I use a
> >> > derby db, and it will give an error when trying to have the lock again).
> >> It
> >> > creates a folder .extract, and the webapp works fine, but I do not want
> >> my
> >> > context to be loaded twice. I am using the configurations I have found
> >> here
> >> > http://tomcat.apache.org/maven-plugin-2/executable-war-jar.html .
> >> >
> >> > What am I missing here?
> >> Do you have a sample project as I cannot reproduce.
> >> What is the content of .extract/webapps
> >>
> >> Did you try java- jar pathtoyourjar -resetExtract (or cleanup .extract
> >> directory before) ?
> >>
> >
> > After taking a look to the plugin source code, I understood that I cannot
> > use "/" as context, and that is why I was having the context loaded twice
> > (ROOT and .war). Is it supported by the plugin to have a webapp running
> > with no context when trying to have an executable jar? I ask this question
> > because when I try to use ROOT (<path>/ROOT</path>), I do not have the "/"
> > context but "/ROOT" instead.
> > (Also after studying the lines 264-272 from
> > http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java?view=markup
> >  )
>
> Did you simply try: <path></path>
> :-)
>
I have tried now, and the context was set to the artifact id. I also
took a look to the source code and I think that it is the expected
behaviour (defaultValue = "${project.artifactId}").

Well, after a few more tests I found new info about my problem.
I was trying to use my server.xml file, when I remove it everything
works fine (except one thing but I will address it later on this
mail), even with "/" as context (does not seem valid following line
107 of the AbstractExecWarMojo class but it is working). When I try to
use the server.xml it loads the context twice. Why that happens, I do
not know yet.

I really do not need my custom server.xml, but when I do not use it
the configuration <port>50001</port> in my pom.xml is not reflected
when I try to run the jar. It runs always in the port 8080 without my
server.xml.

NOTE: I have attached my server.xml.

Thanks for your attention and sorry for the taken time.
Best regards,
Sérgio Areias

>
> >
> >
> >> >
> >> > Info about the project:
> >> >  - Maven project;
> >> >  - pom.xml with packaging war using the build found here
> >> > http://tomcat.apache.org/maven-plugin-2/executable-war-jar.html ;
> >> >  - Running in Ubuntu 11.04;
> >> >  - Using: <groupId>org.apache.tomcat.maven</groupId>
> >> >                 <artifactId>tomcat7-maven-plugin</artifactId>
> >> >                 <version>2.0-beta-1</version>
> >> >
> >> > Thanks in advance.
> >> >
> >> > Best regards,
> >> > Sérgio Areias
> >>
> >> --
> >> Olivier Lamy
> >> Talend: http://coders.talend.com
> >> http://twitter.com/olamy | http://linkedin.com/in/olamy
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>
> >>
> > Thanks for you reply and your attention.
> > Best regards,
> > Sérgio Areias
>
>
>
> --
> Olivier Lamy
> Talend: http://coders.talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" 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 port="50001" protocol="HTTP/1.1"
               connectionTimeout="20000"
               URIEncoding="UTF-8"
               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="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- 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>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to