Hi
I am trying to setup optic for a java project which uses spring boot and maven. But i am unable to start optic for my project. Following are the steps i have followed -
-
Run api init
on project root which contains pom.xml
Ankits-MacBook-Air:mposweb ankitrustagi$ api init
/Users/ankitrustagi/Documents/GitHub/mposweb
Is this your API's root directory? (yes/no): yes
[optic] opening http://localhost:34444/specs/1/init
Ankits-MacBook-Air:mposweb ankitrustagi$
After this i am taken to the "Welcome to Optic" page, which i try to setup like this -
![image](https://user-images.githubusercontent.com/14950516/74900060-9d8a3f80-53c4-11ea-8c83-1f851e6a4d41.png)
After this, my optic.yml
file looks like this -
+name: myapp
tasks:
start:
command: echo "./mvnw"
baseUrl: http://localhost:8443
ignoreRequests:
- GET /favicon.ico
- OPTIONS *
But this does not work, when i run api start
it simply exits after echoing my run command
Ankits-MacBook-Air:mposweb ankitrustagi$ api start
[optic] Review the API Diff live at http://localhost:34444/specs/1/diff/939cce9a-1207-4bfa-8e79-fc81ef494e02
./mvnw
Ankits-MacBook-Air:mposweb ankitrustagi$
Since my deployment command is ./mvnw
, I tried tweaking the optic.yml
file to -
+name: myapp
tasks:
start:
command: ./mvnw
baseUrl: http://localhost:8443
ignoreRequests:
- GET /favicon.ico
- OPTIONS *
But for some reason, when i run api start
the tomcat server does get started but a few seconds later 2 java processes seem to get spawned on the same port 8443
and tomcat startup eventually fails. The error message says -
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 8443 was already in use.
Action:
Identify and stop the process that's listening on port 8443 or configure this application to listen on another port.
I confirmed that there are two un-identical java processes by running ps aux | grep java
-
Ankits-MacBook-Air:mposweb ankitrustagi$ ps aux | grep java
ankitrustagi 84044 300.3 5.4 7947036 452500 s004 R+ 9:01AM 0:20.08 /Library/Java/JavaVirtualMachines/jdk..... <omitted for brevity>
ankitrustagi 84046 0.0 0.0 4277236 808 s002 S+ 9:02AM 0:00.01 grep java
ankitrustagi 84012 0.0 13.2 7943732 1108872 s004 S+ 9:01AM 2:00.31 /Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home/bin/java -classpath /Users/ankitrustagi/Documents/GitHub/mposweb/.mvn/wrapper/maven-wrapper.jar -Dmaven.home=/Users/ankitrustagi/Documents/GitHub -Dmaven.multiModuleProjectDirectory=/Users/ankitrustagi/Documents/GitHub/mposweb org.apache.maven.wrapper.MavenWrapperMain
The final setup page looks like -
![Screenshot 2020-02-20 at 9 49 22 AM](https://user-images.githubusercontent.com/14950516/74900611-63ba3880-53c6-11ea-9acb-d569076ab029.png)
Notice the following line in the attached image -
WAITING FOR YOUR API TO RUN ON `$OPTIC_API_PORT` NULL
Why is $OPTIC_API_PORT
set to NULL
? Is there something incorrect with my setup steps? I noticed that spring/java isn't mentioned in the list of frameworks on the first setup page, does optic
support spring/java projects?