I have a working Spring MVC application(doing everything I wanted when deployed to jboss) and now I'm looking a way how to start my application from a jar. What I've though of is when starting jar, first some kind of web server should be started in order to be able to run the application.
And I've tried like a tons of combinations with jetty(lost about 2 days already), and I failed every one of them, mostly suggestions from https://stackoverflow.com/tags/embedded-jetty/hot
My main weakness is that I don't really have thorough understanding of servlets, contexts and so on. Terms which I see on a regular basis while browsing google search, maybe I found a solution already but didn't understand it.
Has anyone done something similar? And yes I've asked similar question for tomcat :
Maven tomcat plugin
Yes, I've done this sort of this several times, and it's fairly straight forward if you know how the bits work.
Since you've explained that you don't know how the bits work, that's going to be a bit harder :)
But they're not too hard to learn, and the easiest way to learn is by doing - so you're heading down the right path.
The accepted answer here: Executable war file that starts jetty without maven is some of the best advice you're going to get on this topic.
I would suggest:
Create a WAR to start with (which you probably have from your JBoss deployment)
Get that WAR running under standard Jetty (fairly straight forward, with lots of tutorials around)
Then follow the advice I linked to, to turn embedded Jetty into your WAR file.
If you run into any issues, ask specific questions with specific examples of what went wrong, and we'll try and help out.
Related
I have a java application that uses swing and I would like to share it on my website, so that users who have no JRE on their computers can open it.
First, I naively thought that a link to download a .jar was enough but now I realize that it needs a JRE to be launched properly.
So then, I looked for other solutions and I searched information for the applets, until I understood that it was now obsolete.
Eventually, I tried to understand that Java Web Start thing but I am completely lost, as it needs several files to be created and to setup the server. The tutorials I found weren't very clear... As I am an Eclipse user, I tried to look for a plugin that would do this automatically but I cannot find anything.
Do you know a plugin or is there a simpler possibility to share this very simple java application in a website ? Or do I have to try and try again to deploy my application through Java web start.
Thank you for your answers :)
I have been trying to start with studying OSGI for quiet a few days now. I've tried many tutorials to work on eclipse especially to start with apache felix or Equinox but the step by step tutorials never take me to the end of creating even one bundle.
I even tried the console commands with no luck. Is OSGI out dated? All the tutorials on the alliance web site are also extremely old and I couldn't follow them to the end. I also tried the BndTools Totorial here but on eclipse it couldn't resolve "#Component" when I reach 4.3 so I stopped there. When following Osgi Book Preview, I also couldn't find "Make Bundle" so I stopped again. I'm really frustrated. Isn't there a way for beginners to get into OSGI?
UPDATE:
For other people who are interested in getting started with OSGI, I found the book Osgi in Action as very helpful and a good guide for beginners.
The Bndtools tutorial was mentioned and dismissed in the original question; however we were able to resolve the issue. So I post this as an answer for others who might be looking for an introductory OSGi tutorial: check out the Bndtools Tutorial!
Actually there are two questions being posed here, which I asked myself recently as well, one in the title and one in the content. The question in the title seems mostly rhetorical. It expresses a notional answer for the real question that you find at the end of the text: "I'm really frustrated. Isn't there a way for beginners to get into OSGI?"
Answer: There are ways, but they aren't as easy as they should be. The "update" to the question mentions "OSGi in Action". This is a good book (which I discovered too late, it's not really on the top of the search results), but quite outdated with respect to tooling (e.g. Bndtools appears in the appendix only).
Finding no easy way for beginners, I eventually started to dig my way through the topic using an eclectic selection of resources found on the web. I documented my experience in what you might call a log of my (ongoing) journey in the hope that it may be helpful to others. I'll leave it to you to judge whether this can be considered a shy "yes" to the question, after all.
Not having reached "the end of my journey" yet, I'm not perfectly sure why there are so few up-to-date resources for beginners to get into OSGi. I suppose that the attention that OSGi got from a lot of people because it was used in Eclipse was one of the first problems. The attempt of the OSGi alliance to align with enterprise edition features was another (there are references for this, but I'm not allowed to post more than 2 links). Both incidents led first to hype (and lots of articles) and then to disappointment. In the time following, experts understood the technology better and better and applied it successfully to the problem domains where it is of use. (And these are fewer than the initial hype suggested -- or different, OSGi may regain some attention with the IoT.) But as it is often the case in such cases, the (now) experts never felt tempted to write the kind of introductions that you find during the hype-phase of a new technology.
Which brings me back to the question from the title, after all: "Is there a new standard?" (which implies whether it is worth to spend time on looking into OSGi). The answer depends on what aspects of OSGi are important to you. Project JigSaw aims to bring modules to the Java platform and to developers. With a target date of March 2017 for the central JSR 376 I'd say this might be called an "upcoming standard" (provided it gets finished). But OSGi is more than just modules. Other key features are dynamic configuration (I can't see any competing standard regarding this feature) and micro-Services (be careful about that term, it seems to have two different interpretations currently). Eventually, you have to look a bit into OSGi yourself to decide on its usefulness for your project.
You can check tutorials that help you start with OSGi OSGi Tutorial: From project structure to release and OSGi Tutorial: 4 ways to activate code in OSGi bundle
There's a lot of outdated tutorials out there, outdated documentation, and stuff which is deep in the Java EE thinking bog - incomprehensible if you're not familiar with the problems arising from the solution to the problems arising from the solution to some obscure Java decision in the previous millennium, which you're now stuck with in your mammoth EE app.
Today, there is the OSGi enRoute projects which provides a set of pretty nice tutorials, along with an OSGi "distribution" which makes dependency resolution easier. My understanding is that a lot of the additional services in enRoute are en route (ha!) to becoming the OSGi Release 7 standard.
If you want to do new development in OSGi, it's what I would go to for sure. In fact, even if you want to use OSGi in some legacy-support function, I'd read up on the enRoute way first, before getting into all the ugly compromises needed for legacy's sake.
If you are mainly looking for server side OOGi then using maven and the maven bundle plugin works very well. See http://www.liquid-reality.de/display/liquid/2011/02/15/Karaf+Tutorial+Part+1+-+Installation+and+First+application
Apache Karaf is an OSGi container that I believe makes OSGi, 'easier,' to understand and work with. You might consider getting this installed and just try it out. Documentation is pretty good as well. Take some time learning about a running OSGi container; watch it run first trying out a few commands and then deploy some simple bundles while putting a tail on the karaf.log.
Seeing Karaf running will help you understand more about OSGi and what it takes to get a bundle built and deployed/running.
IMHO: Both BndTools and Maven Bundle plugin are fantastic resources for OSGi development.
I am on a project that uses GWT/ eclipse/ SQL Developer and the guy who originally implemented it is no longer on the project. We have a normal WAR and everything but the jsp files are kept in a different environment. Anyone know why? Can they not be run through GWT?
The issue we are facing is the only way we have to test/ compile JSPs is to actually deploy it into DEV which takes a lot of time. So we are in need of being able to run JSPs locally.
I have been told someone used to use Jdeveloper to do this, but I am unfamiliar with it and the only YouTube tutorials are in a foreign language (in regards to using JSPs with JDeveloper 11g). Someone else suggested notepad/ Tomcat? Or yet another option would be to configure eclipse to run it with our current project in GWT?
I am not familiar with any of this being I am brand new to JSPs,Tomcat, etc. and am in desperate need of some help.
What is the best way to accomplish my needs and are there any guides/ tutorials to help me through the process?
My requirements are just to run a folder with 4 linked jsps and be able to connect to the database to provide the information.
"I am not familiar with any of this being I am brand new to
JSPs,Tomcat, etc. and am in desperate need of some help."
That's sounds true!
One answer about the different environments is that jsp needs "EE" .I.E. EclipseEE but the GWT app just uses plain old eclipse (like an eclipse helios release with GWT plugin).
Regarding your requirements, I can't understand them clearly enough to begin to provide helpful information, but good luck.
Tony
I am just familiar with OSGi technology - never used but heard of it so many times. I've read several articles "for dummies" but I think I still fail to understand its use case completely. Maybe some of you could confirm if I understood it correctly.
Here is an example of what I might want to do.
Let us assume that I want to build a Java web application. Simple war. But, organized in such way that it contains different modules. Each module would contain different functionalities. Maybe each module would be packed as a separate jar, I am not sure.
Now, what I would like to have is UI part of the app capable of checking which of the modules are deployed too in order to show (or not) related menus, items, parts of pages, etc...
So, is the OSGi technology solution for this kind of problems or not? Is this what it is intended to be used for or am I off the track?
Thank you in advance for your answers.
Yes, OSGi technology is a solution for the kind of problem you mentioned in your question.
Eclipse is one solution that uses OSGi technology. In Eclipse, the UI would be an Eclipse Rich Client Platform (RCP), while the other modules would be Eclipse plug-ins. Each module would be a separate package that includes more components than a JAR.
You can use other solution platforms, or write all of the OSGi code yourself. The idea behind OSGi is to make your application more modular, so that you can update pieces of your application without having to update the entire application.
So, is the OSGi technology solution for this kind of problems or not? Is this what it is intended to be used for or am I of the track?
I would say this is exactly the kind of scenario OSGi caters for.
Look into the Eclipse RAP project, which runs on top of the Equinox OSGI container, and does the kind of thing you describe.
Some excellent tutorials are available on vogella.de.
Vaadin is an osgi based web framework in which you can accomplish this.
Alternatively you could have a look at the OSGI and Equinox book, it should contain enough info to help you roll your own solution.
I am deploying new versions of java servlets with JRun as the host. I am having difficulty finding good sources for information about JRun and tutorials about how to configure and manage it.
After installing JRun and opening the launcher it can't start the admin server that it creates by default...so obviously I'm running into some issues just getting started.
edit for clarity: I'm not looking for an answer or help with a specific error but if anyone knows of good sources for information about JRun and how to work with it so I can quickly bring myself up to speed on it.
Jrun development has pretty much stopped. You should look into running another application server. Jboss or Glassfish are good alternatives.
This is probably going to be difficult to resolve unless you post either the error message from the log file or the list of steps that you took so far.
I have JRun 3.1 configured on my machine so maybe I can duplicate your issue if you give us more information.
I didn't know JRun was even still in existence since 1999 or something like that. Anyway, Tomcat or Jetty would be my easy replacements. Tomcat for its scriptability from ANT etc and Jetty for its pure simplicity (start an instance in 5 lines of code!).
Glassfish is a huge system with many components, if you just want to host vanilla servlets and JSPs etc. then I would go for one of the above.