equinox + sample.http - issue with tomcat 7 - osgi

I am importing sample.http from http://www.eclipse.org/equinox/server/http_in_container.php into eclipse , using tomcat 7 as server (linux platform).
It shows several problems such as :
BundleActivator cannot be resolved to a type
No available bundle exports package 'javax.servlet.http'
and several such errors due to plugin dependencies not being imported.
(If I try with tomcat 6,it works).
Can someone point out what changes I should make for making the dependencies compatible with tomcat 7 ?

The problem is the org.eclipse.equinox.http.servletbridge jar.
It exports Servlet javax.servlet 2.3 but for Tomcat 7 you need javax.servlet 3.0
Maybe you can open up the jar file and fix that, but I have wasted quite some time with this construction, and never got it right. It is 5 years old, and that means trouble.
For me Felix worked a lot better, there is a clearer and more consistent explanation.
Take a look here: apache felix
I think with this setup you could still use Equinox with the FrameworkLauncher, if that is necessary

Related

Why would upgrading from Java 8 to Java 17 require me to use the maven-war-plugin?

I am upgrading a project from Java 8 to Java 17 and I am receiving the error (in a pom.xml file) "Could not initialize class org.apache.maven.plugin.war.util.WebappStructureSerializer". I have updated the other dependencies in the pom file as part of the upgrade process as well. I have seen in other stack overflow posts that say this could mean one should update the maven-war-plugin. The thing is, I am not currently using that plugin. When I add it, it does fix the issue, but I am just wondering why that would be.
I suspect the following happened.
When you build a WAR, then the Maven War Plugin is called implicitly (you can see that in the logs).
For some reason, the version was older than the newest available version (maybe a caching problem, maybe parent POM etc.). By explictly setting the version of the Maven War Plugin, this problem vanishes.

How to Use JAXB with Java 11 Without Using Maven

As of Java 11 it is necessary to get JAXB from a separate library, not from the JDK. There are plenty of tutorials on the Web showing how to do that, but they all use Maven. The project I need to fix is an Eclipse RCP application. There does not seem to be an easy to make that work with Maven, as Maven essentially takes over most of what Eclipse would do but doesn't have RCP development capabilities.
Sooner or later Maven gets the required libraries. I would like to find another way to get and use whatever libraries are needed, just without using Maven. It should be possible. I just haven't found it.
Thanks.
I did what I wanted by downloading the needed JARs from https://mvnrepository.com/.

Using Openjfx 11 classes in an OSGi application

Does anyone know if there is a way to use JavaFX modules in eclipse workspace? I have an OSGi-maven multi-modular application.
Up until now, I have tried a couple of things.
To download JavaFX SDK and to add jars in eclipse as a user-defined library.
To bundle JavaFX jars and to use them as regular OSGi bundles after that (added as dependency and after that in target-platform).
Both of these things work. But, in the first case, every developer would have to manually add those jars as a library on the classpath. And in the second for every platform, we would have to have a different bundle for each module.
If I do neither of those things I have compile errors that JavaFX classes cannot be found (as expected).
Is there some third way to do this? By using some OSGi functionality or something like that?
I haven't found any way to add a module in MANIFEST.MF. Is that even possible?
I have added JavaFX modules as VM arguments in the OSGi framework launcher, and everything works fine. But I have to do one of those things mentioned before so that I don't have compile errors.
VM arguments: --module-path /path/to/javafx/sdk/11/lib --add-modules javafx.controls,javafx.graphics,javafx.base
I tried to convert an E4/OSGI/GEF/JavaFx project that uses JRE 8 to JRE 11 and OpenJFX 11, and found a way to do so.
In my case, I use SWT and javafx.embed.swt.FxCanvas. Including the user defined JavaFX library in the modulepath didn't work, generating class not found errors during compile-time; but including the library in classpath worked.
I also couldn't run the application using --module-path arguments; it gave NoClassDefFoundError exception for org.eclipse.swt.widgets.Canvas
My solution uses E(fx)clipse, which could also be the third option for you. After including the javafx libraries in the classpath, and including org.eclipse.fx.osgi in the project configuration, I used the following VM parameters to load JavaFX classes using E(fx)clipse.
-Dosgi.framework.extensions=org.eclipse.fx.osgi -Defxclipse.java-modules.dir=[openjfx-lib-directory]
You can also add -Defxclipse.osgi.hook.debug=true" to see debug messages from E(fx)clipse while loading the classes.

Start standalone server in JBoss 7.1.1 with Maven 2

What kind of configuration has to be done to start JBoss 7.1.1 standalone server or domain server using Maven 2?
Start
Stop
Deploy
See JBoss Maven Plugin.
I had a couple of issues lately when I tried to deploy a new maven2 java project from eclipse to a fresh copy of jboss as 7.1.1.
After I spent 4 hours reading various online documentation I have finally realised that there are 2 jboss maven plugins; named , jboss maven plugin and jboss as maven plugin.
The first one is located here and the second one here.
So, pay attention if you need to use the "jboss-as" goal specifier or the "jboss" goal specifier.
Funny. I am just starting to read in order to see what is the real difference between these two libraries; apart from the obvious goal specifier and the task names.

Hard time on learning Java EE - mostly installing and testing stuff

Its quite a while since I started learning Java EE (I come from Rails world).
I'd like to test create a simple blog to test these:
- Hibernate, JPA
- Spring with MVC
- JSF and routing
- Struts 2
- Eclipse and local test (modify, reload, check changes)
- Tomcat, Jboss or Jetty
- An administration area (Session)
- Maven
I've a basic knowledge of each of those but as soon as I spend tons of time installing stuff and, somehow, I manage to resolve all inconveniences there is ALWAYS something that goes wrong (installation, tutorial obsolete, should I work with Spring IDE, MyEclipse, Jboss Application Server or regular Eclipse?, tons of random errors, each tutorial asking for random dependencies, each showcase).
QUESTION
How do you create quickly a startup project with these components?
You go with some Maven archetype? If so which one?
What I'd like is something I can download or build equipped out of the box with all above mentioned components. To name a few:
- railswizard.org, youvegotrails.com, railsboost.com/templates/new
SIDE QUESTION
Currently I'm following this great series, can you suggest some more like this:
- http://www.youtube.com/user/koushks?feature=gb_p13n_ch_rec
All the above components in a single project? That makes no sense; Spring MVC, Struts 2, and JSF would rarely be combined in the same project.
Each web framework has demo applications, what's wrong with those? There are archetypes for at least some combinations, although I'm not sure it's not better to put them together yourself.
Without knowing what kind of issues/errors you're getting, it's impossible to help. Maven should be taking care of most/all dependency issues. You shouldn't be spending much time installing anything by hand except maybe an app container.
IMO you're better off asking specific, actionable questions, and start with each specific technology and build up an application, rather than trying to integrate everything at once--a sure recipe for frustration.
For starting with a simple Java EE application, a good point to start is just downloading a Java EE 6 implementation.
Those are offered by various parties, which might be confusing at first. It's however just like there isn't the One and Only C compiler, but there are many and they all compile the same standard C.
For Java EE 6, obvious choices are GlassFish 3.1.2, JBoss AS 7.1, TomEE. (just pick one, at this stage it doesn't matter much which one you'll use).
Java EE 6 is a full stack solution. It's a single download and you don't necessarily need to install any other libraries. It comes with an MVC framework (JSF), an ORM solution (JPA), dependency injection (CDI), business logic support (EJB) and then some.
As for the IDE, NetBeans has a particular good default integration for GlassFish (can even be downloaded as one bundle), but for Eclipse it's not that difficult either. You need to download the Java EE edition of Eclipse and after starting it, go to Help -> Eclipse Marketplace, search for "GlassFish" and install the "GlassFish Server Plugin".
See also Minimal 3-tier Java EE app, without any XML config for a very minimal example to get started and JSF 2.0 tutorial with Eclipse and Glassfish for a very detailed one including instructions how to exactly setup the IDE.
What I'd like is something I can download or build equipped out of the box with all above mentioned components. To name a few:
http://appfuse.org/display/APF/Home
Appfuse will take you through the initial setup of a maven built spring based web application with hibernate included.
If you come from the rails world you might also look into Spring Roo which tries to borrow from Ruby i'm told. The primary focus of roo is to stand up all of the technology you've listed above quickly.

Resources