Alexei
Alexei

Reputation: 347

Tomcat EJB Integration within webapp

I must use tomcat for Web development at the university. I looked at TomEE. But I am not allowed to modify the tomcat-instance at the server. I integrated JSF,CDI with maven. And I am trying to integrate OpenEJB with maven and got an error:

Failed to execute goal on project itarchitectMobile: 
Could not resolve dependencies for project   
tdpess14Team3_2:itarchitectMobile:war:1.0SNAPSHOT:
Could not find artifact org.apache.openejb:openejb:jar:4.6.0.1 in central
(http://repo.maven.apache.org/maven2) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

Here is my dependencies at pom.xml:

 <properties>
    <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
    <groupId>org.apache.tomcat</groupId>  
    <artifactId>tomcat-servlet-api</artifactId>  
    <version>7.0.53</version>  
    <scope>provided</scope>  
</dependency>
    <dependency>  
  <groupId>org.hibernate</groupId>  
  <artifactId>hibernate-core</artifactId>  
  <version>4.0.0.Final</version>  
</dependency>  
<dependency>  
  <groupId>org.hibernate</groupId>  
  <artifactId>hibernate-entitymanager</artifactId>  
  <version>4.0.0.Final</version>  
</dependency>  
<dependency>  
  <groupId>org.hibernate.javax.persistence</groupId>  
  <artifactId>hibernate-jpa-2.0-api</artifactId>  
  <version>1.0.1.Final</version>  
  <scope>provided</scope>  
</dependency>  
<dependency>  
    <groupId>org.hibernate.java-persistence</groupId>  
    <artifactId>jpa-api</artifactId>  
    <version>2.0-cr-1</version>  
</dependency> 
<dependency>
    <groupId>org.apache.openejb</groupId>
    <artifactId>openejb</artifactId>
    <version>4.6.0.1</version>
</dependency>

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-web-api</artifactId>
    <version>6.0</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>org.hsqldb</groupId>
    <artifactId>hsqldb</artifactId>
    <version>2.3.2</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.faces</artifactId>
    <version>2.2.2</version>
</dependency>
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>
<dependency>
    <groupId>javax.el</groupId>
    <artifactId>javax.el-api</artifactId>
    <version>3.0.0</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>org.jboss.weld.servlet</groupId>
    <artifactId>weld-servlet</artifactId>
    <version>1.1.19.Final</version>
</dependency>
</dependencies>

Is something wrong with my pom? I only found tutorials that are showing how to integrate tomee in a tomcat-server.

Upvotes: 1

Views: 1796

Answers (3)

eric A
eric A

Reputation: 806

it was a long time ago but some others could find this useful. You can use EJBs with tomcat but you have to include the following dependencies in your maven project:

<dependency>
    <groupId>org.apache.openejb</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0-6</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.apache.openejb</groupId>
    <artifactId>openejb-core</artifactId>
    <version>4.7.4</version>
</dependency>

<dependency>
    <groupId>org.apache.openejb</groupId>
    <artifactId>apache-tomee</artifactId>
    <version>1.7.4</version>
</dependency>

Upvotes: 2

Alexei
Alexei

Reputation: 347

I found a blog entry that will be useful for people that will deal with the same problem in the future:

http://rmannibucau.wordpress.com/2014/05/30/war-overlay-tomee-to-deploy-your-ee-application-in-tomcat/

Upvotes: 0

Benjamin Caure
Benjamin Caure

Reputation: 2403

If your target app server is not EJB container, you will not be able to include EJB support into your application. EJB is not only a library, your target server has to be EJB compliant.

Upvotes: 4

Related Questions