0

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.
John Diego
  • 49
  • 8
  • Which port do you try to have this running on? Possibly one below 1024? http://stackoverflow.com/questions/413807/is-there-a-way-for-non-root-processes-to-bind-to-privileged-ports-1024-on-l – zapl Nov 16 '15 at 22:52
  • I am using port 80, but my firewall are disable – John Diego Nov 17 '15 at 01:16
  • Neither firewall nor file permissions (775) are relevant. Linux allows only root to use port 80. The linked question has many approaches how you could solve that, for example by changing your server back to use port 8080 and then setting a rule that all traffic on port 80 should be received on 8080 so you server becomes reachable at the standard http port. https://wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+on+Port+80+or+443+using+iptables for example. `authbind` also looks like a good approach – zapl Nov 17 '15 at 10:46
  • Thanks for the explanation .. I am newbie in Linux. – John Diego Nov 17 '15 at 11:00

1 Answers1

2

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.

Ashwini Rao
  • 555
  • 4
  • 7
  • thanks Ashwini Rao The first part was resolved, how can I solve the problem after startup of the app login? – John Diego Nov 17 '15 at 10:47
  • nice "httpd@w3.org, July 1995" that's the documentation of the original http server that started the world wide web :) – zapl Nov 17 '15 at 11:00