Hi Gerhard,

I don't know what the problem is, with the direct dependency. I've marked it as optional in the pom.xml. A Java 1.6 application will run without changes (and not having googlecode in the jar). But I can understand, that there are reasons on principal to have no dependencies to other project.

Did I understand you correctly in your first solution approach?
Compile the Sources of java.util.ServiceLoader with Java 1.5 and put it into a single JAR File. This might be also not very nice, as a general solution: OWB works with Java 1.5, when you compile some JDK classes.

Sadly I don't know the plugin mechanism of OWB, so I can't write an easy patch for that solution.

An other solution might be implementing a org.apache.webbeans.util.ServiceLoader and using this instead of the com.googlecode one. This might be the cleanest solution.

So we have 4 possibilities:
  1) googlecode
  2) jdk 1.6 code self compiled in the project
  3) plugin
  4) writing own service-loader

Regards,

Udo


Am 08.06.11 11:25, schrieb Gerhard Petracek:
hi udo,

@OWB-582:
using com.googlecode.* directly in owb is imo no good idea.
since the service-loader isn't available in a java 1.5 environment,
you can repackage the service-loader in your project. so we don't have
to change owb itself - you just have an additional jar in your
project. if there is any issue with such an approach, we could create
an owb-plugin for it and you write your own plugin-implementation.

@OWB-583:
looks fine to me (just had a quick look).

regards,
gerhard

2011/6/8, Udo Schnurpfeil<[email protected]>:
Hi,

I would like to use OWB on WebSphere 6.1 (similar to Tomcat 5.5) which
requires Java 1.5 and supports Servlet API 2.4.
OWB needs Java 1.6 and Servlet API 2.5.

Part 1: Java 1.6

After a close look into the sources I see, there is one basic dependency
to Java 1.6: java.util.ServiceLoader
To solve this problem, I've added a utility class in my local copy and
delegate calls to ServiceLoader to this utility.

The utility class itself calls ServiceLoader, if the class is available
(Java 1.6) or uses com.googlecode.bspi.ServiceLoader (Java 1.5).
So the application needs one new dependency (only in the case of Java 1.5).

I've also changed the maven-compiler-plugin to generate Java 1.5
compatible byte code.

Jira: https://issues.apache.org/jira/browse/OWB-582

Part 2: Servet API 2.5

Some classes uses the new function ServletContext.getContextPath() for
logging and giving a thread a useful name.

Here, I also added a utility class, and call
servletContext.getServletContextName() in the case of Servlet API 2.4

Jira: https://issues.apache.org/jira/browse/OWB-583

Conclusion:

There are not many dependencies to the new APIs and there are simple
workarounds. With this changes (and a similar patch for the
ServiceLoader in CODI) I'm able to run OWB on WebSpere 6.1 and Tomcat
5.5 with Java 1.5.

Any suggestions?

Regards,

Udo



Reply via email to