How to create EJB3 JPA Project in Eclipse (JBoss AS 7.1)
Environment Used
- JDK 6 (Java SE 6)
- EJB 3.0 (stateless session bean)
- EJB 3.0 Java Persistence API (JPA)
- Eclipse Indigo IDE for Java EE Developers (3.7.1)
- JBoss Tools – Core 3.3.0 M5 for Eclipse Indigo (3.7.1)
- JBoss Application Server (AS) 7.1.0.CR1b / Final
- MySQL 5.5 (To install MySQL refer this page)
- MySQL Connector/J 5.1
Setting up development environment:
Read this page for installing and setting up the environment for developing and deploying EJB 3.0 on JBoss application server.
Project Description:
- We are going to create a simple EJB 3 JPA project and a remote Java application client which will call/invoke the bean.
- We create a JPA entity and a stateless session bean to perform operations on the entity.
- For testing this JPA example we write a remote Java Application Client (main() method).
- For simplicity, the entity, session bean and the client are created in the same project.
Steps
- Create Database Table
- Create JPA Entity
- POJO class with @Entity annotation
- persistence.xml
- [optional] orm.xml if object relational mapping is defined in XML
- Create Stateless Session Bean
- Bean interface
- Bean Implementation class
- Create Client
- Client Class with main() method
- jboss-ejb-client.properties for defining JBoss specific client context in JBoss AS7
- JAR files for accessing Session Bean
- MySQL connector JAR file
- Adding MySQL data source in JBoss AS
Creating Database and table in MySQL
JPA is all about data persistence, so let’s examine how it works with the data store design. Assume you have a PROJECT table, as shown below.
| Field | Type | Key | Extra |
|---|---|---|---|
| pname | varchar(255) | ||
| pnumber | int | Primary Key | auto_increment |
| plocation | varchar(255) | ||
| dept_no |
- Open command prompt (Windows) or Terminal(Linux) and type
mysql –u [your-username] –p
and press enter and type the password. - If you are using Windows, you can also use MySQL command line client which will be available in All programs menu.
- For creating a new database, refer this page.
- After creating the database type the command “use <database_name>;”
- For creating a new table, refer this page.
Creating New EJB Project
- Open Eclipse IDE and create a new EJB project which can be done in three ways,
- Right click on Project Explorer -> New -> EJB Project
- File menu -> New -> EJB Project
- Click on the down arrow on New icon on toolbar -> EJB Project
- Enter the project name as “FirstJPAProject” and make sure the JBoss 7.1 Runtime has been selected with the EJB 3.0 Module version.
- Click Next -> Next -> and Finish.
- You will see an EJB project in the Project Explorer view.
Creating JPA Entity
This is a very simple example that uses only one entity – “Project” which is a Plain Old Java Object class (POJO). This class, as well as the code that manipulates POJO instances, can be used without any changes in Java SE or Java EE environment. In this example we have used Java EE environment.
We will persist and find “project” entity using EntityManager API and retrieve all “projects” using Query interface.
Right click on ejbModule -> New -> Class
- Enter the Java package name as “com.ibytecode.entities”
- Enter the Class name as “Project”
- Click “Finish”
Type the following code:
package com.ibytecode.entities;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Column;
@Entity(name = "project")
public class Project implements Serializable {
private static final long serialVersionUID = 1L;
public Project() {
super();
}
@Id
private int pnumber;
private String pname;
private String plocation;
@Column(name = "dept_no")
private int deptNo;
public int getPnumber() {
return pnumber;
}
public void setPnumber(int pnumber) {
this.pnumber = pnumber;
}
public String getPname() {
return pname;
}
public void setPname(String pname) {
this.pname = pname;
}
public String getPlocation() {
return plocation;
}
public void setPlocation(String plocation) {
this.plocation = plocation;
}
public int getDeptNo() {
return deptNo;
}
public void setDeptNo(int deptNo) {
this.deptNo = deptNo;
}
@Override
public String toString() {
return "Project [pnumber=" + pnumber + ", pname=" + pname
+ ", plocation=" + plocation + ", deptNo=" + deptNo + "]";
}
}
Note that there is no @Table annotation. This is possible because the persistence provider will use the default rules to calculate the values for you. The name attribute in @Entity annotation defines the table name. Similarly if an instance variable name matches the column name in the table then there is no need to specify the @Column annotation.
Creating Session Bean and Bean Interface
- Right click on ejbModule -> New -> Session Bean (EJB 3.x)

- Enter the Java package name as com.ibytecode.businesslogic
- Enter the Class name as ProjectBean
- Select the State type as Stateless
- Check the Remote Business Interface and enter the name as com.ibytecode.business.IProject.
- The business interface will be created in different package (com.ibytecode.business)
- Click Finish
Coding Bean and the Interface
- Open Bean Interface and type the following code and save the file (Ctrl+s).
- Interface can be either @Remote or @Local. In this example we have used @Remote.
package com.ibytecode.business;
import java.util.List;
import javax.ejb.Remote;
import com.ibytecode.entities.Project;
@Remote
public interface IProject {
void saveProject(Project project);
Project findProject(Project project);
List<Project> retrieveAllProjects();
}
- Open Bean and type the following code and save the file.
- Bean type can either be @Stateful or @Stateless. In this example we have used @Stateless.
package com.ibytecode.businesslogic;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import com.ibytecode.business.IProject;
import com.ibytecode.entities.Project;
@Stateless
public class ProjectBean implements IProject {
@PersistenceContext(unitName = "JPADB")
private EntityManager entityManager;
public ProjectBean() { }
@Override
public void saveProject(Project project) {
entityManager.persist(project);
}
@Override
public Project findProject(Project project) {
Project p = entityManager.find(Project.class, project.getPnumber());
return p;
}
@Override
public List<Project> retrieveAllProjects() {
String q = "SELECT p from " + Project.class.getName() + " p";
Query query = entityManager.createQuery(q);
List<Project> projects = query.getResultList();
return projects;
}
}
Now the Stateless Session Bean has been created. The next step is to configure the datasource.
persistence.xml
How does the server know which database the EntityManager API should use to save / update / query the entity objects? The persistence.xml file gives you complete flexibility to configure the EntityManager.
The persistence.xml file is a standard configuration file in JPA which should be placed in META-INF directory inside the JAR file that contains the entities. The persistence.xml file must define a persistence-unit with a unique name which is used by EntityManager.
Right click on META-INF folder -> New -> Other -> XML -> XML file. Enter the file name as persistence.xml and type the following.
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="JPADB"> <jta-data-source>java:/MySQLDS</jta-data-source> <properties> <property name="showSql" value="true"/> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /> </properties> </persistence-unit> </persistence>
In JBoss AS, the default JPA provider is Hibernate. The jta-data-source points to the JNDI name of the database this persistence unit maps to. The java:/MySQLDS points to the MySQL DB datasource in the JBoss AS. In the next step we setup this datasource.
Configuring MySQL Datasource in JBoss AS 7
Download MySQL connector
The connector can be downloaded from this link. This tutorial uses 5.1 version. Unzip the connector to a safe location on your computer which contains MySQL Connector J JAR.
Add a Module to AS 7
AS 7 uses a module system to provide isolation in class loading. We need to create a new module which contains the MySQL Connector J JAR.
In your JBoss AS 7 root folder, create folders in following hierarchy, modules/com/mysql/main.
If “modules” and “com” folders are already present then just create “mysql” and “main” folders.
Copy the MySQL Connector J JAR and paste in the “main” folder.
Now define the module in XML. Create a new module.xml file in “main” folder and paste the following lines.
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.18-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
The new module directory should have the following contents.
- module.xml
- mysql-connector-java-5.1.18-bin.jar
Create a Driver Reference
Now we need to make a reference to the module from the main application server configuration file (standalone.xml) which is found in JBossAS_Home/standalone/configuration
Find the ‘<drivers>’ element and add a new driver to it:
<drivers> <driver name="h2" module="com.h2database.h2"> <xa-datasource-class> org.h2.jdbcx.JdbcDataSource </xa-datasource-class> </driver> <driver name="mysqlDriver" module="com.mysql"> <xa-datasource-class> com.mysql.jdbc.Driver </xa-datasource-class> </driver> </drivers>
Add the Datasource for the driver
Open the application server configuration file (standalone.xml) which is found in JBossAS_Home/standalone/configuration. Find the ‘<datasources>’ element and add a new datasource.
<datasource jndi-name="java:/MySQLDS" pool-name="MySQLDS" enabled="true" use-java-context="true"> <connection-url> jdbc:mysql://localhost:3306/YOUR-DATABASE-NAME </connection-url> <driver>mysqlDriver</driver> <security> <user-name>YOUR-MYSQL-USERNAME</user-name> <password>YOUR-MYSQL-PASSWORD</password> </security> </datasource>
In the above code, use your database name, MySQL username and password in the highlighted lines.
In datasource element, the jndi-name=”java:/MySQLDS” should match the
The value for <driver>mysqlDriver</driver> element should match the <drivers><driver name=”mysqlDriver” …>…</driver></drivers>
Deploying EJB JPA project
- Now we need to deploy the project “FirstJPAProject” on server.
- Deploying the project can be done in two ways,
- Right click on the EJB project -> Run As -> Run On Server. Select the existing “JBoss 7.1 Runtime Server” and click Finish.
- Right click on “JBoss 7.1 Runtime Server” available in Servers view -> Add and Remove… -> Select the EJB JAR file from the left pane and click Add-> and then Finish.
Start/Restart the Server
Right click on “JBoss 7.1 Runtime Server” from Servers view and click on Start if it has not yet been started. If the project is deployed properly with global JNDI mapping then you will see the following message in the console.
Deployed “FirstJPAProject.jar”
Creating Client
- The next step is to write a remote Java client application (with main()) for accessing and invoking the bean deployed on the server
- Client uses JNDI to lookup for a proxy of your bean and invokes method on that proxy.
Creating JNDI InitialContext
Obtaining a Context using InitialContext
- All naming service operations are performed on some implementation of the javax.naming.Context interface. Therefore, the starting point of interacting with the naming service is to obtain a Context by providing the properties specific to the server implementation being used. In our case it is, JBoss Application Server.
- To create a javax.naming.InitialContext, we need to initialize it with properties from the environment. JNDI verifies each property’s value by merging the values from the following two sources,
- Using parameterized constructor of InitialContext which takes properties of supplied environment
- jndi.properties resource files found on the classpath.
NOTE:We will use parameterized constructor for initializing the InitialContext.
For JBoss AS 7 we need to set the Context.URL_PKG_PREFIXES property with value “org.jboss.ejb.client.naming” to obtain the InitialContext.
The following utility class is used to create InitialContext for JBoss AS and can be reused in all applications. Otherwise the code written in this class should be repeated in all clients.
- Right click on ejbModule -> New -> Class
- Enter the package name as com.ibytecode.clientutility
- Enter the Class name as JNDILookupClass
- Click on Finish
Type the following code.
package com.ibytecode.clientutility;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class JNDILookupClass {
private static Context initialContext;
private static final String PKG_INTERFACES = "org.jboss.ejb.client.naming";
public static Context getInitialContext() throws NamingException {
if (initialContext == null) {
Properties properties = new Properties();
properties.put(Context.URL_PKG_PREFIXES, PKG_INTERFACES);
initialContext = new InitialContext(properties);
}
return initialContext;
}
}
Creating client class
- Right click on ejbModule -> New -> Class
- Enter the package name as com.ibytecode.client
- Enter the Class name as EJBApplicationClient
- Check the main() method option
- Click on Finish
Type the following code:
package com.ibytecode.client;
import java.util.List;
import javax.naming.Context;
import javax.naming.NamingException;
import com.ibytecode.business.IProject;
import com.ibytecode.businesslogic.ProjectBean;
import com.ibytecode.clientutility.JNDILookupClass;
import com.ibytecode.entities.Project;
public class EJBApplicationClient {
public static void main(String[] args) {
IProject bean = doLookup();
Project p1 = new Project();
p1.setPname("Banking App");
p1.setPlocation("Town City");
p1.setDeptNo(1);
Project p2 = new Project();
p2.setPname("Office Automation");
p2.setPlocation("Downtown");
p2.setDeptNo(2);
// 4. Call business logic
//Saving new Projects
bean.saveProject(p1);
bean.saveProject(p2);
//Find a Project
p1.setPnumber(1);
Project p3 = bean.findProject(p1);
System.out.println(p3);
//Retrieve all projects
System.out.println("List of Projects:");
List<Project> projects = bean.retrieveAllProjects();
for(Project project : projects)
System.out.println(project);
}
private static IProject doLookup() {
Context context = null;
IProject bean = null;
try {
// 1. Obtaining Context
context = JNDILookupClass.getInitialContext();
// 2. Generate JNDI Lookup name
String lookupName = getLookupName();
// 3. Lookup and cast
bean = (IProject) context.lookup(lookupName);
} catch (NamingException e) {
e.printStackTrace();
}
return bean;
}
private static String getLookupName() {
/*The app name is the EAR name of the deployed EJB without .ear
suffix. Since we haven't deployed the application as a .ear, the app
name for us will be an empty string */
String appName = "";
/* The module name is the JAR name of the deployed EJB without the
.jar suffix.*/
String moduleName = "FirstJPAProject";
/* AS7 allows each deployment to have an (optional) distinct name.
This can be an empty string if distinct name is not specified.*/
String distinctName = "";
// The EJB bean implementation class name
String beanName = ProjectBean.class.getSimpleName();
// Fully qualified remote interface name
final String interfaceName = IProject.class.getName();
// Create a look up string name
String name = "ejb:" + appName + "/" + moduleName + "/" +
distinctName + "/" + beanName + "!" + interfaceName;
return name;
}
}
Setting up EJB client context properties
An EJB client context is a context which contains contextual information for carrying out remote invocations on EJBs. This is a JBoss AS specific API. The EJB client context can be associated with multiple EJB receivers. Each EJB receiver is capable of handling invocations on different EJBs.
For example, an EJB receiver “ClientA” might be able to handle invocation on a bean identified by app-A/module-A/distinctinctName-A/BeanA!com.ibc.RemoteBeanA, app-B/module-B/distinctName-B/BeanB!RemoteBeanB, etc. Each such EJB receiver knows about what set of EJBs it can handle and each of the EJB receiver knows which server target to use for handling the invocations on the bean. The server IP address and its remoting port should be specified in the properties file placed in the client classpath. This properties file (EJB client context) will then be used internally by the JNDI implementation to handle invocations on the bean proxy.
Create a file “jboss-ejb-client.properties” in the classpath of the application. We can place it in ejbModule folder of our application. The jboss-ejb-client.properties contains the following properties:
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=localhost
remote.connection.default.port = 4447
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
Adding JAR files required for the client to run the client application
- Open Run Configurations… in Run menu or Run Configurations in Run icon.

- Select the client application (EJBApplicationClient) under Java Application from left pane and open the Classpath tab from right side pane. If you don’t see your client application, run it once. Select “User Entries” and click on “Add External JARs”.

- Add the following JAR files.
JAR name Location jboss-transaction-api_1.1_spec-1.0.0.Final.jar AS7_HOME/modules/javax/transaction/api/main/ jboss-ejb-api_3.1_spec-1.0.1.Final.jar AS7_HOME/modules/javax/ejb/api/main/ jboss-ejb-client-1.0.0.Beta10.jar AS7_HOME/modules/org/jboss/ejb-client/main/ jboss-marshalling-1.3.0.GA.jar AS7_HOME/modules/org/jboss/marshalling/main/ xnio-api-3.0.0.CR5.jar AS7_HOME/modules/org/jboss/xnio/main/ jboss-remoting-3.2.0.CR6.jar AS7_HOME/modules/org/jboss/remoting3/main/ jboss-logging-3.1.0.Beta3.jar AS7_HOME/modules/org/jboss/logging/main/ xnio-nio-3.0.0.CR5.jar AS7_HOME/modules/org/jboss/xnio/nio/main/ jboss-sasl-1.0.0.Beta9.jar AS7_HOME/modules/org/jboss/sasl/main/ jboss-marshalling-river-1.3.0.GA.jar AS7_HOME/modules/org/jboss/marshalling/river/main/ You can also add it in Build path (Right click on your EJB Project->Properties, select Java Build Path from left side pane and select Libraries from right side and click on Add External JARs)
If you are using JBoss Application Server (AS) 7.1.0 Final version then it is sufficient to add only one client JAR file (jboss-client-7.1.0.Final.jar) which is located in AS7_HOME/bin/client
The figure below shows the final directory structure of this example.

Run the client
Use Ctrl + F11 to run the client.
Project [pnumber=1, pname=Banking App, plocation=Town City, deptNo=1]
List of Projects:
Project [pnumber=1, pname=Banking App, plocation=Town City, deptNo=1]
Project [pnumber=2, pname=Office Automation, plocation=Downtown, deptNo=2]
Tags: Adding MySQL in JBoss, defining an alternate datasource in JBoss, eclipse ejb3 jpa jboss 7, ejb3 jpa, ejb3 jpa jboss, Install the JDBC driver as a deployment, jboss eclipse ejb3 jpa, jboss-ejb-client-properties, jpa jboss 7, jpa tutorial jboss 7, step by step ejb3 jpa project in eclipse ide on jboss













Hi,
I tried your example and I came up with this error when I want to run the client:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.scriptenginedb.client.EJBApplicationClient.doLookup(EJBApplicationClient.java:55)
at com.scriptenginedb.client.EJBApplicationClient.main(EJBApplicationClient.java:18)
I think you forgot something in “JNDILookupClass”.
I am new to this so I can’t correct you, but I am waiting for your errata
Great work by the way!
loading...
Solved the problem importing the dependecies in the client. Now I have another problem:
Exception in thread “main” javax.ejb.NoSuchEJBException: No such EJB[appname=, modulename=DatabaseSE, distinctname=, beanname=ProjectBean, viewclassname=null]
at org.jboss.ejb.client.remoting.GeneralInvocationFailureResponseHandler.processMessage(GeneralInvocationFailureResponseHandler.java:75)
at org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver.handleMessage(ChannelAssociation.java:297)
at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:409)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
loading...
May be you might have missed the ejb client jar file in your classpath and that is why you got that NoInitialContextException.
And for the NoSuchEJBException, make sure you have the bean deployed successfully on the server. See the jboss log/console for any errors.
I see the viewclassname is null which should not be. So in the client, check the lookup name
String name = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + interfaceName;We deployed the bean as jar, so no appName and the moduleName is the deployed jar file name (in our case it is the project name). Also check the interfaceName is given properly or not.
loading...
Hi nithya,
Thanks! The jar was not deployed… stupid me. I can’t explain why I didn’t realized that.
It is working now.
You were right regarding the first error, I forgot to import the jars.
Have a nice day and keep up the good work
loading...
Glad to know it is working
. Thank You
loading...
hi when i come to step 10 it finished whith this error
14:45:05,691 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of “FirstJPAProject.jar”
14:45:05,730 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named ProjectBean in deployment unit deployment “FirstJPAProject.jar” are as follows:
java:global/FirstJPAProject/ProjectBean!com.ibytecode.business.IProject
java:app/FirstJPAProject/ProjectBean!com.ibytecode.business.IProject
java:module/ProjectBean!com.ibytecode.business.IProject
java:jboss/exported/FirstJPAProject/ProjectBean!com.ibytecode.business.IProject
java:global/FirstJPAProject/ProjectBean
java:app/FirstJPAProject/ProjectBean
java:module/ProjectBean
14:45:05,753 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit.”FirstJPAProject.jar”.INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit.”FirstJPAProject.jar”.INSTALL: Failed to process phase INSTALL of deployment “FirstJPAProject.jar”
at
pleaaaaaaaaaase i need help !!!
loading...
wadios,
There should be failure messages displayed in the console. Without that it is hard to help. See the full log in console.
loading...
thank you
the problem was that when i created the project I included some librairy , i made a new project and it work correctly ,
thank you sir for your answer
loading...
Pingback: Move thirty six software - How to create EJB3 JPA Project in Eclipse
Thanks for providing us a excellent tutorials on EJB with JBoss on Eclipse.
I want to bifurcate the EJB module and Client code. How to create a Java Project which access the EJB, which EJB files are required to put into this project.
Thanks
Manish
loading...
Thanks.
Create a JAR file with bean interface and Entities, you can do it in Eclipse. Select bean interface, Entities and Right click -> export -> Java-> JAR file.
loading...
hai, its really a nice tutorial. plz… try to help me with this error
when i try to deploy the Bean into the Jboss server at step 10 i am getting this following error plz… correct me with this mistake.
01:23:13,295 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.deployment.unit.”FirstJPAProject.jar”.INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit.”FirstJPAProject.jar”.INSTALL: Failed to process phase INSTALL of deployment “FirstJPAProject.jar”
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_22]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_22]
at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_22]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011047: Component class com.ibytecode.businesslogic.ProjectBean for component ProjectBean has errors:
JBAS011440: Can’t find a persistence unit named JPADB in deployment “FirstJPAProject.jar”
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:169)
at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:162)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:155)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final]
… 5 more
01:23:13,512 INFO [org.jboss.as.server] (DeploymentScanner-threads – 2) JBAS015870: Deploy of deployment “FirstJPAProject.jar” was rolled back with failure message {“JBAS014671: Failed services” => {“jboss.deployment.unit.”FirstJPAProject.jar”.INSTALL” => “org.jboss.msc.service.StartException in service jboss.deployment.unit.”FirstJPAProject.jar”.INSTALL: Failed to process phase INSTALL of deployment “FirstJPAProject.jar”"},”JBAS014771: Services with missing/unavailable dependencies” => ["jboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean.ValidatorFactoryjboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBeanMissing[jboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean.ValidatorFactoryjboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean]“,”jboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean.Validatorjboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBeanMissing[jboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean.Validatorjboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean]“]}
01:23:13,522 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment FirstJPAProject.jar in 12ms
01:23:13,524 INFO [org.jboss.as.controller] (DeploymentScanner-threads – 2) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean (missing) dependents: [service jboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean.Validator, service jboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean.ValidatorFactory]
JBAS014777: Services which failed to start: service jboss.deployment.unit.”FirstJPAProject.jar”.INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit.”FirstJPAProject.jar”.INSTALL: Failed to process phase INSTALL of deployment “FirstJPAProject.jar”
01:23:13,528 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads – 1) {“JBAS014653: Composite operation failed and was rolled back. Steps that failed:” => {“Operation step-2″ => {“JBAS014671: Failed services” => {“jboss.deployment.unit.”FirstJPAProject.jar”.INSTALL” => “org.jboss.msc.service.StartException in service jboss.deployment.unit.”FirstJPAProject.jar”.INSTALL: Failed to process phase INSTALL of deployment “FirstJPAProject.jar”"},”JBAS014771: Services with missing/unavailable dependencies” => ["jboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean.ValidatorFactoryjboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBeanMissing[jboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean.ValidatorFactoryjboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean]“,”jboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean.Validatorjboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBeanMissing[jboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean.Validatorjboss.naming.context.java.comp.FirstJPAProject.FirstJPAProject.ProjectBean]“]}}}
loading...
Skip step 10 and follow steps 11 and 12 and then redo the step 10. I modified the post to reflect the same.
loading...
Hi,
First, thank you for a great tutorial! Very easy to follow along with.
I got all the way up to Step 12 and received this error below when I deployed the EJB project to JBoss 7.1
Please assist.Any help would be greatly appreciated! Thank you so much in advance guys!
15:57:40,790 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of “FirstJPAProject.jar”
15:57:40,930 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-1) JNDI bindings for session bean named ProjectBean in deployment unit deployment “FirstJPAProject.jar” are as follows:
java:global/FirstJPAProject/ProjectBean!com.ibytecode.business.IProject
java:app/FirstJPAProject/ProjectBean!com.ibytecode.business.IProject
java:module/ProjectBean!com.ibytecode.business.IProject
java:jboss/exported/FirstJPAProject/ProjectBean!com.ibytecode.business.IProject
java:global/FirstJPAProject/ProjectBean
java:app/FirstJPAProject/ProjectBean
java:module/ProjectBean
15:57:41,165 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit.”FirstJPAProject.jar”.INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit.”FirstJPAProject.jar”.INSTALL: Failed to process phase INSTALL of deployment “FirstJPAProject.jar”
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_03]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_03]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011047: Component class com.ibytecode.businessLogic.ProjectBean for component ProjectBean has errors:
JBAS011440: Can't find a persistence unit named JPADB in deployment "FirstJPAProject.jar"at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:169)
at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:162)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:155)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final]
… 5 more
loading...
@PersistenceContext(unitName = “JPADB”) in bean class should match with the in META-INF/persistence.xml.
loading...
Wow thanks for the speedy response!
I thought that I completed that part correctly.
My persistence.xml is located in:
C:\workspace\FirstJPAProject\ejbModule\META-INF\persitence.xml
And the entire content of the xml is below:
java:/MySQLDS
Please, advise. Thank you so much!
loading...
Please use the <code> tag to post the xml code.
loading...
Praveen, Well i tried to paste the code in the xml but i couldnt. log story short, the name matches in my xml. unitName = “JPADB”
any other advice? much appreciated! Thank you!
-C
loading...
Actually you can use the [xml] [/xml] tags to post code. And regarding your problem, the only thing I see is the persistence.xml file name misspelled. If that is not the case, try recreating this project and deploy it.
Good Luck.
loading...
nithya thank you!
Here is my perstience.xml code
java:/MySQLDS
loading...
Hmm well it appears i cant paste the entire xml code even with the
tag.ill try it here with just the meat of the code without heading:
java:/MySQLDS
loading...
If you are using Java project then you need to add this JAR file in either Client’s BuildPath or Classpath. Right click on client’s project -> Properties -> Buildpath -> Libraries -> Add External JAR. Deploy bean project on Server and run the client code
I think you still need to add the jboss-as-7.1.0.Final/modules/org/jboss/ejb-client/main/jboss-ejb-client-1.0.2.Final.jar otherwise the
JNDILookupClass.getInitialContext()throws errors.Well, that’s the only way I could get it to work from a bog standard java project.
Apart from that, excellent tutorial my friend.
loading...
Yes, you need to add that JAR file in Client’s classpath if the client and EJB are in separate project. Updated the comment
loading...
Pingback: JavaPins
hi !
i read the example but i’ve this error
lug 02, 2012 3:45:30 PM org.jboss.ejb.client.EJBClient
INFO: JBoss EJB Client version 1.0.5.Final
lug 02, 2012 3:45:30 PM org.xnio.Xnio
INFO: XNIO Version 3.0.3.GA
lug 02, 2012 3:45:30 PM org.xnio.nio.NioXnio
INFO: XNIO NIO Implementation Version 3.0.3.GA
lug 02, 2012 3:45:30 PM org.jboss.remoting3.EndpointImpl
INFO: JBoss Remoting version 3.2.3.GA
lug 02, 2012 3:45:31 PM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
INFO: Received server version 1 and marshalling strategies [river]
lug 02, 2012 3:45:31 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
INFO: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@8c30cbb, receiver=Remoting connection EJB receiver [connection=Remoting connection ,channel=jboss.ejb,nodename=nbruicardorange]} on channel Channel ID df6764f1 (outbound) of Remoting connection 583a2d43 to localhost/127.0.0.1:4447
lug 02, 2012 3:45:31 PM org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver handleMessage
WARN: Unsupported message received with header 0xffffffff
lug 02, 2012 3:45:36 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
INFO: Initial module availability report for Remoting connection EJB receiver [connection=Remoting connection ,channel=jboss.ejb,nodename=nbruicardorange] wasn’t received during the receiver context association
Exception in thread “main” java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:RuiEJB,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@798322d1
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
at $Proxy0.saveEntityBean(Unknown Source)
at it.ssc.client.EJBApplicationClient.main(EJBApplicationClient.java:29)
string name is “ejb:/RuiEJB//SessionBean!it.ssc.business.SessionBeanRemote”
loading...
Hello,
Thanks for your post.
It is really useful:)
After I got the same outcomes, I wonder that means my client is already connected to the DB I chose?
Besides, how can I modify the codes in java to insert the data into the table I chose?
Thanks!!
loading...
Client is just invoking the method in EJB which connects to the database and returns the value. This example already shows how to insert data in the table, see saveProject() method in ProjectBean class.
loading...
Very Helpful tutorial, Thanks to the uploader.
loading...
Hi,it is very good tutorials.I trying to do this example in eclipse indigo with jboss(5.1) server.I not able to find the Standared.xm file.please help from that step onwards.is it possible to the above example using jboss(5.1).please help me.
thank you
loading...
Refer this tutorial link for creating EJB3 JPA project with JBoss AS 5.1 and Eclipse IDE
loading...
Hello…. I am new in Java. and I got this errors .. so please help me guru…………………….
Exception in thread “main” java.lang.NoClassDefFoundError: org/jboss/marshalling/FieldSetter
at org.jboss.ejb.client.EJBLocator.(EJBLocator.java:53)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.doCreateProxy(EjbNamingContext.java:137)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createEjbProxy(EjbNamingContext.java:113)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.lookup(EjbNamingContext.java:96)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at com.ibytecode.client.EJBApplicationClient.doLookup(EJBApplicationClient.java:55)
at com.ibytecode.client.EJBApplicationClient.main(EJBApplicationClient.java:16)
Caused by: java.lang.ClassNotFoundException: org.jboss.marshalling.FieldSetter
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
… 7 more
loading...
Hi thanks for the amazing tutorial
but i have this error
Aug 24, 2012 12:03:52 AM org.jboss.ejb.client.EJBClient
INFO: JBoss EJB Client version 1.0.5.Final
Exception in thread “main” java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:FirstJPAProject,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@8ef455
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
at $Proxy0.saveCatalog(Unknown Source)
at ejb3pack.client.EJBApplicationClient.main(EJBApplicationClient.java:36)
loading...
I am getting the below message in the console and Hello world is not shown, please guide :
“Found HelloWorldSessionBean.jar in deployment directory. To trigger deployment create a file called HelloWorldSessionBean.jar.dodeploy”
loading...
Do not spam. Know that others are busy with their works too. Reg the error, check the console, you may see some exceptions and cause.
loading...
Hi,
I am getting below error, please help
INFO: JBoss EJB Client version 1.0.5.Final
Exception in thread “main” java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:FirstJPAProject,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@482923
loading...
Possible problems – wrong lookup path, missing jars, ejb project not deployed on the server. Check the lookup path, include the necessary jars, see the jboss server console for exceptions. Carefully do all the steps mentioned.
loading...
hi
Nice tutorial but i got this type of error.
Please help me to solve it.Thanks in advance.
Exception in thread “main” java.lang.reflect.UndeclaredThrowableException
at $Proxy0.saveProject(Unknown Source)
at com.ibytecode.client.EJBApplicationClient.main(EJBApplicationClient.java:30)
Caused by: java.lang.ClassNotFoundException: org.hibernate.exception.ConstraintViolationException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.jboss.marshalling.AbstractClassResolver.loadClass(AbstractClassResolver.java:135)
at org.jboss.marshalling.AbstractClassResolver.resolveClass(AbstractClassResolver.java:116)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:892)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1204)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1677)
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1593)
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1557)
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1557)
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1557)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1235)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1677)
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1593)
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1557)
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1557)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1235)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1677)
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1593)
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1557)
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1557)
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1557)
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1557)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1235)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)
at org.jboss.ejb.client.remoting.InvocationExceptionResponseHandler$MethodInvocationExceptionResultProducer.getResult(InvocationExceptionResponseHandler.java:82)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:270)
at org.jboss.ejb.client.TransactionInterceptor.handleInvocationResult(TransactionInterceptor.java:47)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:272)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocationResult(ReceiverInterceptor.java:132)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:260)
at org.jboss.ejb.client.EJBClientInvocationContext.awaitResponse(EJBClientInvocationContext.java:399)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:140)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
… 2 more
loading...
Make sure you have included all the required jar files mentioned in the table under 14.4 section. I think you have missed JBoss-marshalling-river JAR file located in “AS7_HOME/modules/org/jboss/marshalling/river/main/”. If you use JBoss 7.1 FINAL, you need only one jar file (jboss-client-7.1.0.Final.jar which is located in ‘AS7_HOME/bin/client’ folder) in your client classpath. If you use the version mentioned in this tutorial, then include all the jars specified and run the client.
Also make sure you have client properties file in classpath or place it in the mentioned folder in this tutorial.
loading...
Thanks Nithya for reply,
I am using Jboss As 7.1.1 and i have include only one jar file jboss-client.jar which is located in above mention folder and my class-path properties file is in ejbModule.
but i got same error again and again.
Please help me to solve it.
Or my email Id: vhora.uvesh116@gmail.com
you can send reply on it.
Thanks
loading...
Hi Nithya ,
I have been working on the Migration Project from EJB 2 to EJB 3 with WebLogic Server 10.3 and DataBase as Sybase .
Actually I getting the following error as
“(java.lang.IllegalArgumentException: Unknown entity bean class:
class entity.MasatoTable,
please verify that this class has been marked with the @Entity annotation.) ” . Can u please help with this error . It will be much useful if you can Publish a Migration Project from EJB 2 to EJB 3 with Web Logic . Ur Posts have been very much useful.
Please help to solve my issue. Your Inputs are very much Appreciated.
Please reply to mail: krishna.gn41@gmail.com or reply this post .
Thanks
loading...
Excellent tutorial to start up with learning ejb in jboss AS 7 !!!
Thanks Nithya..
loading...
Hi Nithya……..really a very nice explanation… but when i try to deploy my project server following message
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.mysqlDriver (missing) dependents: [service jboss.data-source.java:/MySQLDS]
16:43:13,564 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
16:43:13,564 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss AS 7.1.1.Final “Brontes” started (with errors) in 2497ms – Started 134 of 212 services (2 services failed or missing dependencies, 74 services are passive or on-demand)
16:46:48,377 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads – 1) JBAS015003: Found Database.ear in deployment directory. To trigger deployment create a file called Database.ear.dodeploy
16:46:48,409 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of “Database.ear”
16:46:48,440 WARN [org.jboss.metadata.parser.jboss.JBossAppMetaDataParser] (MSC service thread 1-3) loader-repository element in jboss-app.xml is deprecated and has been ignored
16:46:48,472 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of “Jsfdatabase.war”
16:46:48,472 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of “Ejbdatabase.jar”
16:46:48,518 INFO [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011401: Read persistence.xml for JPADB
16:46:48,596 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named LoginDao in deployment unit subdeployment “Ejbdatabase.jar” of deployment “Database.ear” are as follows:
java:global/Database/Ejbdatabase/LoginDao!dao.LoginDaoRemote
java:app/Ejbdatabase/LoginDao!dao.LoginDaoRemote
java:module/LoginDao!dao.LoginDaoRemote
java:jboss/exported/Database/Ejbdatabase/LoginDao!dao.LoginDaoRemote
java:global/Database/Ejbdatabase/LoginDao
java:app/Ejbdatabase/LoginDao
java:module/LoginDao
16:46:48,862 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.subunit.”Database.ear”.”Ejbdatabase.jar”.INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit.”Database.ear”.”Ejbdatabase.jar”.INSTALL: Failed to process phase INSTALL of subdeployment “Ejbdatabase.jar” of deployment “Database.ear”
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0_27]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_27]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_27]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011047: Component class dao.LoginDao for component LoginDao has errors:
JBAS011440: Can’t find a persistence unit named EntityBean in subdeployment “Ejbdatabase.jar” of deployment “Database.ear”
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:169)
at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:162)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:155)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
… 5 more
16:46:48,908 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-4) Initializing Mojarra 2.1.7-jbossorg-1 (20120227-1401) for context ‘/database’
16:46:49,330 INFO [org.hibernate.validator.util.Version] (MSC service thread 1-4) Hibernate Validator 4.2.0.Final
16:46:49,595 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-4) Monitoring jndi:/default-host/database/WEB-INF/faces-config.xml for modifications
16:46:49,596 INFO [org.jboss.web] (MSC service thread 1-4) JBAS018210: Registering web context: /database
16:46:49,830 INFO [org.jboss.as.server] (DeploymentScanner-threads – 2) JBAS015870: Deploy of deployment “Database.ear” was rolled back with failure message {“JBAS014671: Failed services” => {“jboss.deployment.subunit.\”Database.ear\”.\”Ejbdatabase.jar\”.INSTALL” => “org.jboss.msc.service.StartException in service jboss.deployment.subunit.\”Database.ear\”.\”Ejbdatabase.jar\”.INSTALL: Failed to process phase INSTALL of subdeployment \”Ejbdatabase.jar\” of deployment \”Database.ear\”"},”JBAS014771: Services with missing/unavailable dependencies” => ["jboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao.ValidatorFactoryjboss.naming.context.java.comp.Database.Ejbdatabase.LoginDaoMissing[jboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao.ValidatorFactoryjboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao]“,”jboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao.Validatorjboss.naming.context.java.comp.Database.Ejbdatabase.LoginDaoMissing[jboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao.Validatorjboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao]“]}
16:46:49,845 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment Jsfdatabase.war in 26ms
16:46:49,861 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment Ejbdatabase.jar in 32ms
16:46:49,861 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment Database.ear in 39ms
16:46:49,861 INFO [org.jboss.as.controller] (DeploymentScanner-threads – 2) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao (missing) dependents: [service jboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao.Validator, service jboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao.ValidatorFactory]
JBAS014777: Services which failed to start: service jboss.deployment.subunit.”Database.ear”.”Ejbdatabase.jar”.INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit.”Database.ear”.”Ejbdatabase.jar”.INSTALL: Failed to process phase INSTALL of subdeployment “Ejbdatabase.jar” of deployment “Database.ear”
16:46:49,877 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads – 1) {“JBAS014653: Composite operation failed and was rolled back. Steps that failed:” => {“Operation step-2″ => {“JBAS014671: Failed services” => {“jboss.deployment.subunit.\”Database.ear\”.\”Ejbdatabase.jar\”.INSTALL” => “org.jboss.msc.service.StartException in service jboss.deployment.subunit.\”Database.ear\”.\”Ejbdatabase.jar\”.INSTALL: Failed to process phase INSTALL of subdeployment \”Ejbdatabase.jar\” of deployment \”Database.ear\”"},”JBAS014771: Services with missing/unavailable dependencies” => ["jboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao.ValidatorFactoryjboss.naming.context.java.comp.Database.Ejbdatabase.LoginDaoMissing[jboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao.ValidatorFactoryjboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao]“,”jboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao.Validatorjboss.naming.context.java.comp.Database.Ejbdatabase.LoginDaoMissing[jboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao.Validatorjboss.naming.context.java.comp.Database.Ejbdatabase.LoginDao]“]}}}
loading...
You got this error
Make sure these are given correctly;
1. “persistence.xml” file name correctly, it is case-sensitive.
2. persistence unit name in java code where you have injected (session bean) (Section 9), it should match persistence-unit name in persistence.xml (Section 10)
3. In datasource element, the jndi-name=”java:/MySQLDS” should match the java:/MySQLDS in persistence.xml (Section 11.4).
loading...
Hi Nithiya…thanks for the reply
According to your advice i changed the persistence unit name in persistence .xml and also i checked the jndi-name=”java:/MySQLDS in datasource element and java:/MySQLDS in persistence.xml both are matching but now I am getting new below error
Please help me to find out the error
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.mysqlDriver (missing) dependents: [service jboss.data-source.java:/MySQLDS]
10:52:28,359 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
10:52:28,359 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss AS 7.1.1.Final “Brontes” started (with errors) in 13468ms – Started 134 of 212 services (2 services failed or missing dependencies, 74 services are passive or on-demand)
10:53:52,325 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads – 1) JBAS015003: Found Database.ear in deployment directory. To trigger deployment create a file called Database.ear.dodeploy
10:53:52,326 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of “Database.ear”
10:53:52,404 WARN [org.jboss.metadata.parser.jboss.JBossAppMetaDataParser] (MSC service thread 1-3) loader-repository element in jboss-app.xml is deprecated and has been ignored
10:53:52,482 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of “Ejbdatabase.jar”
10:53:52,482 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of “Jsfdatabase.war”
10:53:52,701 INFO [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011401: Read persistence.xml for EntityBean
10:53:52,904 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named LoginDao in deployment unit subdeployment “Ejbdatabase.jar” of deployment “Database.ear” are as follows:
java:global/Database/Ejbdatabase/LoginDao!dao.LoginDaoRemote
java:app/Ejbdatabase/LoginDao!dao.LoginDaoRemote
java:module/LoginDao!dao.LoginDaoRemote
java:jboss/exported/Database/Ejbdatabase/LoginDao!dao.LoginDaoRemote
java:global/Database/Ejbdatabase/LoginDao
java:app/Ejbdatabase/LoginDao
java:module/LoginDao
10:53:53,730 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-3) Initializing Mojarra 2.1.7-jbossorg-1 (20120227-1401) for context ‘/database’
10:53:54,511 INFO [org.hibernate.validator.util.Version] (MSC service thread 1-3) Hibernate Validator 4.2.0.Final
10:53:54,886 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-3) Monitoring jndi:/default-host/database/WEB-INF/faces-config.xml for modifications
10:53:54,980 INFO [org.jboss.web] (MSC service thread 1-3) JBAS018210: Registering web context: /database
10:53:55,199 INFO [org.jboss.as.server] (DeploymentScanner-threads – 2) JBAS015870: Deploy of deployment “Database.ear” was rolled back with failure message JBAS014750: Operation handler failed to complete
10:53:55,214 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment Jsfdatabase.war in 21ms
10:53:55,214 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment Ejbdatabase.jar in 21ms
10:53:55,214 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment Database.ear in 23ms
10:53:55,214 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads – 1) {“JBAS014653: Composite operation failed and was rolled back. Steps that failed:” => {“Operation step-2″ => “JBAS014750: Operation handler failed to complete”}}
And my big doubt is that when i restart my server it showing below msg
New missing/unsatisfied dependencies:
service jboss.jdbc-driver.mysqlDriver (missing) dependents: [service jboss.data-source.java:/MySQLDS]
Is there any problem in Configuring of MySQL Datasource in JBoss AS 7?
loading...
This tutorial assumes you use server standalone.xml config file. Also check whether you have correctly followed the steps 10 and 11.
loading...
Hi Nithiya mam…………Thank u very much…….Actually in module.xml i given the resource-root path wrongly now i am correct that… now application working fine…
Thanks lot
loading...
dear nithiya, i tried your example and when trying to run the client application i get this exception. Do you have any solution for this?
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.addToEnvironment(Unknown Source)
at zahra.clientutility.JNDILookupClass.getInitialContext(JNDILookupClass.java:21)
at zahra.client.EJBApplicationClient.doLookup(EJBApplicationClient.java:50)
at zahra.client.EJBApplicationClient.main(EJBApplicationClient.java:15)
Exception in thread “main” java.lang.NullPointerException
at zahra.client.EJBApplicationClient.main(EJBApplicationClient.java:29)
loading...
Hi Nithiya Mam,
Thank you very much for this wonderful tutorial. I followed the steps specified and I am successfully able to deploy my jpa project. But while executing the client application I am getting the following error. Please help to resolve it.
18:15:46,742 ERROR [org.jboss.as.ejb3.remote.protocol.versionone.VersionOneProtocolChannelReceiver] (Remoting “wxin80001533d” task-3) Exception on channel Channel ID 2735e358 (inbound) of Remoting connection 00b9b1fe to /127.0.0.1:2142 from message org.jboss.remoting3.remote.InboundMessage$3@9e666f: java.io.EOFException: Read past end of file
at org.jboss.marshalling.SimpleDataInput.eofOnRead(SimpleDataInput.java:126) [jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
at org.jboss.marshalling.SimpleDataInput.readUnsignedByteDirect(SimpleDataInput.java:263) [jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
at org.jboss.marshalling.SimpleDataInput.readUnsignedByte(SimpleDataInput.java:224) [jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37) [jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.processMessage(MethodInvocationMessageHandler.java:156)
at org.jboss.as.ejb3.remote.protocol.versionone.VersionOneProtocolChannelReceiver.handleMessage(VersionOneProtocolChannelReceiver.java:170)
at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:437) [jboss-remoting-3.2.3.GA.jar:3.2.3.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_31]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]
loading...
I have created project as you explain, during execution it gives the following error
Can you please guide me?
Feb 22, 2013 1:08:20 PM org.jboss.ejb.client.EJBClient
INFO: JBoss EJB Client version 1.0.5.Final
Feb 22, 2013 1:08:20 PM org.xnio.Xnio
INFO: XNIO Version 3.0.3.GA
Feb 22, 2013 1:08:20 PM org.xnio.nio.NioXnio
INFO: XNIO NIO Implementation Version 3.0.3.GA
Feb 22, 2013 1:08:20 PM org.jboss.remoting3.EndpointImpl
INFO: JBoss Remoting version 3.2.3.GA
Feb 22, 2013 1:08:25 PM org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector setupEJBReceivers
WARN: Could not register a EJB receiver for connection to remote://localhost:4447
java.lang.RuntimeException: Operation failed with status WAITING
at org.jboss.ejb.client.remoting.IoFutureHelper.get(IoFutureHelper.java:93)
at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.setupEJBReceivers(ConfigBasedEJBClientContextSelector.java:121)
at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.(ConfigBasedEJBClientContextSelector.java:78)
at org.jboss.ejb.client.EJBClientContext.(EJBClientContext.java:77)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:120)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
at $Proxy0.saveProject(Unknown Source)
at com.ibytecode.client.EJBApplicationClient.main(EJBApplicationClient.java:29)
Exception in thread “main” java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:FirstJPAEJBProject,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@147c5fc
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
at $Proxy0.saveProject(Unknown Source)
at com.ibytecode.client.EJBApplicationClient.main(EJBApplicationClient.java:29)
loading...
I had the same issue, this solution got the job done
add the following line of code setting the properties of the jndi, when setting context
properties.put(“jboss.naming.client.ejb.context”, true);
I founded the solution here
http://stackoverflow.com/questions/11975396/no-ejb-receiver-available-for-handling
loading...
@Devang: Are u sure u named also the project “FirstJPAEJBProject”, like u specified in module name ?
I got the same problem and this was my fix
loading...
Mar 7, 2013 12:28:53 PM org.jboss.ejb.client.EJBClient
INFO: JBoss EJB Client version 1.0.5.Final
Mar 7, 2013 12:28:53 PM org.xnio.Xnio
INFO: XNIO Version 3.0.3.GA
Mar 7, 2013 12:28:53 PM org.xnio.nio.NioXnio
INFO: XNIO NIO Implementation Version 3.0.3.GA
Mar 7, 2013 12:28:53 PM org.jboss.remoting3.EndpointImpl
INFO: JBoss Remoting version 3.2.3.GA
Mar 7, 2013 12:28:54 PM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
INFO: Received server version 1 and marshalling strategies [river]
Mar 7, 2013 12:28:54 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
INFO: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@9446e4, receiver=Remoting connection EJB receiver [connection=Remoting connection ,channel=jboss.ejb,nodename=laptop]} on channel Channel ID dc2db15c (outbound) of Remoting connection 00b60b93 to localhost/127.0.0.1:4447
Mar 7, 2013 12:28:54 PM org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver handleMessage
WARN: Unsupported message received with header 0xffffffff
what can i do?
loading...
Exception in thread “main” java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:FirstJPAProject,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@1d20cb10
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
at $Proxy0.saveProject(Unknown Source)
at com.ibytecode.client.EJBApplicationClient.main(EJBApplicationClient.java:30)
loading...
Thank you so much for this tutorial, you are a lifesaver!
loading...