I'm trying to start an OSGi console in Windows 7.
I used this statement on a terminal window:
java -jar org.eclipse.osgi.jar -console
But it doesn't work that is nothing does happen nor doesn't appear prompt osgi>. And typing on keyboard is ineffective except for ^C that makes to reappear usual terminal prompt.
Anyone has any suggestion?
Starting from Equinox 3.8.0.M4, it has a new console. So you need also these four bundles for it to run properly.
org.eclipse.equinox.console.jar
org.apache.felix.gogo.shell.jar
org.apache.felix.gogo.command.jar
org.apache.felix.gogo.runtime.jar
These jar files can be found in your Eclipse installation folder under 'plugins' folder. Copy these jars and put them in the same folder with your org.eclipse.osgi.jar and it would look like:
somedir/
configuration/
config.ini
org.eclipse.osgi.jar
org.eclipse.equinox.console.jar
org.apache.felix.gogo.shell.jar
org.apache.felix.gogo.command.jar
org.apache.felix.gogo.runtime.jar
Then edit config.ini as:
osgi.bundles=org.apache.felix.gogo.runtime#start, org.apache.felix.gogo.command#start, org.apache.felix.gogo.shell#start, org.eclipse.equinox.console#start
After doing this, run java -jar org.eclipse.osgi.jar -console in your command line and the OSGi console will start.
Reference Bug 371101
UPDATE 06/2022:
the list of required bundles got longer in the meantime:
osgi.bundles= \
org.apache.felix.gogo.runtime_1.1.4.v20210111-1007.jar#start, \
org.apache.felix.gogo.command_1.1.2.v20210111-1007.jar#start, \
org.apache.felix.gogo.shell_1.1.4.v20210111-1007.jar#start, \
org.eclipse.equinox.console_1.4.500.v20211021-1418.jar#start, \
org.eclipse.osgi.services_3.10.200.v20210723-0643.jar#start, \
org.osgi.util.function_1.2.0.202109301733.jar#start, \
org.osgi.util.promise_1.2.0.202109301733.jar#start, \
Note that you can reference the org.eclipse.osgi directly in the plugin folder. And if you do so, your configuration folder is in the plugins folder!
java -jar plugins\org.eclipse.osgi_3.18.0.v20220516-2155.jar -console
The equinox built-in console is deprecated and disabled since version 3.8. If you use a newer version, you should use the osgi.console.enable.builtin=true property. See http://hwellmann.blogspot.hu/2012/08/new-osgi-console-in-equinox-380.html.
You can set these properties as system properties. Your command will be:
java -Dosgi.noshutdown=true -Dosgi.console.enable.builtin=true -jar org.eclipse.osgi.jar -console
This worked for me with 3.8. I have just tried it with 3.10 but it does not work. I guess the builtin console is removed completely.
You should use the gogo console that has become a de-facto standard. You can find information about it at the link above.
You can also change the directory where the eclipse plugins reside and issue a command similar to:
java -Dosgi.bundles=.\org.apache.felix.gogo.shell_1.1.0.v20180713-1646.jar#start,.\org.apache.felix.gogo.command_1.0.2.v20170914-1324.jar#start,.\org.apache.felix.gogo.runtime_1.1.0.v20180713-1646.jar#start,.\org.eclipse.equinox.console_1.3.100.v20180827-1235.jar#start -jar org.eclipse.osgi_3.13.100.v20180827-1536.jar -console
This will start the osgi console
Related
I follow the instructions in https://spring.io/guides/gs/spring-boot/#scratch, but when it says to run:
./gradlew build && java -jar build/libs/gs-spring-boot-0.1.0.jar
the build fails with the above error.
There is message before the failure that says:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings
but everyone online says that's just a warning.
The build doesn't appear to create or download build/libs/gs-spring-boot-0.1.0.jar.
Currently completely blocked on first attempt to use Gradle.
I just had this problem.
The tutorial is in error in what you need to run. It should be
$ gradlew build && java -jar build/libs/gs-rest-service-0.1.0.jar
I think that they updated the code, but forgot to update the tutorial.
I had the same issue when build a simple project with Maven on Intellij IDEA. (Ubuntu 18.04.2).
Just typed terminal (in project directory):
$ sudo mvn package
$ java -jar ./target/(your-project-name)-(<version> at pom.xml).jar
For example my project name is hello-world-spring and version name in pom.xml is <version>0.0.1-SNAPSHOT</version>, I have to type:
$ sudo mvn package
$ java -jar ./target/hello-world-spring-0.0.1-SNAPSHOT.jar
Maybe this method can work for gradle as well.
Please check the path of the jar file build/libs/gs-spring-boot-0.1.0.jar. For your case, the jar might be in a different folder. If your code is in a module in the main project, then the jar will be in the build folder of the module.
If you git clone the repo, then the tutorial works. If you "To start from scratch, move on to Build with Gradle.", then the tutorial doesn't work. There are missing setup steps.
I got the same issue and I changed the command to java -jar target/rest-service-0.0.1-SNAPSHOT.jar (I checked the .jar file in target folder and found that the file name was incorrect).
Parent folder of my project was having spaces in it's name, i changed it to the underscore and it worked.
Looked at the command line as it was in the official guide:
./gradlew clean build && java -jar build/libs/gs-actuator-service-0.1.0.jar
First, the above command line has two parts:
(1) ./gradlew clean build //Use gradle wrapper to build
(2) java -jar build/libs/gs-actuator-service-0.1.0.jar //To run an application packaged as a JAR file
Now, one might run into issues with one part or both parts. Separating them and running just on thing at a time helped troubleshoot.
(1) didn't work for my Windows, I did the following instead and that built the application successfully.
.\gradlew.bat clean build
Now moving to (2) java -jar build/libs/gs-actuator-service-0.1.0.jar
It literally means that "Run a jar file that is called gs-actuator-service-0.1.0.jar under this directory/path: build/libs/" Again, for Windows, this translates to build\libs\ , and there's one more thing that may catch you: The jar file name can be slightly different depending on how it was actually named by the configuration in initial/setting.gradle:
rootProject.name = 'actuator-service'
Note that the official guide changed it from 'gs-actuator-service' to 'actuator-service' in their sample code but hasn't updated the tutorial accordingly. But now you know where the jar file name comes from, that doesn't matter anymore, and you have the choice to rename it however you want.
Having all the factors adjusted, below is what eventually worked in my case:
java -jar build\libs\actuator-service-0.0.1-SNAPSHOT.jar
or
java -jar C:\MyWorkspace\Spring\gs-actuator-service\initial\build\libs\actuator-service-0.0.1-SNAPSHOT.jar //with fully qualified path
If you are curious where does "-0.0.1-SNAPSHOT" come from, here it is:
in build.gradle
version = '0.0.1-SNAPSHOT'
Again, you have the choice to modify it however you want. For example, if I changed it to 0.0.2-SNAPSHOT, the command line should be adjusted accordingly
java -jar build\libs\actuator-service-0.0.2-SNAPSHOT.jar
Reference: https://docs.oracle.com/javase/tutorial/deployment/jar/basicsindex.html
Because you are trying to execute .jar file that doesn't exist. After building the project go to ./build/libs and check the name of freshly built .jar file and then in your project directory run:
./gradlew build && java -jar build/libs/name-of-your-jar-file.jar
or you can set version property to empty string in your build.gradle file
version = ''
after that:
./gradlew build && java -jar build/libs/your-project-name.jar
For Windows, these commands solved the problem: "Error: Unable to access jarfile springboot.jar":
cd target
java -jar springboot-0.0.1-SNAPSHOT.jar
run ./mvnw package
Now a folder named target is created and you can see a jar file inside it.
then execute java -jar target/<jarfilename>
We have a Spring Boot application which is built as an executable jar and runs fine using both the Oracle and OpenJDK JREs (using 1.8 versions).
Attempting to run it using the IBM 1.8 JRE however results in the following error at the command line.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
This occurs if we execute the jar (using ./application.jar) or using java -jar application.jar
This led us to change the packaging to not make the jar executable and this allows us to start the application using java -jar application.jar. So it appears the IBM JRE doesn't like the launch script.
The problem is we don't want to have two packaging methods for different deployment environments, if possible.
Does anyone have any experience of why the IBM JRE doesn't like the script on the front of the jar file and whether there are any command line options to disable whatever checking its doing?
From your post it is unclear if you have problem with
1) running jar from Linux like chmod a+x application.jar and executing
Or
2) running via /opt/IBM/java/jre/bin/java -jar application.jar
For option 1) it is not a good idea as you do not explicitly choose jvm binary and rely on OS to choose one for you.
Read about binfmt_misc mechanism:
https://en.m.wikipedia.org/wiki/Binfmt_misc
For option 2)-it might be class loading problem, please add
/opt/IBM/java/jre/bin/java -verbose:class -jar application.jar
and consult documentation here: https://www.ibm.com/developerworks/library/j-dclp1/index.html
I want to start the latest Equinox framework but I'm stuck. I downloaded the latest version and tried to execute the command into windows prompt:
C:\equinox\plugins>java -jar org.eclipse.osgi_3.10.100.v20150529-1857.jar -console
But nothing happens. Do you know how I can start the framework?
EDIT
I downloaded launchers-win32.win32.x86_64.Mars.zip
C:\equin\eclipse\plugins>java -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dosgi.console.enable.builtin=true -jar org.eclipse.equinox.la
uncher_1.3.100.v20150511-1540.jar -console
An error has occurred. See the log file
c:\equin\eclipse\configuration\1435578389939.log
C:\equin\eclipse\plugins>
In error log I get this:
!SESSION Mon Jun 29 14:44:18 IDT 2015 ------------------------------------------
!ENTRY org.eclipse.equinox.launcher 4 0 2015-06-29 14:44:18.529
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.RuntimeException: Could not find framework
at org.eclipse.equinox.launcher.Main.getBootPath(Main.java:1025)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:588)
at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
at org.eclipse.equinox.launcher.Main.main(Main.java:1488)
Looks like starting standalone Equinox is very tricky.
It seems that sadly the build-in console is removed in equinox 3.10 so the osgi.console.enable.builtin=true system property will not work. It was useful when someone wanted to start equinox with a console rapidly, without adding any more bundles.
To use the gogo shell, there are many tutorials. In short:
Download the following artifacts (they are in the zip of Equinox Mars):
org.eclipse.equinox.console_1.1.100.v20141023-1406.jar
org.apache.felix.gogo.runtime_0.10.0.v201209301036.jar
org.apache.felix.gogo.shell_0.10.0.v201212101605.jar
org.apache.felix.gogo.command_0.10.0.v201209301215.jar
Run the command:
java -Declipse.ignoreApp=true -Dosgi.bundles=reference:file:org.eclipse.equinox.console_1.1.100.v20141023-1406.jar#start,reference:file:org.apache.felix.gogo.runtime_0.10.0.v201209301036.jar#start,org.apache.felix.gogo.shell_0.10.0.v201212101605.jar#start,org.apache.felix.gogo.command_0.10.0.v201209301215.jar#start -jar org.eclipse.osgi_3.10.100.v20150529-1857.jar -console -consoleLog
Alternatively, you can specify osgi.bundles in the config.ini file of equinox if there is one.
You can put the necessary jars into a subfolder. In that case, you must use the relative path after reference:file:. E.g.: reference:file:lib/myjar.jar.
Edit
I uploaded two samples (one with config.ini and one without) to here: https://drive.google.com/file/d/0B1GigvByKQkIbFRqbjFvbmNYdk0/view?usp=sharing
There are pre-configured Equinox OSGi Starter Kits available from eclipse itself. They are somehow tricky to find. Open the Equinox Project Download page and click on the blue triangle for OSGi starter kits.
Then you can download them for your platform. They have native executables but also valid configuration for "java -jar ..." executions.
I have found maven plugin to start tomcat.
Do Maven have any plugin to start Tomcat in debug mode?
If you're using Eclipse and you're running Maven externally (not using M2Eclipse) then you can use whatever command line command you usually use but use mvnDebug instead of mvn.
As an example, I run the tomcat plugin under the "run" profile so my normal command is:
mvn clean install -Prun
This uses the <maven-dir>/bin/mvn script but to run in debug mode, simply substitute <maven-dir>/bin/mvnDebug in.
mvnDebug clean install -Prun
If mvnDebug isn't on your PATH then you might have to use the full path to it (or create a link from a directory on your path, like /usr/bin, to it), e.g:
/path/to/maven-dir/mvnDebug clean install -Prun
I'm using maven 3.0.5 and the mvnDebug script comes out of the box. If you look inside it then you'll see it basically does what Titi Wangsa Bin Damhore says, but you'll note that suspend=y is used so the JVM waits for you to connect your debugger before continuing:
MAVEN_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
This may or may not be what you want.
we can cheat.
use java opts
in *IX
export JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044"
then run your maven,
it should go to debug mode
Can the Jetty server run on Windows-based environments. If there is a Windows installable, can someone please point me to it?
I found a good tutorial and the quick start documentation on the installation of Jetty in a windows environment. It's not simply an installer, but you merely unzip the files into a folder and run the command:
java -jar start.jar
in the folder where you unzipped it to start the server.
Jetty downloads
Reference: Jetty Quick Start
Updated:
1 – Downloading
You can download Jetty from two sources: Eclipse or Codehaus.
http://jetty.codehaus.org/jetty/
http://www.eclipse.org/jetty/downloads.php
2 - Simply uncompress the file to a directory.
3 – Running Jetty
Open a terminal.
Go to the Jetty installation directory.
Enter the following command:
$ java -jar start.jar
Now open a browser and go to localhost to check if Jetty was installed sucessfully:
http://localhost:8080/
In case you have jar file created by maven and has all the dependencies you will require following command.
java -jar XXX.SNAPSHOT.jar server config.yml
You can make your own XML based configuration file and pass it along with the startup command:
java -jar start.jar /path/to/jetty.xml
For example, if you want to use something else than 8080, then just put jetty.port inside the jetty.xml:
<Set name="port"><Property name="jetty.http.port" deprecated="jetty.port" default="9090" /></Set>
Or those who are impatient, can just start up their instance with:
java -jar start.jar --module=http jetty.port=9090
If you'r using Jetty version 9.x. You need to go to $JETTY_HOME/start.ini file and edit this setting jetty.http.port.
jetty.http.port=9090