gradle jetty plugin does not stop when using daemon=true in jettyRun - java

I'm using the following gradle script for very simple web application:
apply plugin: 'war'
apply plugin: 'jetty'
repositories {
mavenCentral()
}
dependencies {
providedCompile deps['servlet-api']
providedCompile deps['commons-io']
providedCompile deps['gson']
}
jettyRun {
contextPath = "/"
httpPort = 8900
stopPort = 9800
stopKey = "pleaseStop"
daemon = true
}
jettyStop {
stopPort = 9800
stopKey = "pleaseStop"
}
When I run jettyRun the app works but when I run jettyStop it does not stop.
If I change daemon to false jettyStop does stop the embedded Jetty server.
How can I stop the embedded Jetty server when use in daemon mode?

Related

I am having issue building my first flutter app with android studio getting few errors can someone help me?

Building with sound null safety
FAILURE: Build failed with an exception.
Where:
Build file 'C:\WordpressApp\main_files\source\wordpress_app\android\app\build.gradle' line: 24
What went wrong:
A problem occurred evaluating project ':app'.
Plugin with id 'com.android.application' not found.
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1s
Running Gradle task 'assembleRelease'... 2,412ms
Gradle task assembleRelease failed with exit code 1
I am using following tools for flutter app development *
Android Studio Chipmunk | 2021.2.1 Patch 1
Build #AI-212.5712.43.2112.8609683, built on May 18, 2022
Runtime version: 11.0.12+7-b1504.28-7817840 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1536M
Cores: 4
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.intellij.scripting-javascript (1.0), com.intellij.javafx (1.0.4), org.jetbrains.kotlin (212-1.6.21-release-334-AS5457.46), Dart (212.5744), idea.plugin.protoeditor (212.5080.8), io.flutter (68.1.2)
buildscript {
ext.kotlin_version = '1.6.0'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.5'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
hello i think the problem that you have 2 subprojects block try to delete one and the other like this :
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
Please check android/app/build.gradle
and see if this is existing there.
apply plugin: 'com.android.application'

Alpine Docker Image to run JLink executable

My current Docker image is approximately 200MB. My goal is to reduce that as much as possible, so I thought the alpine image would be a great way to achieve that. However, I keep encountering roadblocks.
It's a multi-module libGDX project that uses Java 14 and its preview features, along with JLink (from JPackage) to produce a custom (lightweight) JRE.
I only care to deploy the server module, which depends on the common module (which the client module also uses).
I'll be providing all the necessary files below, but in case I'm missing something, here is a link to the repo: https://github.com/payne911/marvelous-bob/tree/dev
Current problem
I either get:
when executing ./server: file not found for an executable file which I know exists and is executable where I'm trying to run it in the Docker Image
when executing apk add --no-cache someLibrary: a segfault: core dumped when trying to download libraries in my ENTRYPOINT which I thought were required to execute that file (libstdc++ and libc6-compat)
Goal
Reusable lightweight Docker Image which contains everything to run libGDX executables generated by JLink.
Current files which are in a working state and I'm trying to refactor
Dockerfile
FROM openjdk:14-jdk-alpine
COPY server/build/libs/server-all.jar /app.jar
COPY utils/deploys/bootstrap.sh /bootstrap.sh
RUN chmod +x /bootstrap.sh
EXPOSE 80
ENTRYPOINT ["./bootstrap.sh"]
bootstrap.sh
#!/usr/bin/env sh
echo "========== LAUNCHING SERVER APP ========="
apk add --no-cache libstdc++
java --enable-preview -jar /app.jar
build.gradle files
root
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
google()
}
dependencies {
}
}
// to force download of sources and JavaDoc
plugins {
id 'java'
id 'idea'
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
allprojects {
version = '1.0'
ext {
appName = "marvelous-bob"
gdxVersion = '1.9.10'
roboVMVersion = '2.3.7'
box2DLightsVersion = '1.5'
ashleyVersion = '1.7.0'
aiVersion = '1.8.2'
slf4j = '1.7.26'
logback = '1.2.3'
lombok = '1.18.12'
kryonet = '2.22.6'
reflectionsVersion = '0.9.12'
pieMenuVersion = '4.2.0'
shapeDrawer = '2.3.0'
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
google()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
maven { url 'https://jitpack.io' }
}
}
project(":desktop") {
apply plugin: "java-library"
dependencies {
api project(":client")
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
}
}
project(":client") {
apply plugin: "java-library"
dependencies {
api project(":common")
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "space.earlygrey:shapedrawer:$shapeDrawer"
api "com.github.payne911:PieMenu:$pieMenuVersion"
}
}
project(":server") {
apply plugin: "java-library"
dependencies {
api project(":common")
api "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}
}
project(":common") {
apply plugin: "java-library"
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
api "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
// todo: do we need both logging libraries? p.s. kryonet uses Minlog
api "org.slf4j:slf4j-api:$slf4j"
api "ch.qos.logback:logback-classic:$logback"
api "com.github.crykn:kryonet:$kryonet"
api "org.reflections:reflections:$reflectionsVersion"
}
}
common
plugins {
id 'java'
id 'io.freefair.lombok' version '5.1.0'
}
sourceCompatibility = 14
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.compilerArgs += "--enable-preview"
}
tasks.withType(Test) {
jvmArgs += "--enable-preview"
}
tasks.withType(JavaExec) {
jvmArgs += '--enable-preview'
}
sourceSets.main.java.srcDirs = [ "src/" ]
jar {
from('src') {
include '**/*.properties'
}
}
server
plugins {
id 'java'
id 'io.freefair.lombok' version '5.1.0'
id 'com.github.johnrengelman.shadow' version '5.2.0'
}
sourceCompatibility = 14
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.compilerArgs += "--enable-preview"
}
tasks.withType(Test) {
jvmArgs += "--enable-preview"
}
tasks.withType(JavaExec) {
jvmArgs += '--enable-preview'
}
sourceSets.main.java.srcDirs = [ "src/" ]
jar {
project.version="" // to remove version number from the built jar's name
manifest {
attributes 'Main-Class': 'com.marvelousbob.server.BobServerLauncher'
}
}
GitHub Actions yml file
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout#v2
- name: Setup with Java 14
id: java-setup
uses: actions/setup-java#v1
with:
java-version: 14
- name: Allow GitHub Actions to run Gradlew
run: chmod u+x gradlew
- name: Run Gradle build
id: gradle-build
uses: eskatos/gradle-command-action#v1
with:
arguments: shadowJar
# more stuff ...
What I've tried
So many things, for days! Here was the state of my last attempt.
Dockerfile
FROM alpine:3.7
COPY server/build/jpackage/server /server
FROM openjdk:14-jdk-alpine
COPY server/build/libs/server-all.jar /app.jar
COPY utils/deploys/bootstrap.sh /bootstrap.sh
RUN chmod +x /bootstrap.sh
EXPOSE 80
ENTRYPOINT ["./bootstrap.sh"]
bootstrap.sh
#!/bin/sh
echo "========== LAUNCHING SERVER APP ========="
cd /server/bin
chmod +x server
./server
build.gradle
root
Same as other one.
common
Same as other one.
server
plugins {
id 'java'
id 'io.freefair.lombok' version '5.1.0'
id 'org.beryx.runtime' version '1.8.4'
}
sourceCompatibility = 14
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.compilerArgs += "--enable-preview"
}
tasks.withType(Test) {
jvmArgs += "--enable-preview"
}
tasks.withType(JavaExec) {
jvmArgs += '--enable-preview'
}
sourceSets.main.java.srcDirs = [ "src/" ]
mainClassName = "com.marvelousbob.server.BobServerLauncher"
task dist(type: Jar) {
project.version="1" // adjust the CI/CD if you change this
manifest {
attributes 'Main-Class': project.mainClassName
}
from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
destinationDirectory = file("$buildDir/lib")
}
jpackageImage.dependsOn dist
dist.dependsOn classes
// JLink configuration to minimize size of generated jar
runtime {
options = ['--strip-debug',
'--compress', '2',
'--no-header-files',
'--no-man-pages',
'--strip-native-commands',
'--vm', 'server']
modules = ['java.base' ,
'java.desktop',
'jdk.unsupported']
distDir = file(buildDir)
jpackage {
//jpackageHome = '/usr/lib/jvm/open-jdk'
mainJar = dist.archiveFileName.get()
}
}
Github Actions yml file
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout#v2
- name: Setup with Java 14
id: java-setup
uses: actions/setup-java#v1
with:
java-version: 14
- name: Building with Gradlew
run: |
chmod u+x gradlew
./gradlew server:jpackageImage
# more stuff ...
#deduper seems to have figured it out (see https://chat.stackoverflow.com/rooms/222569/discussion-between-deduper-and-payne), but I didn't have time to go back and make sure his analysis is right.
In theory, it does make a lot of sense, so I'm posting it nonetheless as an answer:
I'm pretty sure the main cause of the errors you describe in your question is because you built the runtime on either Windows 10 or Ubuntu; then tried to deploy and run the runtime on Alpine.
I won't accept my answer because I haven't made a confirmation of this yet, but I'm nonetheless posting it in case others encounter this problem and want a probable clue.

Spring boot 2 Address already in use

I have a spring boot application which is a cron job that runs daily.
I recently migrated my spring boot application to 2.1.6 from 1.5.10 and Java from 8 to 11.
When deployed in the server this app is throwing an Exception:
java.net.BindException: Address already in use
It was working fine on the lower version.
I made sure there is no other services running on the port 8590.
Below is my gradle file:
plugins {
id 'org.springframework.boot' version '2.1.6.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'jdepend'
sourceCompatibility = 1.11
bootJar {
baseName = 'alerts-service'
}
checkstyle {
ignoreFailures = true
toolVersion = '8.2'
configDir = file("$rootProject.projectDir/etc/checkstyle")
System.setProperty('checkstyle.cache.file', String.format('%s/%s', buildDir, 'checkstyle.cachefile'))
}
repositories {
maven {
url "http://repo/repository/cmp-maven-releases"
}
maven {
url "http://repo/repository/cmp-maven-snapshots"
}
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-jdbc') {
exclude group: 'org.apache.tomcat', module: 'tomcat-jdbc'
}
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-mail')
compile("org.apache.axis:axis:1.4")
compile('org.apache.commons:commons-lang3:3.5')
compile('org.apache.httpcomponents:httpclient:4.3.4')
compile('org.apache.pdfbox:pdfbox:2.0.1')
compile("com.itextpdf:itextpdf:5.1.3")
compile("com.itextpdf:itext-xtra:5.1.3")
compile("com.itextpdf.tool:xmlworker:1.1.1")
compile("net.sf.ehcache:ehcache:2.10.3")
compile("commons-discovery:commons-discovery:0.5")
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.8.4")
compile('ch.qos.logback:logback-core:1.1.8')
compile('ch.qos.logback:logback-classic:1.1.8')
compile("wsdl4j:wsdl4j:1.6.2")
compile("javax.jms:jms:1.1")
compile("com.ibm:mq-mqjms:7.0.1")
compile('org.springframework:spring-jms:4.3.3.RELEASE')
runtime("com.ibm:mq-commonservices:7.0.1")
runtime("com.ibm:mq-headers:7.0.1")
runtime("com.ibm:mq:7.0.1")
runtime("com.ibm:mq-jmqi:7.0.1")
runtime("com.ibm:mq-pcf:7.0.1")
runtime("net.sf.jt400:jt400-full:5.4")
runtime("com.ibm:mq-mqcontext:7.0.1")
runtime("com.ibm:mq-dhbcore:7.0.1")
runtime("javax.transaction:jta:1.1")
runtime('com.microsoft:sqljdbc4:4.0')
testRuntime('com.h2database:h2')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile group: 'junit', name: 'junit', version: '4.4'
}
I have the port specified in my application.properties
server.port=8590
I tried with the below property as well that did not work
management.server.port=8590
management.endpoints.web.exposure.include=*
management.endpoint.shutdown.enabled=true
endpoints.shutdown.enabled=true
Any hints would be greatly appreciated.
EDIT :
I tried killing the PID of this service and triggered startup script. I did work and for the next execution it thrown the same error again.
Looks like somehow shutdown has to happen after each execution.
srartup.sh
nohup /opt/jdk-11.0.2/bin/java -Xmx768m -Xms256m -Dlogging.config=/opt/runnables/alerts-service/logback.xml -jar /opt/runnables/alerts-service/alerts-service.jar --spring.profiles.active=qa &> logs/console.log&
Check which process is using the port,
In windows
netstat -ano | find "8080"
In linux
netstat -nap | grep 8080
If someone else is using that port, you have to use another port or kill that other process and let the port free.
Finally I found the solution. By adding the application context closing tag has worked for me in main class.
SpringApplication.run(AlertsApplication.class, args).close();

Error:Abnormal build process termination, while compiling kotlin file in IntelIj

Trying to compile kotlin file in Intelij and getting the following error with long trace:
Error:Abnormal build process termination:
/home/stayal0ne/Desktop/kotlin-env/jdk-8u171-linux-arm64-vfp-hflt/jdk1.8.0_171/bin/java -Xmx700m -Djava.awt.headless=true -Djava.endorsed.dirs=\"\" -Djdt.compiler.useSingleThread=true -Dpreload.project.path=/home/stayal0ne/trash/KotlinTelegramBot -Dpreload.config.path=/home/stayal0ne/.IntelliJIdea2018.1/config/options -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djava.net.preferIPv4Stack=true -Dio.netty.initialSeedUniquifier=-2445885864882950180 -Dfile.encoding=UTF-8 -Duser.language=en -Duser.country=US -Didea.paths.selector=IntelliJIdea2018.1 -Didea.home.path=/home/stayal0ne/Downloads/idea/idea -Didea.config.path=/home/stayal0ne/.IntelliJIdea2018.1/config -Didea.plugins.path=/home/stayal0ne/.IntelliJIdea2018.1/config/plugins -Djps.log.dir=/home/stayal0ne/.IntelliJIdea2018.1/system/log/build-log -Djps.fallback.jdk.home=/home/stayal0ne/Downloads/idea/idea/jre64 -Djps.fallback.jdk.version=1.8.0_152-release -Dio.netty.noUnsafe=true -Djava.io.tmpdir=/home/stayal0ne/.IntelliJIdea2018.1/system/compile-server/kotlintelegrambot_48229f77/_temp_ -Djps.backward.ref.index.builder=true -Dkotlin.incremental.compilation=true -Dkotlin.daemon.enabled -Dkotlin.daemon.client.alive.path=\"/tmp/kotlin-idea-6368009607740488460-is-running\" -classpath /home/stayal0ne/Downloads/idea/idea/lib/jps-launcher.jar:/home/stayal0ne/Desktop/kotlin-env/jdk-8u171-linux-arm64-vfp-hflt/jdk1.8.0_171/lib/tools.jar:/home/stayal0ne/Downloads/idea/idea/lib/optimizedFileManager.jar org.jetbrains.jps.cmdline.Launcher /home/stayal0ne/Downloads/idea/idea/lib/platform-api.jar:/home/stayal0ne/Downloads/idea/idea/lib/annotations.jar:/home/stayal0ne/Downloads/idea/idea/lib/guava-21.0.jar:/home/stayal0ne/Downloads/idea/idea/lib/commons-logging-1.2.jar:/home/stayal0ne/Downloads/idea/idea/lib/aether-dependency-resolver.jar:/home/stayal0ne/Downloads/idea/idea/lib/idea_rt.jar:/home/stayal0ne/Downloads/idea/idea/lib/nanoxml-2.2.3.jar:/home/stayal0ne/Downloads/idea/idea/lib/snappy-in-java-0.5.1.jar:/home/stayal0ne/Downloads/idea/idea/lib/netty-all-4.1.13.Final.jar:/home/stayal0ne/Downloads/idea/idea/lib/httpclient-4.5.2.jar:/home/stayal0ne/Downloads/idea/idea/lib/jna.jar:/home/stayal0ne/Downloads/idea/idea/lib/log4j.jar:/home/stayal0ne/Downloads/idea/idea/lib/jps-builders.jar:/home/stayal0ne/Downloads/idea/idea/lib/asm-all.jar:/home/stayal0ne/Downloads/idea/idea/lib/jgoodies-forms.jar:/home/stayal0ne/Downloads/idea/idea/lib/aether-1.1.0-all.jar:/home/stayal0ne/Downloads/idea/idea/lib/util.jar:/home/stayal0ne/Downloads/idea/idea/lib/javac2.jar:/home/stayal0ne/Downloads/idea/idea/lib/resources_en.jar:/home/stayal0ne/Downloads/idea/idea/lib/trove4j.jar:/home/stayal0ne/Downloads/idea/idea/lib/jps-model.jar:/home/stayal0ne/Downloads/idea/idea/lib/oro-2.0.8.jar:/home/stayal0ne/Downloads/idea/idea/lib/jps-builders-6.jar:/home/stayal0ne/Downloads/idea/idea/lib/httpcore-4.4.5.jar:/home/stayal0ne/Downloads/idea/idea/lib/jna-platform.jar:/home/stayal0ne/Downloads/idea/idea/lib/protobuf-java-3.0.0.jar:/home/stayal0ne/Downloads/idea/idea/lib/maven-aether-provider-3.3.9-all.jar:/home/stayal0ne/Downloads/idea/idea/lib/lz4-java-1.3.jar:/home/stayal0ne/Downloads/idea/idea/lib/forms_rt.jar:/home/stayal0ne/Downloads/idea/idea/lib/slf4j-api-1.7.10.jar:/home/stayal0ne/Downloads/idea/idea/lib/commons-codec-1.9.jar:/home/stayal0ne/Downloads/idea/idea/lib/jdom.jar::/home/stayal0ne/Downloads/idea/idea/plugins/gradle/lib/gradle-api-4.4.jar:/home/stayal0ne/Downloads/idea/idea/plugins/gradle/lib/gradle-api-impldep-4.4.jar:/home/stayal0ne/Downloads/idea/idea/lib/ant/lib/ant.jar:/home/stayal0ne/Downloads/idea/idea/lib/groovy-all-2.4.12.jar:/home/stayal0ne/Downloads/idea/idea/lib/gson-2.8.2.jar:/home/stayal0ne/Downloads/idea/idea/lib/slf4j-api-1.7.10.jar:/home/stayal0ne/Downloads/idea/idea/lib/slf4j-log4j12-1.7.10.jar:/home/stayal0ne/Downloads/idea/idea/lib/gson-2.8.2.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/jarutils.jar:/home/stayal0ne/Downloads/idea/idea/lib/guava-21.0.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/android-base-common.jar:/home/stayal0ne/Downloads/idea/idea/plugins/gradle/lib/gradle-api-4.4.jar:/home/stayal0ne/Downloads/idea/idea/lib/gson-2.8.2.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/jarutils.jar:/home/stayal0ne/Downloads/idea/idea/lib/guava-21.0.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/android-base-common.jar:/home/stayal0ne/Downloads/idea/idea/plugins/gradle/lib/gradle-api-4.4.jar:/home/stayal0ne/Downloads/idea/idea/plugins/ant/lib/ant-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/uiDesigner/lib/jps/ui-designer-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/IntelliLang/lib/intellilang-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/Groovy/lib/groovy-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/Groovy/lib/groovy-rt-constants.jar:/home/stayal0ne/Downloads/idea/idea/plugins/eclipse/lib/eclipse-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/eclipse/lib/common-eclipse-util.jar:/home/stayal0ne/Downloads/idea/idea/plugins/maven/lib/maven-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/maven/lib/plexus-utils-2.0.6.jar:/home/stayal0ne/Downloads/idea/idea/plugins/osmorc/lib/osmorc-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/osmorc/lib/bndlib-3.3.0.jar:/home/stayal0ne/Downloads/idea/idea/plugins/osmorc/lib/bnd-repository-3.3.0.jar:/home/stayal0ne/Downloads/idea/idea/plugins/osmorc/lib/bnd-resolve-3.3.0.jar:/home/stayal0ne/Downloads/idea/idea/plugins/osmorc/lib/plexus-utils-3.0.10.jar:/home/stayal0ne/Downloads/idea/idea/plugins/osmorc/lib/bundlor-all.jar:/home/stayal0ne/Downloads/idea/idea/plugins/aspectj/lib/aspectj-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/flex/lib/flex-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/flex/lib/flex-shared.jar:/home/stayal0ne/Downloads/idea/idea/plugins/gradle/lib/gradle-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/devkit/lib/devkit-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/JavaEE/lib/javaee-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/JavaEE/lib/jps/jpa-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/webSphereIntegration/lib/jps/webSphere-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/weblogicIntegration/lib/jps/weblogic-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/dmServer/lib/dmServer-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/GwtStudio/lib/gwt-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/GoogleAppEngine/lib/google-app-engine-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/GoogleAppEngine/lib/appEngine-runtime.jar:/home/stayal0ne/Downloads/idea/idea/plugins/Grails/lib/grails-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/Grails/lib/grails-compiler-patch.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/jps/android-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/android-common.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/build-common.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/android-rt.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/sdk-common.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/repository.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/sdklib.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/android-base-common.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/jarutils.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/layoutlib-api.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/manifest-merger.jar:/home/stayal0ne/.IntelliJIdea2018.1/config/plugins/Kotlin/lib/jps/kotlin-jps-plugin.jar:/home/stayal0ne/.IntelliJIdea2018.1/config/plugins/Kotlin/lib/kotlin-stdlib.jar:/home/stayal0ne/.IntelliJIdea2018.1/config/plugins/Kotlin/lib/kotlin-reflect.jar:/home/stayal0ne/.IntelliJIdea2018.1/config/plugins/Kotlin/lib/kotlin-plugin.jar:/home/stayal0ne/.IntelliJIdea2018.1/config/plugins/Kotlin/lib/android-extensions-ide.jar:/home/stayal0ne/.IntelliJIdea2018.1/config/plugins/Kotlin/lib/android-extensions-compiler.jar:/home/stayal0ne/Downloads/idea/idea/plugins/javaFX/lib/javaFX-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/javaFX/lib/common-javaFX-plugin.jar org.jetbrains.jps.cmdline.BuildMain 127.0.0.1 41993 1e0f5647-4e35-4812-b8b7-bd7025d7eae3 /home/stayal0ne/.IntelliJIdea2018.1/system/compile-server
/home/stayal0ne/Desktop/kotlin-env/jdk-8u171-linux-arm64-vfp-hflt/jdk1.8.0_171/bin/java: 6: /home/stayal0ne/Desktop/kotlin-env/jdk-8u171-linux-arm64-vfp-hflt/jdk1.8.0_171/bin/java: Syntax error: ")" unexpected
Tried to use various jdk versions and all of them show the same error.
Main.kt:
import org.telegram.*
import org.telegram.telegrambots.TelegramBotsApi
import org.telegram.telegrambots.api.objects.Update
import org.telegram.telegrambots.bots.TelegramLongPollingBot
import java.util.*
fun main(args : Array<String>) {
println("Hello, world!")
}
and build.gradle:
buildscript {
ext.kotlin_version = '1.2.41'
repositories {
maven { url "http://repo.maven.apache.org/maven2/" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: "java-library"
apply plugin: "kotlin"
apply plugin: "java"
apply plugin: 'application'
mainClassName = 'main.Main'
repositories {
// mavenCentral()
maven { url "http://jcenter.bintray.com" }
}
dependencies {
implementation 'org.hibernate:hibernate-core:3.6.7.Final'
api 'com.google.guava:guava:23.0'
testImplementation 'junit:junit:4.+'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
dependencies {
compile "org.telegram:telegrambots:3.6"
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
I'm building the project using gradle 4.8 and java version "1.8.0_171".
Any help will be appreciated
/home/stayal0ne/Desktop/kotlin-env/jdk-8u171-linux-arm64-vfp-hflt/jdk1.8.0_171/bin/java
You are using an arm64 JDK, which may not be your current hardware platform. You should reinstall JDK with platform x86_64 or other which fits your hardware.
Also, it seems you are using Linux, then you may use package manager to install the correct version of JDK and JRE automatically, like sudo apt install openjdk-8-jdk. (It doesn't matter to use OracleJDK or OpenJDK)

tomcatRun with com.bmuschko.tomcat-base in gradle shows 404 or empty page

I'm using gradle and com.bmuschko.tomcat 2.0 plugin in NetBeans IDE 8.0.2 to tun my web application in local tomcat 6 container. If i run "tomatRunWar" everything works fine and in browser i can see my working web application. But if i try "tomcatRun" there is a 404 error that says, that the path "/" can not be found.
Here is my build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.bmuschko:gradle-tomcat-plugin:2.0"
}
}
plugins {
id "com.bmuschko.tomcat" version "2.0"
}
apply plugin: 'base'
apply plugin: 'java'
apply plugin: 'com.bmuschko.tomcat-base'
apply plugin: 'war'
sourceCompatibility = 1.7
targetCompatibility = 1.7
if (!hasProperty('mainClass')) {
ext.mainClass = ''
}
sourceSets {
main {
java {
srcDir '/src/main/java'
}
resources {
srcDir '/src/main/java'
include '**/*.xml'
}
}
}
war {
archiveName = 'Frontend.war'
exclude('**/*.java,**/*.form')
}
[tomcatRun, tomcatRunWar]*.contextPath = '/frontend'
[tomcatRun, tomcatRunWar]*.reloadable = true
[tomcatRun, tomcatRunWar]*.configFile = file('src/main/webapp/META-INF/context.xml')
[tomcatRun, tomcatRunWar]*.httpPort = 8080
[tomcatRun, tomcatRunWar, tomcatStop]*.stopPort = 8081
[tomcatRun, tomcatStop]*.stopKey = 'stopKey'
task run << {
//println "Stopping tomcat container"
//tomcatStop.execute()
println "Start tomcat container"
//tomcatRunWar.execute()
tomcatRun.execute()
}
dependencies {
providedCompile 'javax.servlet:servlet-api:2.5',
'javax.servlet:jsp-api:2.0'
def tomcatVersion = '6.0.35'
tomcat "org.apache.tomcat:catalina:${tomcatVersion}",
"org.apache.tomcat:coyote:${tomcatVersion}",
"org.apache.tomcat:jasper:${tomcatVersion}"
}
What's wrong in my build.gradle? What is the difference between the startup from "tomcatRunWar" and "tomcatRun"?
The startup log from "tomcatRun" shows this ("tomcatRunWar" don't show the error message):
The Server is running at http://localhost:8080/frontend
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/testuser/.gradle/wrapper/dists/gradle-2.1-bin/2pk0g2l49n2sbne636fhtlet6a/gradle-2.1/lib/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/testuser/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-log4j12/1.7.2/7539c264413b9b1ff9841cd00058c974b7cd1ec9/slf4j-log4j12-1.7.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Here is my context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/frontend"/>

Categories

Resources