Hi,
I know there are many different questions in what im going to describe in the following. It is definitely not only gradle-related, but it’s hard to find a platform to ask those questions, because you can only get help if you clarify the whole setup and aims. For this reason I didn’t have much success with StackOverflow for example as the questions should always stand alone for themselves. So I hope you will try to help me although this forum may not be the right place for all content in this topic.
What I am trying is to set up an environment to create a Java Enterprise Application containing an EJB-Jar and an JavaFX Application Client (Eclipse Gluon project applying the gradle ‘jfxmobile’ plugin). I would like to use CDI instead of JNDI lookups to call the EJBs. I don’t even know If this is actually possible, but I can’t see why it shouldn’t. The project should be deployed to the latest version of Payara server.
My project structure look like this:
GradleMaster/
- settings.gradle
- build.gradle
EAR/
- build.gradle
EJB/
- build.gradle
JavaFXClient/
-build.gradle
I altered the project names and left out a second application client created from the Eclipse Application Client wizard for test purposes to make it a bit easier to overview.
The contents of the gradle files look like this:
GradleMaster/settings.gradle:
include 'DataViewerEAR', 'DataViewerEJB', 'DataViewerFX', 'DataViewerTestClient'
GradleMaster/build.gradle:
allprojects{
apply plugin: 'base'
apply plugin: 'eclipse'
}
subprojects {
apply plugin: 'java'
repositories{
mavenCentral()
jcenter()
}
dependencies {
compile 'ch.qos.logback:logback-classic:1.1.6'
compile 'javax:javaee-api:7.0'
testCompile 'junit:junit:4.12'
}
}
EAR/build.gradle:
apply plugin: 'ear'
task wrapper(type: Wrapper){
gradleVersion = '2.21'
}
dependencies {
deploy project(':DataViewerEJB')
earlib project(path: ':DataViewerEJB', configuration: 'compile')
deploy project(':DataViewerFX')
deploy project(':DataViewerTestClient')
earlib 'fish.payara.extras:payara-embedded-all:4.1.153'
earlib 'javax:javaee-api:7.0'
}
appDirName "EarContent"
EAR/build.gradle:
dependencies{
compile 'org.elasticsearch:elasticsearch:1.6.0'
}
sourceSets {
main {
java {
srcDir 'ejbModule'
}
}
test {
java {
srcDir 'test'
}
}
}
JavaFXClient/build.gradle:
apply plugin: 'org.javafxports.jfxmobile'
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.0.0-b10'
}
}
retrolambda {
oldJdk System.getenv("JAVA7_HOME")
}
mainClassName = 'com.mannikj.dataviewer.fx.main.DataViewerApplication'
jfxmobile {
android {
manifest = 'src/android/AndroidManifest.xml'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
}
}
jar {
manifest {
attributes 'Main-Class': 'com.mannikj.dataviewer.fx.main.DataViewerApplication'
attributes 'Permissions': 'all-permissions'
}
}
The outcomes of the ‘ear’ task of the EAR project seem to be quite ok and I am able to deploy the file manually to Payara using the web administration. Although there are several strange messages in the server log. As I am a new user, I cannot upload files and the log files are to long to embed them in the post. I will try to add them later.
It is very strange that a few messages refer to an EJB called TimerBean that is afterwards deployed to Payara as an EJB module of the EAR application. I don’t know where this comes from…
Deploying via Eclipse by Right Click on EAR project->Run As->Run on Server
results does not work at all. I will also try to provide the log messages later on. Maybe someone could tell me the best way to hand out the log files for you. The forum’s post rules are very restrictive.
For me in looks like Eclipse does not use Gradle to create the EAR for deployment, but tries to build it on it’s own.
Another big issue is Java WebStart in general. When trying to launch the application there security issues. You find many users with the same problems, but there has not been a solution for me yet.
I could provide further information if someone who wants to help asks for it. I would also give my workspace to chosen users if anyone declares oneself ready to comply with it. There are probably some instructions or XML-configs missing to tell Payara exactly what to do, but I am quite new to that whole stuff. I also not sure whether Gradle could produce these files during build dynamically instead of declaring it in ugly XML files.
Thank you in advance!
Best regards,
Jannik