Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Incomplete Deployment

Posted on 2008-10-05
1
Medium Priority
?
301 Views
Last Modified: 2013-12-12
hi!
i trying to deploy the FirstEjb3Tutorial example but it does´t work
i´am using
Java 6
jboss-4.2.3.GA
postgres database
driver:postgresql-8.3-603.jdbc4.jar copied in: jboss_home\server\default\lib
i have created the myFavouriteName-ds.xml file in:jboss_home\server\default\deploy
i have created the proyect with the following files:
main folder:
*ejbModule
*-de
*- - laliluna
*- - - library
                    -class book.java
                    -class BookTestBean.java
                    -interface BookTestBeanLocal
                    -interface BookTestBeanRemote
                    -jndi.properties
* folder:META-INF
-ejb-jar.xml
-persistence.xml
-MANIFEST.MF

the error is:
--- MBeans waiting for other MBeans ---
ObjectName: persistence.units:jar=FirstEjb3Tutorial.jar,unitName=FirstEjb3Tutorial
  State: NOTYETINSTALLED
  I Depend On:
    jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding

ObjectName: persistence.units:jar=FirstEjb3Tutorial.jar,unitName=FirstEjb3Tutorial
  State: NOTYETINSTALLED
  I Depend On:
    jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding

ObjectName: persistence.units:jar=FirstEjb3Tutorial.jar,unitName=FirstEjb3Tutorial
  State: NOTYETINSTALLED
  I Depend On:
    jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding

ObjectName: persistence.units:jar=FirstEjb3Tutorial.jar,unitName=FirstEjb3Tutorial
  State: NOTYETINSTALLED
  I Depend On:
    jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding

ObjectName: persistence.units:jar=FirstEjb3Tutorial.jar,unitName=FirstEjb3Tutorial
  State: NOTYETINSTALLED
  I Depend On:
    jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding
  Depends On Me:
    jboss.j2ee:jar=FirstEjb3Tutorial.jar,name=BookTestBean,service=EJB3

ObjectName: jboss.j2ee:jar=FirstEjb3Tutorial.jar,name=BookTestBean,service=EJB3
  State: NOTYETINSTALLED
  I Depend On:
    persistence.units:jar=FirstEjb3Tutorial.jar,unitName=FirstEjb3Tutorial

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding
  State: NOTYETINSTALLED
  Depends On Me:
    persistence.units:jar=FirstEjb3Tutorial.jar,unitName=FirstEjb3Tutorial
    persistence.units:jar=FirstEjb3Tutorial.jar,unitName=FirstEjb3Tutorial
    persistence.units:jar=FirstEjb3Tutorial.jar,unitName=FirstEjb3Tutorial
    persistence.units:jar=FirstEjb3Tutorial.jar,unitName=FirstEjb3Tutorial
    persistence.units:jar=FirstEjb3Tutorial.jar,unitName=FirstEjb3Tutorial


                     





******************************class Book************************
 
package de.laliluna.library;
 
import java.io.Serializable;
 
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
 
@Entity
@Table(name="book")
@SequenceGenerator(name = "book_sequence", sequenceName = "book_id_seq")
public class Book implements Serializable
{
 
	private static final long serialVersionUID = 7422574264557894633L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "book_sequence")
	private Integer id;
	private String title;
	private String author;
	
	
	public Book() 
	{
		super();	
	}
	public Book(Integer id, String title, String author) {
		super();
		this.id = id;
		this.title = title;
		this.author = author;
	}
 
	@Override
	public String toString() 
	{
	return "Book: " + getId() + " Title " + getTitle() + " Author "
	+ getAuthor();
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
}
 
*************************class BookTestBean ************************
package de.laliluna.library;
 
import java.util.Iterator;
import java.util.List;
 
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
 
@Stateless
public class BookTestBean implements BookTestBeanLocal, BookTestBeanRemote 
{
	@PersistenceContext
	EntityManager em;
	
	public static final String RemoteJNDIName = BookTestBean.class.getSimpleName()+"/remote";
	public static final String LocalJNDIName = BookTestBean.class.getSimpleName()+"/local";
	
	public void test() 
	{
		Book book = new Book(null, "My first bean book", "Sebastian");
		em.persist(book);
		Book book2 = new Book(null, "another book", "Paul");
		em.persist(book2);
		Book book3 = new Book(null, "EJB 3 developer guide, comes soon",
		"Sebastian");
		em.persist(book3);
		System.out.println("list some books");
		List someBooks = em.createQuery("from Book b where b.author=:name")
		.setParameter("name", "Sebastian").getResultList();
		for (Iterator iter = someBooks.iterator(); iter.hasNext();)
		{
		Book element = (Book) iter.next();
		System.out.println(element);
		}
		System.out.println("List all books");
		List allBooks = em.createQuery("from Book").getResultList();
		for (Iterator iter = allBooks.iterator(); iter.hasNext();)
		{
		Book element = (Book) iter.next();
		System.out.println(element);
		}
		System.out.println("delete a book");
		em.remove(book2);
		System.out.println("List all books");
		allBooks = em.createQuery("from Book").getResultList();
		for (Iterator iter = allBooks.iterator(); iter.hasNext();)
		{
		Book element = (Book) iter.next();
		System.out.println(element);
		}
		}	
}
*********************** BookTestBeanLocal ************************
package de.laliluna.library;
 
import javax.ejb.Local;
@Local
public interface BookTestBeanLocal 
{
	public void test();
}
*********************** BookTestBeanRemote ************************
package de.laliluna.library;
 
import javax.ejb.Remote;
 
@Remote
public interface BookTestBeanRemote 
{
public void test();
}
********************jndi.properties*****************
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost:1099
***********************ejb-jar.xml**********************
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar 
version="3.0" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
</ejb-jar>
********************* persistence.xml*********************
<persistence>
	<persistence-unit name="FirstEjb3Tutorial">
		<jta-data-source>java:/ejb3ProjectDS</jta-data-source>
		<properties>
			<property name="hibernate.hbm2ddl.auto"
			value="create-drop"/>
		</properties>
	</persistence-unit>
</persistence>

Open in new window

0
Comment
Question by:pfmg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 19

Accepted Solution

by:
ramazanyich earned 1500 total points
ID: 22647527
in your persistence.xml file the link to jta datasource should match to the name of datasource in the myFavouriteName-ds.xml.
Let say in your myFavouriteName-ds.xml you had following line:
      <jndi-name>myFavoriteDS</jndi-name>

then in the persistence.xml you should replace ejb3ProjectDS by myFavoriteDS
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Curious about the latest ransomware attack? Check out our timeline of events surrounding the spread of this new virus along with tips on how to mitigate the damage.
One-stop solution for Exchange Administrators to address all MS Exchange Server issues, which is known by the name of Stellar Exchange Toolkit.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question