Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application-Script Daemon Capsule #11

Open
roded opened this issue Feb 24, 2016 · 6 comments
Open

Application-Script Daemon Capsule #11

roded opened this issue Feb 24, 2016 · 6 comments
Assignees

Comments

@roded
Copy link
Contributor

roded commented Feb 24, 2016

Hi,
I'm not at all sure this is a capsule-daemon issue and not a result of my erroneous configuration, or an issue with us.kirchmeier.capsule, however I'm a bit stuck so any advice would be great.
The capsule produced by the following task results in the exception below.

task fatDaemonCapsule(type: FatCapsule) {
    capsuleManifest {
        platform('windows') {
            applicationScript = "mongoose-free-6.1.exe"
        }
        caplets << 'DaemonCapsule'
        manifest {
            attributes('Application-Name': project.serviceName)
            attributes('Daemon-Service-Name': project.serviceName)
            attributes('Daemon-Display-Name': project.serviceDisplay)
            attributes('Daemon-Description': project.serviceDesc)
            attributes('Daemon-Startup': 'auto')
            attributes('Daemon-Log-Level': 'debug')
        }
    }
}

CAPSULE: Jar: X:\workspaces\xxx\docs-rest-api\build\libs\docs-rest-api-0.0.0-SNAPSHOT-capsule.jar
CAPSULE: Platform: windows
CAPSULE: Loading caplet: DaemonCapsule
CAPSULE: Applying caplet DaemonCapsule
CAPSULE: Initializing app ID
CAPSULE: Initialized app ID: xxx
CAPSULE: Launching app xxx
CAPSULE: Starting capsule server.
CAPSULE: Binding capsule server at: 0.0.0.0:59332
CAPSULE: Using JVM: X:\@sdks\jdks\jdk1.8.0_5_dcevm\jre
CAPSULE: WARNING resolve [] was empty
CAPSULE: Cache directory: C:\Users\rodedb\AppData\Local\Temp
CAPSULE: Creating temp file/dir C:\Users\rodedb\AppData\Local\Temp\apps\xxx\.lock
CAPSULE: Locking C:\Users\rodedb\AppData\Local\Temp\apps\xxx\.lock
CAPSULE: Extracting X:\workspaces\xxx\docs-rest-api\build\libs\docs-rest-api-0.0.0-SNAPSHOT-capsule.jar to app cache directory C:\Users\rodedb\AppData\Local\Temp\apps\xxx
CAPSULE: Unlocking C:\Users\rodedb\AppData\Local\Temp\apps\xxx\.lock
CAPSULE: Cleanup
CAPSULE EXCEPTION: null while processing attribute Daemon-Service-Name: xxx
java.lang.NullPointerException
    at DaemonCapsule.setupWindowsCmd(DaemonCapsule.java:258)
    at DaemonCapsule.toSvc(DaemonCapsule.java:231)
    at DaemonCapsule.prelaunch(DaemonCapsule.java:154)
    at Capsule.prelaunch(Capsule.java:1476)
    at Capsule.prepareForLaunch(Capsule.java:1329)
    at Capsule.launch(Capsule.java:1258)
    at Capsule.main0(Capsule.java:394)
    at Capsule.main(Capsule.java:374)

The first issue encountered is that svcExec it not set (getJavaExecutable() isn't called), but even after dealing with that it still breaks due to not finding either of the Application of Application-Class attributes.
Am I missing something obvious?
Thanks

@roded roded changed the title Aapplication-Script Daemon Task Application-Script Daemon Task Feb 24, 2016
@roded roded changed the title Application-Script Daemon Task Application-Script Daemon Capsule Feb 24, 2016
@circlespainter
Copy link
Member

How does the manifest of the capsule built by the plugin look like?

@roded
Copy link
Contributor Author

roded commented Feb 24, 2016

Manifest-Version: 1.0
Application-Name: xxx
Daemon-Service-Name: xxx
Daemon-Display-Name: xxx
Daemon-Description: xxx
Daemon-Startup: auto
Daemon-Log-Level: debug
Caplets: DaemonCapsule
Premain-Class: Capsule
Main-Class: Capsule

Name: windows
Application-Script: mongoose-free-6.1.exe

@circlespainter
Copy link
Member

capsule-daemon in its current form only works with Java programs, not script-based ones. It is theoretically possible to support this case too with procrun on Windows while on Unix jsvc is not the tool for the job as it is meant to run Java classes, so some other mechanism to "daemonize" the program (possibly in a cross-platform way) would be needed.

For sure in the meanwhile this limitation should be made explicit in the README.md and in the error message.

May I ask you why you want to use capsule-daemon to start a non-Java program rather than installing it as a native daemon?

@roded
Copy link
Contributor Author

roded commented Feb 24, 2016

I'd like to deploy a service providing documentation (Swagger UI) for a certain version of an application. As the documentation is derived from interfaces, I thought it made sense to build it as a runnable capsule.
I went down a rabbit hole with this a bit, this is all due to Swagger UI issues with running locally and such.

@circlespainter
Copy link
Member

Let's leave it open as a feature ticket, the Windows part (which you need in this case I think) will come sooner anyway. The docs will be fixed soon.

@roded
Copy link
Contributor Author

roded commented Feb 24, 2016

No problem, I'll work around it.
Thanks.

circlespainter pushed a commit that referenced this issue Feb 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants