tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Van Damme <chava...@gmail.com>
Subject Re: My web application to use SSL (JSSE - RSA)
Date Fri, 10 Jun 2011 13:25:41 GMT
OK Christopher:

1) Output tabs of NetBeans IDE
1.1) Tomcat 7.0 :
Using CATALINA_BASE:   "C:\Program Files\ApacheSoftwFound\Apache Tomcat
7.0.11"
Using CATALINA_HOME:   "C:\Program Files\ApacheSoftwFound\Apache Tomcat
7.0.11"
Using CATALINA_TMPDIR: "C:\Program Files\ApacheSoftwFound\Apache Tomcat
7.0.11\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk1.6.0_22"
Using CLASSPATH:       "C:\Program Files\ApacheSoftwFound\Apache Tomcat
7.0.11\bin\bootstrap.jar;C:\Program Files\ApacheSoftwFound\Apache Tomcat
7.0.11\bin\tomcat-juli.jar"
10-jun-2011 15:14:11 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal
performance in production environments was not found on the
java.library.path: C:\Program
Files\Java\jdk1.6.0_22\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS\System32\Wbem;C:\Program
Files\Java\jdk1.6.0_22\bin;C:\Program Files\ApacheSoftwFound\Apache Tomcat
7.0.11
10-jun-2011 15:14:11 org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-nio-443"]
10-jun-2011 15:14:12 org.apache.coyote.AbstractProtocolHandler init
SEVERE: Failed to initialize end point associated with ProtocolHandler
["http-nio-443"]
java.security.NoSuchAlgorithmException: RSA SSLContext not available
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:142)
    at javax.net.ssl.SSLContext.getInstance(SSLContext.java:125)
    at
org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSSLContext(JSSESocketFactory.java:490)
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:478)
    at
org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:483)
    at
org.apache.coyote.AbstractProtocolHandler.init(AbstractProtocolHandler.java:345)
    at
org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
    at
org.apache.catalina.connector.Connector.initInternal(Connector.java:910)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:101)
    at
org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:101)
    at
org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:781)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:101)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:572)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:262)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:430)
10-jun-2011 15:14:12 org.apache.catalina.core.StandardService initInternal
SEVERE: Failed to initialize connector
[Connector[org.apache.coyote.http11.Http11NioProtocol-443]]
org.apache.catalina.LifecycleException: Protocol handler initialization
failed
    at
org.apache.catalina.connector.Connector.initInternal(Connector.java:912)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:101)
    at
org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:101)
    at
org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:781)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:101)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:572)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:262)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:430)
Caused by: java.security.NoSuchAlgorithmException: RSA SSLContext not
available
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:142)
    at javax.net.ssl.SSLContext.getInstance(SSLContext.java:125)
    at
org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSSLContext(JSSESocketFactory.java:490)
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:478)
    at
org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:483)
    at
org.apache.coyote.AbstractProtocolHandler.init(AbstractProtocolHandler.java:345)
    at
org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
    at
org.apache.catalina.connector.Connector.initInternal(Connector.java:910)
    ... 13 more
10-jun-2011 15:14:12 org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
10-jun-2011 15:14:12 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1569 ms
10-jun-2011 15:14:12 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
10-jun-2011 15:14:12 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.11
10-jun-2011 15:14:12 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor ROOT.xml from C:\Program
Files\ApacheSoftwFound\Apache Tomcat 7.0.11\conf\Catalina\localhost
10-jun-2011 15:14:12 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor Opinion.xml from C:\Program
Files\ApacheSoftwFound\Apache Tomcat 7.0.11\conf\Catalina\localhost
10-jun-2011 15:14:12 org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base C:\Documents and
Settings\Papa\My Documents\Applic Program\eId Applet\build\web does not
exist or is not a readable directory
    at
org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:140)
    at
org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4794)
    at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4974)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
    at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
    at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:633)
    at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:558)
    at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:468)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1305)
    at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
    at
org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:379)
    at
org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:324)
    at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1041)
    at
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
    at
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at
org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
10-jun-2011 15:14:13 org.apache.catalina.core.StandardContext startInternal
SEVERE: Error in resourceStart()
10-jun-2011 15:14:13 org.apache.catalina.core.StandardContext startInternal
SEVERE: Error getConfigured
10-jun-2011 15:14:13 org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/Opinion] startup failed due to previous errors
10-jun-2011 15:14:13 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor Test1.xml from C:\Program
Files\ApacheSoftwFound\Apache Tomcat 7.0.11\conf\Catalina\localhost
10-jun-2011 15:14:13 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
10-jun-2011 15:14:13 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
10-jun-2011 15:14:13 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager
10-jun-2011 15:14:13 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory host-manager
10-jun-2011 15:14:13 org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
10-jun-2011 15:14:13 org.apache.catalina.startup.Catalina start
INFO: Server startup in 1205 ms

1.2) Test1 (run)
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
Starting Tomcat process...
Waiting for Tomcat...
Starting of Tomcat failed.
C:\Documents and Settings\Papa\My Documents\Applic
Program\JSP\VDAB\Test1\nbproject\build-impl.xml:718:
Deployment error:
Starting of Tomcat failed.
See the server log for details.
    at
org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:200)
    at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    at
org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
    at
org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
    at
org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:154)
BUILD FAILED (total time: 3 minutes 4 seconds)

2) My server.xml file (Modified only at the "Connectors ..." place)
<?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="8080" 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 a non-blocking Java SSL Coyote HTTP/1.1 Connector on port
443 -->
    <Connector protocol="org.apache.coyote.http11.Http11NioProtocol"
port="443"
               maxThreads="150" scheme="https" secure="true"
SSLEnabled="true"
               keystoreFile="C:/Documents and Settings/Papa/.keystore"
keystorePass="changeit"
               clientAuth="false" sslProtocol="RSA" />

    <!-- Define a APR SSL Coyote HTTP/1.1 Connector on port 443
    <Connector protocol="org.apache.coyote.http11.Http11AprProtocol"
port="443"
               maxThreads="200" scheme="https" secure="true"
SSLEnabled="true"
               SSLCertificateFile="/usr/local/ssl/server.crt"
               SSLCertificateKeyFile="/usr/local/ssl/server.pem"
               clientAuth="optional" SSLProtocol="TLSv1" />
    -->

    <!-- 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"
resolveHosts="false"/>

      </Host>
    </Engine>
  </Service>
</Server>

Hoping you are not overwhelmed. Anything else ?
Many thanks for trying to help me.
Chavadam


On Thu, Jun 9, 2011 at 6:27 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Charles,
>
> On 6/8/2011 3:03 PM, Charles Van Damme wrote:
> > 1) I'm trying first with JSSE. Please see <!-- Connectors ... in my
> > server.xml file.
>
> Attachments stripped again. Please copy/paste into the message.
>
> > 2) How can I prevent my NetBeans IDE to start a Tomcat server ?
> > To run and stop Tomcat "separately", I figure that you mean start > Cmd >
> > C:\Program Files\apache-tomcat-7.0.11\bin\startup.bat and shutdown.bat
>
> That is generally the proper way to start and stop Tomcat.
>
> > 3) What do I have to do to avoid that it grumbles when I try to use RSA ?
>
> Can you post your log files from after an unsuccessful startup? Remember
> that attaching them might not work well (though plain-text does tend to
> get through).
>
> There are many things that can go wrong when configuring SSL. We will
> need to see your configuration and the actual error you get in order to
> help diagnose.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk3w9GsACgkQ9CaO5/Lv0PBv8gCfVWGz7PygOoAsqzQt/PLBvHIj
> 5iwAn1S1+V6q02LmPskk8VCyg0ZSxkbJ
> =sJdR
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message