简体   繁体   中英

How to make linux start with the spring boot after login?

I'm trying to boot spring start with after the Linux login more'm failing, can anyone tell me what am I doing wrong?

I've got two problems ..

I can run the application just by invoking the sudo user ,if it does not happen the following error

        java.lang.IllegalStateException: Tomcat connector in failed state
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:157)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:288)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:140)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:117)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:689)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:969)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:958)
        at br.com.nextinfo.MainApplication.main(MainApplication.java:28)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
        at java.lang.Thread.run(Thread.java:745)

         2015-11-16 19:59:22.368  INFO 3400 --- [           main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@52f6002c: startup date [Mon Nov 16 19:59:13 BRST 2015]; root of context hierarchy
        2015-11-16 19:59:22.369  INFO 3400 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
        java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:497)
            at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
            at java.lang.Thread.run(Thread.java:745)
        Caused by: java.lang.IllegalStateException: Tomcat connector in failed state
            at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:157)
            at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:288)
            at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:140)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
            at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:117)
            at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:689)
            at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
            at org.springframework.boot.SpringApplication.run(SpringApplication.java:969)
            at org.springframework.boot.SpringApplication.run(SpringApplication.java:958)
            at br.com.nextinfo.MainApplication.main(MainApplication.java:28)
            ... 6 more

To explain to me why this error occurs .. How can I make application to run after the User login on linux, noting that the login occurs automatically without the sudo permission, is a jar should run with the permissions 755 right?

thank you advanced.

Should be straightforward.I believe you are using port 80 and not 8080:

Ports below 1024 are privileged ports and hence require sudo user

Refer Doc :

http://www.w3.org/Daemon/User/Installation/PrivilegedPorts.html

Either pass server port via Run VM arguments that is like -Dserver.port=8080 or search for application.properties and specify server.port=8080 in it.

The above should work just fine.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM