Here is a working quickstart (that I forgot to link yesterday) for APR
in Spring Boot:
https://github.com/csutherl/tomcat-embedded-quickstarts/tree/master/springboot-apr-example

On Thu, Sep 28, 2017 at 3:34 PM, Coty Sutherland <csuth...@redhat.com> wrote:
> On Thu, Sep 28, 2017 at 12:27 PM, Wang, Jennifer
> <jennifer.w...@bos.frb.org> wrote:
>> NONCONFIDENTIAL // EXTERNAL
>> Hi Coty,
>>
>> I download tcnative-1.dll from tomcat site. I am running on windows 7. I did 
>> set " java.library.path" as below.
>>
>>
>>
>>
>> @SpringBootApplication
>> public class Application {
>>
>>     public static void main(String[] args) {
>>
>> //try both of below
>>         System.setProperty("java.library.path", 
>> "C:\\Temp\\tomcat-native-1.2.14-win32-bin\\bin\\x64\\tcnative-1.dll");
>>         //System.setProperty("java.library.path", 
>> "C:\\Temp\\tomcat-native-1.2.14-win32-bin\\bin\\x64");
>
> I think trying to set the library path in code is too late as the JVM
> has already initialized. You'll need to set it in the JVM arguments
> that start the Application. I got it working using the following
> config snippet:
>
>              <plugin>
>                  <groupId>org.springframework.boot</groupId>
>                  <artifactId>spring-boot-maven-plugin</artifactId>
>                  <configuration>
>                      <jvmArguments>
>                          -Djava.library.path=/path/to/tomcat-native/
>                      </jvmArguments>
>                  </configuration>
>
> and starting with `mvn spring-boot:run`. I also configured that the
> System.setProperty call didn't work.
>
> HTH
>
>>
>>         SpringApplication.run(Application.class, args);
>>     }
>> }
>>
>> Thanks!
>>
>> Jennifer
>>
>> -----Original Message-----
>> From: Coty Sutherland [mailto:csuth...@redhat.com]
>> Sent: Thursday, September 28, 2017 12:16 PM
>> To: Tomcat Users List
>> Subject: [External] Re: how to set Http11AprProtocol with embedded tomcat
>>
>> On Thu, Sep 28, 2017 at 11:32 AM, Wang, Jennifer <jennifer.w...@bos.frb.org> 
>> wrote:
>>> NONCONFIDENTIAL // EXTERNAL
>>> How to set Http11AprProtocol with embedded tomcat in java spring boot app?
>>>
>>> I keep get below error.
>>
>> You don't have tomcat-native installed. Resolving the problem should be as 
>> simple as installing tomcat-native (which deps on APR) via RPM (assuming 
>> you're on linux) so that it's on your library path or updating your JVM's 
>> -Djava.library.path system property to point to APR and tomcat-native so 
>> that tomcat can use it.
>>
>>> org.apache.catalina.LifecycleException: Failed to initialize component 
>>> [Connector[org.apache.coyote.http11.Http11AprProtocol-8443]]
>>>        at 
>>> org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112)
>>>        at 
>>> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
>>>        at 
>>> org.apache.catalina.core.StandardService.addConnector(StandardService.java:225)
>>>        at 
>>> org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:250)
>>>        at 
>>> org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:193)
>>>        at 
>>> org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297)
>>>        at 
>>> org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145)
>>>        at 
>>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
>>>        at 
>>> org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
>>>        at 
>>> org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
>>>        at 
>>> org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
>>>        at 
>>> org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
>>>        at 
>>> org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
>>>        at 
>>> org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
>>>        at hello.Application.main(Application.java:13)
>>> Caused by: org.apache.catalina.LifecycleException: The configured
>>> protocol [org.apache.coyote.http11.Http11AprProtocol] requires the
>>> APR/native library which is not available
>>>
>>> Thanks!
>>>
>>> Jennifer
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to