Question

I have a web app that compiles fine under Oracle's JDK 7, but gives the following error under OpenJDK 7:

error: package org.jboss.weld.context.bound does not exist

The error refers to a import in my code:

import org.jboss.weld.context.bound.BoundRequestContext;

In my pom.xml, I have the following weld-related dependencies:

<dependency>
  <groupId>org.jboss.weld</groupId>
  <artifactId>weld-core</artifactId>
  <version>1.1.8.Final</version>
  <exclusions>
    <exclusion>
      <artifactId>jsr250-api</artifactId>
      <groupId>javax.annotation</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.jboss.weld.servlet</groupId>
  <artifactId>weld-servlet-core</artifactId>
  <version>1.1.8.Final</version>
</dependency>
<dependency>
  <groupId>org.jboss.weld.se</groupId>
  <artifactId>weld-se-core</artifactId>
  <version>1.1.8.Final</version>
</dependency>

Is there any way to make it compile using OpenJDK?

Was it helpful?

Solution

The problem is not OpenJDK's fault. You would most likely get the same problem with an Oracle badged JDK or a third-party Java compiler ... if you did an equivalent build with the respective compilers.

The problem is most likely caused by an incorrect Maven dependency.

According to GrepCode, that class (org.jboss.weld.context.bound.BoundRequestContext) is defined in "weld-api", "weld-servlet", "weld-se" and "weld-osgi-bundle". Try adding one of those as a dependency.

UPDATE

Judging from this page, "weld-api" is probably the way to go. You might want to read it thoroughly to figure out the recommended set of dependencies.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top