3

What is the maven dependency for j2ee.jar. I tried doing this way. But still its not working..

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.datasource.pooling</groupId>
  <artifactId>datasource.pooling</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>com.datasource.pooling</name>

  <repositories>
    <repository>
        <id>Java.Net</id>
        <url>http://download.java.net/maven/2/</url>
    </repository>
  </repositories>


  <dependencies>

  <!-- Javaee API -->
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>6.0</version>
    </dependency>



  <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0</version>
        </dependency>


<dependency>
      <groupId>commons-pool</groupId>
      <artifactId>commons-pool</artifactId>
      <version>1.5.4</version>
    </dependency>

    <dependency>
      <groupId>commons-dbcp</groupId>
      <artifactId>commons-dbcp</artifactId>
      <version>1.2.2</version>
    </dependency>
<!--  
<dependency>
      <groupId>commons-pool</groupId>
      <artifactId>commons-pool</artifactId>
      <version>1.5.6</version>
    </dependency>

    <dependency>
      <groupId>commons-dbcp</groupId>
      <artifactId>commons-dbcp</artifactId>
      <version>1.3</version>
    </dependency>
 -->

  </dependencies>
</project>

I am trying to configure this http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/doc/PoolingDriverExample‌​.java?view=markup example in my maven project. So in that I have to add j2ee.jar into my classpath. But If I am adding by above in my pom.xml then I am getting some error as ConnectionFactory cannot be resolved to a type

Update-

<!-- Javaee API -->
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>6.0</version>
        <scope>runtime</scope>
    </dependency>

still I am getting the same error for ConnectionFactory cannot be resolved to a type..

3
  • why are commons-pool and commons-dbcp dependencies commented out, that is what looks from you above snippet in the question. Please uncomment them if thats the case in your POM as well.
    – user620339
    Nov 2, 2011 at 19:32
  • The portion that I have commented out is just different version.. I have commons-pool and commons-dbcp dependencies just above that uncommented portion..!!
    – arsenal
    Nov 2, 2011 at 19:42
  • can you copy-paste the error you have? Also check whether this class is really in the classpath (in this your javaee-api.jar in particular). Is this jar downloaded at all and located in the right place (war/ear/etc)?
    – javagirl
    Nov 2, 2011 at 20:52

2 Answers 2

0

The repo you specified does not provide that version:6.0

The repo you specified has http://download.java.net/maven/glassfish/javax/javaee/javaee/

  1. 5.0-SNAPSHOT/ 14-Feb-2008 15:04 1K
  2. 6.0-alpha-1/ 16-Apr-2008 17:36 1K
  3. 6.0-alpha-2-SNAPSHOT/ 23-Apr-2008 08:31 1K

You may want to use http://repo1.maven.org/maven2 which does provide the resource and version you specified.

Also, your scope should be "provided". Having a runtime scope tells maven that the dependency is needed for runtime but not compilation. You need the opposite. Your dependency is needed for compilation but not runtime because it's "provided" by the container. See http://maven.apache.org/pom.html for more details.

1
  • The j2ee.jar should be a provided dependancy. Not from any maven repo, but the containers lib folde.r Nov 16, 2019 at 22:14
-1

You can check for transitive dependencies using the maven dependency plugin. Just do an

  mvn dependency:tree

Hope this answers your question.

1
  • 1
    I want to know is this the correct way to add j2ee.jar into your classpath in maven dependency. As I don't think so this is the right way..!!
    – arsenal
    Nov 2, 2011 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.