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

Add support for YAJSW #42

Open
sparsick opened this issue Jun 24, 2016 · 12 comments
Open

Add support for YAJSW #42

sparsick opened this issue Jun 24, 2016 · 12 comments

Comments

@sparsick
Copy link

YAJSW ('Yet Another Java Service Wrapper') is an alternative for Tanuki JSW. It is under licensed under Apache License, which IMHO is a benefit over JSW.

Therefore, I think it would be helpful if appassembler could support YAJSW for its Linux daemon and Windows Service generation functionality.

http://yajsw.sourceforge.net/

@khmarbaise
Copy link
Member

Sure it would be helpful...would you like offer a patch ?

@sparsick
Copy link
Author

Yes, I can try it.

@khmarbaise
Copy link
Member

Would be great ;-)

@sparsick
Copy link
Author

sparsick commented Jul 4, 2016

I have started to analyze how YAJSW's libs and scripts can be added to the appassembler's generated folder structure. As a basis, I used the folder strucuter, that is generated for JSW. I'd like to share some ideas and to get some feedback if my approach is on the right track.

For Windows, I got following structure that works

.
├── bin
│   ├── genConfig.bat
│   ├── installService.bat
│   ├── runConsole.bat
│   ├── setenv.bat
│   ├── startService.bat
│   ├── stopService.bat
│   ├── uninstallService.bat
│   ├── wrapper.bat
│   └── wrapperW.bat
├── etc
│   └── wrapper.conf
├── lib
│   ├── some
│   │   └── artifacts
│   │      └── located
│   │      └── in
│   │      └── repository-style
│   │      └── 1.0
│   │      └── myApp.jar
│   ├── core // structure required by yajsw
│   │   ├── commons
│   │   │   ├── commons-cli-1.3.1.jar
│   │   │   ├── commons-collections-3.2.2.jar
│   │   │   ├── commons-configuration2-2.0.jar
│   │   │   ├── commons-io-1.3.1.jar
│   │   │   ├── commons-lang-2.4.jar
│   │   │   ├── commons-lang3-3.4.jar
│   │   │   ├── commons-logging-1.1.jar
│   │   │   └── commons-vfs2-2.0.jar
│   │   ├── jna
│   │   │   ├── jna-4.2.1.jar
│   │   │   └── jna-platform-4.2.1.jar
│   │   ├── netty
│   │   │   └── netty-all-4.0.35.Final.jar
│   │   ├── ReadMe.txt
│   │   └── yajsw
│   │   └── ahessian.jar
│   ├── extended // structured required by yajsw
│   │   ├── abeille
│   │   │   └── formsrt.jar
│   │   ├── commons
│   │   │   ├── commons-codec-1.3.jar
│   │   │   ├── commons-httpclient-3.0.1.jar
│   │   │   ├── commons-net-1.4.1.jar
│   │   │   └── commons-net-3.2.jar
│   │   ├── cron
│   │   │   ├── joda-time-2.7.jar
│   │   │   ├── prevayler-core-2.6.jar
│   │   │   ├── prevayler-factory-2.6.jar
│   │   │   └── yacron4j-00.03.jar
│   │   ├── glazedlists
│   │   │   ├── commons-beanutils-1.8.2.jar
│   │   │   └── glazedlists-1.8.0_java15.jar
│   │   ├── groovy
│   │   │   ├── groovy-all-2.3.11.jar
│   │   │   └── groovy-patch.jar
│   │   ├── jgoodies
│   │   │   └── forms-1.2.0.jar
│   │   ├── keystore
│   │   │   └── keystore.jar
│   │   ├── ReadMe.txt
│   │   ├── regex
│   │   │   └── automaton-1.11.jar
│   │   ├── velocity
│   │   │   └── velocity-1.7.jar
│   │   ├── vfs-dbx
│   │   │   ├── dropbox-core-sdk-1.7.7.jar
│   │   │   ├── jackson-core-2.2.4.jar
│   │   │   └── vfs-dbx-00.02.jar
│   │   ├── vfs-webdav
│   │   │   ├── jackrabbit-webdav-1.5.6.jar
│   │   │   ├── slf4j-api-1.5.0.jar
│   │   │   ├── slf4j-jdk14-1.5.0.jar
│   │   │   └── xercesImpl.jar
│   │   └── yajsw
│   │   ├── hessian4.jar
│   │   └── srvmgr.jar
│   └── log4j // required by myApp
│   └── log4j
│   └── 1.2.17
│   └── log4j-1.2.17.jar
├── log
│   ├── wrapper.log
│   └── wrapper.log.lck
├── scripts // required by yajsw
│   └── trayMessage.gv
├── tmp // required by yajsw
│   ├── err_4632599940552000209$1467367196471
│   └── out_4632599940552000209$1467367196471
├── tree.dump
├── wrapper.jar // this location is required by yajsw
├── wrapperApp.jar // this location is required by yajsw
└── yajsw.policy.txt

I reuse the bat scripts from YAJSW bundle. But I think, I would rewrite them to have only one bat script controlled by argumentes.

For JSW, appassembler adds every jar file to the folder lib. I couldn't follow this pattern with YAJSW, because its wrapper jar files include a MANIFEST.MF file with hard-coded classpath entries. So they have to be located in the root folder. IMHO, it would be better to have these jars in lib folder, but it should be ok for the first draft.

Manifest-Version: 1.0
Class-Path-Wrapper-Core: ./wrapperApp.jar ./lib/core/yajsw/ahessian.ja
 r ./lib/core/netty/netty-all-4.0.35.Final.jar ./lib/core/jna/jna-4.2.
 1.jar ./lib/core/jna/jna-platform-4.2.1.jar ./lib/core/commons/common
 s-configuration2-2.0.jar ./lib/core/commons/commons-vfs2-2.0.jar ./li
 b/core/commons/commons-collections-3.2.2.jar ./lib/core/commons/commo
 ns-io-1.3.1.jar ./lib/core/commons/commons-lang3-3.4.jar ./lib/core/c
 ommons/commons-lang-2.4.jar ./lib/core/commons/commons-logging-1.1.ja
 r ./lib/core/commons/commons-cli-1.3.1.jar
Class-Path-Wrapper-Extended: ./lib/extended/groovy/groovy-patch.jar ./
 lib/extended/groovy/groovy-all-2.3.11.jar ./lib/extended/commons/comm
 ons-httpclient-3.0.1.jar ./lib/extended/commons/commons-codec-1.3.jar
  ./lib/extended/commons/commons-net-3.2.jar ./lib/extended/regex/auto
 maton-1.11.jar ./lib/extended/yajsw/hessian4.jar ./lib/extended/yajsw
 /srvmgr.jar ./lib/extended/glazedlists/glazedlists-1.8.0_java15.jar .
 /lib/extended/glazedlists/commons-beanutils-1.8.2.jar ./lib/extended/
 cron/joda-time-2.7.jar ./lib/extended/cron/yacron4j-00.03.jar ./lib/e
 xtended/velocity/velocity-1.7.jar ./lib/extended/jgoodies/forms-1.2.0
 .jar ./lib/extended/vfs-webdav/jackrabbit-webdav-1.5.6.jar ./lib/exte
 nded/vfs-webdav/xercesImpl.jar ./lib/extended/vfs-webdav/slf4j-jdk14-
 1.5.0.jar ./lib/extended/vfs-webdav/slf4j-api-1.5.0.jar ./lib/extende
 d/vfs-dbx/vfs-dbx-00.02.jar ./lib/extended/vfs-dbx/dropbox-core-sdk-1
 .7.7.jar ./lib/extended/vfs-dbx/jackson-core-2.2.4.jar ./lib/extended
 /glazedlists/commons-beanutils-1.8.2.jar ./lib/extended/glazedlists/g
 lazedlists-1.8.0_java15.jar ./lib/extended/keystore/keystore.jar ./li
 b/extended/abeille/formsrt.jar
Class-Path-App: ./wrapper.jar ./lib/core/yajsw/ahessian.jar ./lib/core
 /netty/netty-all-4.0.35.Final.jar ./lib/core/commons/commons-configur
 ation2-2.0.jar  ./lib/core/commons/commons-vfs2-2.0.jar ./lib/core/co
 mmons/commons-collections-3.2.2.jar ./lib/core/commons/commons-io-1.3
 .1.jar ./lib/core/commons/commons-lang3-3.4.jar ./lib/core/commons/co
 mmons-logging-1.1.jar
Class-Path-App-Extended: ./lib/extended/groovy/groovy-patch.jar ./lib/
 extended/groovy/groovy-all-2.3.11.jar
Main-Class: org.rzo.yajsw.boot.WrapperExeBooter

Because of the hard coded classpath entries, the libs folder has to have to structure, one for the libraries of YAJSW and one for our application, following the repository style. For the first draft I would accept this structure.

The next point is that the grovvy script trayMessage.gv is only required to avoid following message in the log file wrapper.log, so IMHO I could omit it.

[null - INFO] 16-07-01 09:52:08 Error in createScript scripts/trayMessage.gv 
Exception in org.rzo.yajsw.log.MyLogger: Could not determine the last modified timestamp of "file:///C:/Users/parsick.sa/temp/monitoring-daemon/scripts/trayMessage.gv" because it does not exist. 
  org.apache.commons.vfs2.provider.DefaultFileContent.getLastModifiedTime(DefaultFileContent.java:165)
  org.rzo.yajsw.script.GroovyScript.getScriptInstance(GroovyScript.java:113)
  org.rzo.yajsw.script.GroovyScript.<init>(GroovyScript.java:86)
  org.rzo.yajsw.script.ScriptFactory.createScript(ScriptFactory.java:56)
  org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerScript(AbstractWrappedProcess.java:2049)
  org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerActions(AbstractWrappedProcess.java:1927)
  org.rzo.yajsw.wrapper.AbstractWrappedProcess.startInternal(AbstractWrappedProcess.java:1168)
  org.rzo.yajsw.wrapper.AbstractWrappedProcess.start(AbstractWrappedProcess.java:1037)
  org.rzo.yajsw.wrapper.WrappedProcessList.startAll(WrappedProcessList.java:26)
  org.rzo.yajsw.app.WrapperMainServiceWin$1.run(WrapperMainServiceWin.java:186)
  java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
  java.util.concurrent.FutureTask.run(Unknown Source)
  java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  java.lang.Thread.run(Unknown Source)

@khmarbaise
Copy link
Member

How can I help?

@sparsick
Copy link
Author

It would help, if you could confirm, whether it's ok for the first draft to use this adjusted folder structure or not . If it isn't ok, I'm glad to get another idea how to handle the YASIW's specialty.

@khmarbaise
Copy link
Member

Hi Sandra, sure start with that structure first and we will see how it works...May be we need to customize it later....but first getting a working example is much more important...and may be need to keep it the way it is for YASIW...cause appassembler has different structures for different things...

@carlspring
Copy link

@khmarbaise , @sparsick ,

Have you guys had any luck with this? It would be really awesome to get support for this in the appassembler-maven-plugin.

@sparsick
Copy link
Author

@carlspring I stopped on a half way because of time issue. Let me see if I can publish my current status of the implementation.

@carlspring
Copy link

Okay, great! Thanks!

sparsick added a commit to sparsick/appassembler that referenced this issue Oct 30, 2019
sparsick added a commit to sparsick/appassembler that referenced this issue Oct 30, 2019
sparsick added a commit to sparsick/appassembler that referenced this issue Oct 30, 2019
sparsick added a commit to sparsick/appassembler that referenced this issue Oct 31, 2019
sparsick added a commit to sparsick/appassembler that referenced this issue Oct 31, 2019
sparsick added a commit to sparsick/appassembler that referenced this issue Nov 1, 2019
sparsick added a commit to sparsick/appassembler that referenced this issue Nov 1, 2019
sparsick added a commit to sparsick/appassembler that referenced this issue Nov 1, 2019
sparsick added a commit to sparsick/appassembler that referenced this issue Nov 1, 2019
sparsick added a commit to sparsick/appassembler that referenced this issue Nov 1, 2019
sparsick added a commit to sparsick/appassembler that referenced this issue Nov 1, 2019
sparsick added a commit to sparsick/appassembler that referenced this issue Nov 1, 2019
sparsick added a commit to sparsick/appassembler that referenced this issue Nov 1, 2019
@sparsick
Copy link
Author

sparsick commented Nov 1, 2019

@carlspring I finished an initial implementation (see PR #99). I tested it on a Linux system. It's a minimal working implementation

@sparsick
Copy link
Author

sparsick commented Nov 2, 2019

@khmarbaise from your point of view, which features should be implemented as a minimum?

sparsick added a commit to sparsick/appassembler that referenced this issue May 31, 2020
- refactoring yajsw lib name to a property variable
sparsick added a commit to sparsick/appassembler that referenced this issue Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants