jQuery in Action, 2nd edition*
The moose likes EJB and other Java EE Technologies and the fly likes NameNotFoundExcption Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "NameNotFoundExcption" Watch "NameNotFoundExcption" New topic
Author

NameNotFoundExcption

Faraz Ali
Ranch Hand

Joined: May 15, 2008
Posts: 108
Hi All,
I created a test application, in which create an entity bean and calling that from a session bean. In another test client application, i am calling session bean's method. Now i am getting NameNotFoundException. I am using Eclipse, jdk 5, mysql, jboss 4.2.

I am also pasting the code here:

@Entity
@Table(name="book")
public class Book implements Serializable {
@Id
@Column(name="ID")
private int 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;
}

public String toString() {
return "Book: " + getId() + " Title " + getTitle() + " Author " + getAuthor();
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}

@Remote
public interface BookSessionRemote {
public void addBook(String title, String author);
}

@Stateless(name="BookSessionRemoteBean")
@Remote(BookSessionRemote.class)
public class BookSessionRemoteBean implements BookSessionRemote {
@PersistenceContext
EntityManager em;

public static final String RemoteJNDIName = BookSessionRemoteBean.class.getSimpleName() + "/remote";

public void addBook(String title, String author){
Book b = new Book(null, title, author);
em.persist(b);
}
}


persistance.xml
<persistence version="1.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_1_0.xsd">
<persistence-unit name="test1">
<jta-data-source>java:/test1</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.show_sql" value="true"/>
</properties>
</persistence-unit>
</persistence>

mysql-ds.xml
<datasources>
<local-tx-datasource>
<jndi-name>MySqlDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/hms</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>root</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>

<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>


i did not add anything in orm.xml, ejb-jar.xml. i add mysql connector jar in application lib directory, not in jboss lib. After deplying this application, i am getting error below:

23:21:29,328 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

--- MBeans waiting for other MBeans ---
ObjectName: persistence.units:jar=test1.jar,unitName=test1
State: NOTYETINSTALLED
I Depend On:
jboss.jca:name=test1,service=DataSourceBinding
Depends On Me:
jboss.j2ee:jar=test1.jar,name=BookSessionRemoteBean,service=EJB3

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

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



but i am ignoring this error. I created another project and write a simple jsp from where i am calling above session bean. the code of jsp is below:

<%
BookSessionRemote book = null;

try {
Properties properties = new Properties();
properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.factory.url.pkgs","=org.jboss.naming rg.jnp.interfaces");
properties.put("java.naming.provider.url","localhost:1099");

InitialContext ic = new InitialContext();
book = (BookSessionRemote) ic.lookup("BookSessionRemoteBean");
System.out.println("Loaded book Bean");
book.addBook("t1","a1");
} catch (Exception e) {
e.printStackTrace ();
}
%>

now when i am running this jsp, i am getting the exception:

23:21:53,796 ERROR [STDERR] javax.naming.NameNotFoundException: BookSessionRemoteBean not bound
23:21:53,796 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
23:21:53,796 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
23:21:53,796 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
23:21:53,796 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
23:21:53,796 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
23:21:53,796 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
23:21:53,796 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351)
23:21:53,796 ERROR [STDERR] at org.apache.jsp.c1_jsp._jspService(c1_jsp.java:69)



please someone help me on this.

thanks in advance,
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
Originally posted by Faraz Ali:

but i am ignoring this error.


You have to resolve deployment errors before you attempt to access your session bean from a client. On the surface, it looks like you have to put the driver where it can be found at deployment time, make sure the database is up, and ususally it works . The JBoss forum has more details in case you need them.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9941
    
159

<jta-data-source>java:/test1</jta-data-source>


This part looks incorrect. This should point to the jndiname of the datasource which you have deployed. In your case it is java:/MySqlDS

So change the persistence.xml to point to



[My Blog] [JavaRanch Journal]
Faraz Ali
Ranch Hand

Joined: May 15, 2008
Posts: 108
I tried both ways but still not working. May be i need to bind the bean name somewhere. And one thing i want to clarify further is this that my client jsp is in another project.

edvins, how to resolve the deployment error below:
23:21:29,328 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

--- MBeans waiting for other MBeans ---
ObjectName: persistence.units:jar=test1.jar,unitName=test1
State: NOTYETINSTALLED
I Depend On:
jboss.jca:name=test1,service=DataSourceBinding
Depends On Me:
jboss.j2ee:jar=test1.jar,name=BookSessionRemoteBean,service=EJB3

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

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


And jaikiran, i think i need to bind the ejb to somewhere.

i m totally stuck, please help.

thanks,
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
I think that in the server output, there should be exceptions which point to the cause more precisely. And I think Jaikiran was right about the data source name in persistence.xml.
Faraz Ali
Ranch Hand

Joined: May 15, 2008
Posts: 108
But i modified the persistance.xml as jaikiran mentioned.
Below is the complete exception stack trace:

17:23:42,343 INFO [JmxKernelAbstraction] persistence.units:jar=test1.jar,unitName=test1
17:23:42,343 INFO [EJB3Deployer] Deployed: file:/C:/Uninstall/jboss-4.2.3.GA/server/default/deploy/test1.jar/
17:23:42,421 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
17:23:42,546 INFO [TomcatDeployer] deploy, ctxPath=/test1Client, warUrl=.../deploy/test1Client.war/
17:23:42,609 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

--- MBeans waiting for other MBeans ---
ObjectName: persistence.units:jar=test1.jar,unitName=test1
State: NOTYETINSTALLED
I Depend On:
jboss.jca:name=MySqlDS,service=DataSourceBinding
Depends On Me:
jboss.j2ee:jar=test1.jar,name=BookSessionRemoteBean,service=EJB3

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

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


17:23:42,703 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-localhost%2F127.0.0.1-8080
17:23:42,718 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-localhost%2F127.0.0.1-8009
17:23:42,734 INFO [Server] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)] Started in 21s:953ms

17:24:29,359 ERROR [STDERR] javax.naming.NameNotFoundException: BookSessionRemoteBean not bound
17:24:29,359 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
17:24:29,359 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
17:24:29,359 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
17:24:29,359 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
17:24:29,359 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
17:24:29,359 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
17:24:29,359 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
17:24:29,359 ERROR [STDERR] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
17:24:29,359 ERROR [STDERR] at sun.rmi.transport.Transport$1.run(Transport.java:153)
17:24:29,359 ERROR [STDERR] at java.security.AccessController.doPrivileged(Native Method)
17:24:29,359 ERROR [STDERR] at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
17:24:29,359 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
17:24:29,359 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
17:24:29,359 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
17:24:29,359 ERROR [STDERR] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
17:24:29,359 ERROR [STDERR] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
17:24:29,359 ERROR [STDERR] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
17:24:29,359 ERROR [STDERR] at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
17:24:29,359 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
17:24:29,359 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
17:24:29,359 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351)
17:24:29,359 ERROR [STDERR] at org.apache.jsp.c1_jsp._jspService(c1_jsp.java:69)
17:24:29,359 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
17:24:29,359 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
17:24:29,359 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
17:24:29,359 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
17:24:29,359 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
17:24:29,359 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
17:24:29,359 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
17:24:29,359 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:24:29,359 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
17:24:29,359 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
17:24:29,359 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:24:29,359 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
17:24:29,359 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
17:24:29,359 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
17:24:29,359 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
17:24:29,359 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
17:24:29,359 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
17:24:29,359 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
17:24:29,359 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
17:24:29,359 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
17:24:29,359 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
17:24:29,359 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
17:24:29,359 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
17:24:29,359 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
Originally posted by Faraz Ali:
[QB]
i add mysql connector jar in application lib directory, not in jboss lib.
[QB]


Can you put the driver on the server, for testing if you have a reason to not put it there permanently?
Faraz Ali
Ranch Hand

Joined: May 15, 2008
Posts: 108
I put the driver inside jboss/lib and jboss/server/default/lib.

But no effect.
S Setty
Greenhorn

Joined: Sep 08, 2008
Posts: 16
I noticed this code from your earlier post

InitialContext ic = new InitialContext();
book = (BookSessionRemote) ic.lookup("BookSessionRemoteBean");

Can you check your log when server starts up to see the jndi name for this bean.

For me it is like ear-name/BookSessionRemoteBean/remote, can you try to lookup using the above jndi (remember to change "ear-name" to your ear app name).
Faraz Ali
Ranch Hand

Joined: May 15, 2008
Posts: 108
Hi setty,

its still same. Same exception.
I am not creating ear file, i am just creating a jar file. My beans are inisde the jar and jsp is inside war file. both are separate projects. so i used my applicationname/beanname/remote, but stil not working.

By the way, dont we need to bind the ejb to some context? means how client will locate the bean? whats the mechanism? its says that ejb is not bound.
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
The bean will be bound when deployed; this is why it is critical to resolve deployment issues before attempting to look up the bean.
On the server, there is a page where you can see the deployed components and their interfaces.
I am surprised that the server does not give a reason (an exception trace) for not deploying the data source, but the last time I resolved deployment issues on JBoss is not very recent.
aleem khan
Ranch Hand

Joined: Aug 07, 2008
Posts: 94
Most likely your jboss 4.2 doesn't support EJB3.0 , could you please try with latest version of jboss? or try with sun's GlassFish


SCJP(1.4), SCWCD, Oracle 9i SQL certified, Oracle PLSQL Developer Certified Associate
Faraz Ali
Ranch Hand

Joined: May 15, 2008
Posts: 108
I changed my jboss to 5.0 and my java is still 5.0. I am now getting below error:

14:48:09,765 INFO [STDOUT] ======> Creating interceptor metadata bridge
14:48:09,781 INFO [JBossASKernel] Created KernelDeployment for: test1.jar
14:48:09,781 INFO [JBossASKernel] installing bean: persistence.units:ear=test1.jar.ear,jar=test1.jar,unitName=test1
14:48:09,781 INFO [JBossASKernel] with dependencies:
14:48:09,781 INFO [JBossASKernel] and demands:
14:48:09,781 INFO [JBossASKernel] jboss.jca:name=MySqlDS,service=DataSourceBinding
14:48:09,781 INFO [JBossASKernel] and supplies:
14:48:09,781 INFO [JBossASKernel] persistence.units:unitName=test1
14:48:09,781 INFO [JBossASKernel] Added bean(persistence.units:ear=test1.jar.ear,jar=test1.jar,unitName=test1) to KernelDeployment of: test1.jar
14:48:09,796 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=test1.jar,jar=test1.jar,name=BookSessionRemoteBean,service=EJB3
14:48:09,796 INFO [JBossASKernel] with dependencies:
14:48:09,796 INFO [JBossASKernel] and demands:
14:48:09,796 INFO [JBossASKernel] persistence.units:ear=test1.jar.ear,jar=test1.jar,unitName=test1
14:48:09,796 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
14:48:09,796 INFO [JBossASKernel] and supplies:
14:48:09,796 INFO [JBossASKernel] jndi:BookSessionRemoteBean
14:48:09,796 INFO [JBossASKernel] jndi:BookSessionRemoteBean/remote-test.session.stateless.BookSessionRemote
14:48:09,796 INFO [JBossASKernel] jndi:BookSessionRemoteBean/remote
14:48:09,796 INFO [JBossASKernel] Class:test.session.stateless.BookSessionRemote
14:48:09,796 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=test1.jar,jar=test1.jar,name=BookSessionRemoteBean,service=EJB3) to KernelDeployment of: test1.jar
14:48:09,812 WARN [HDScanner] Failed to process changes
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

*** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}

jboss.j2ee:ear=test1.jar,jar=test1.jar,name=BookSessionRemoteBean,service=EJB3
-> <UNKNOWN jboss.j2ee:ear=test1.jar,jar=test1.jar,name=BookSessionRemoteBean,service=EJB3>{Described:** UNRESOLVED Demands 'persistence.units:ear=test1.jar.ear,jar=test1.jar,unitName=test1' **}

persistence.units:ear=test1.jar.ear,jar=test1.jar,unitName=test1
-> <UNKNOWN persistence.units:ear=test1.jar.ear,jar=test1.jar,unitName=test1>{Described:** UNRESOLVED Demands 'jboss.jca:name=MySqlDS,service=DataSourceBinding' **}


*** CONTEXTS IN ERROR: Name -> Error

<UNKNOWN jboss.j2ee:ear=test1.jar,jar=test1.jar,name=BookSessionRemoteBean,service=EJB3> -> ** UNRESOLVED Demands 'persistence.units:ear=test1.jar.ear,jar=test1.jar,unitName=test1' **

<UNKNOWN persistence.units:ear=test1.jar.ear,jar=test1.jar,unitName=test1> -> ** UNRESOLVED Demands 'jboss.jca:name=MySqlDS,service=DataSourceBinding' **


at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:676)
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:661)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:291)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9941
    
159

Originally posted by aleem khan:
Most likely your jboss 4.2 doesn't support EJB3.0


JBoss-4.2.x has a EJB3 plugin and does support EJB3 deployment. It however does not support injection of EJB3 beans into web-tier (servlets).

Faraz,

Please do this:

1) Post the contents of your datasource file (again).
2) Post the contents of your persistence.xml file (again).
3) Post the output of the following command:



Are you deploying the application as a EAR or a jar file?

4) Where have you placed the datasource file and what is its name?
5) Finally post the entire console logs of JBoss.

While posting all this information (logs, xml content or code) remember to wrap it in a code block using the Code button in the message editor window.
Faraz Ali
Ranch Hand

Joined: May 15, 2008
Posts: 108
1. Datasource file jboss-5.0\docs\examples\jca\mysql-ds.xml


2. persistance.xml file


Yes i deployed as jar file

3. jar -tf test1.jar
C:\test1>jar -tf test1.jar
META-INF/
META-INF/MANIFEST.MF
META-INF/persistence.xml
test/
test/entities/
test/entities/Book.java
test/session/
test/session/stateless/
test/session/stateless/BookSessionRemote.java
test/session/stateless/BookSessionRemoteBean.java

4. I placed my data source file in jboss-5.0\docs\examples\jca and its name is mysql-ds.xml

5. Jboss logs
C:\Uninstall\jboss-5.0\bin>run
===============================================================================

JBoss Bootstrap Environment

JBOSS_HOME: C:\Uninstall\jboss-5.0

JAVA: C:\Program Files\Java\jdk1.5.0_13\bin\java

JAVA_OPTS: -Dprogram.name=run.bat -server -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=
3600000

CLASSPATH: C:\Uninstall\jboss-5.0\bin\run.jar

===============================================================================

14:19:01,656 INFO [ServerImpl] Starting JBoss (Microcontainer)...
14:19:01,656 INFO [ServerImpl] Release ID: JBoss [Morpheus] 5.0.0.CR1 (build: SVNTag=JBoss_5_0_0_CR1 date=200806301254)
14:19:01,656 INFO [ServerImpl] Home Dir: C:\Uninstall\jboss-5.0
14:19:01,656 INFO [ServerImpl] Home URL: file:/C:/Uninstall/jboss-5.0/
14:19:01,656 INFO [ServerImpl] Library URL: file:/C:/Uninstall/jboss-5.0/lib/
14:19:01,656 INFO [ServerImpl] Patch URL: null
14:19:01,656 INFO [ServerImpl] Server Name: default
14:19:01,656 INFO [ServerImpl] Server Home Dir: C:\Uninstall\jboss-5.0\server\default
14:19:01,671 INFO [ServerImpl] Server Home URL: file:/C:/Uninstall/jboss-5.0/server/default/
14:19:01,671 INFO [ServerImpl] Server Data Dir: C:\Uninstall\jboss-5.0\server\default\data
14:19:01,671 INFO [ServerImpl] Server Temp Dir: C:\Uninstall\jboss-5.0\server\default\tmp
14:19:01,671 INFO [ServerImpl] Server Config URL: file:/C:/Uninstall/jboss-5.0/server/default/conf/
14:19:01,671 INFO [ServerImpl] Server Library URL: file:/C:/Uninstall/jboss-5.0/server/default/lib/
14:19:01,671 INFO [ServerImpl] Root Deployment Filename: jboss-service.xml
14:19:03,312 INFO [ServerImpl] Starting Microcontainer, bootstrapURL=file:/C:/Uninstall/jboss-5.0/server/default/conf/bootstrap.xml
14:19:05,859 INFO [CopyMechanism] VFS temp dir: C:\Uninstall\jboss-5.0\server\default\tmp
14:19:05,859 INFO [ZipEntryContext] VFS force nested jars copy-mode is enabled.
14:19:09,093 INFO [ServerInfo] Java version: 1.5.0_13,Sun Microsystems Inc.
14:19:09,093 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.5.0_13-b05,Sun Microsystems Inc.
14:19:09,093 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
14:19:09,171 INFO [JMXKernel] Legacy JMX core initialized
14:19:11,031 INFO [MetaDataAwareProfile] Using profile root:C:\Uninstall\jboss-5.0\server\default
14:19:18,453 INFO [WebService] Using RMI server codebase: http://127.0.0.1:8083/
14:19:34,625 WARN [HackClassloaderMetaDataDeployer] FIXME Using loader repository config: jboss.console:sar=console-mgr.sar for vfsfile:/C:/Uninstall/jbo
ss-5.0/server/default/deploy/management/console-mgr.sar/ use classloading metadata not loader repository config
14:19:35,437 INFO [AspectDeployer] Deploying xml into org.jboss.aop.AspectManager@cb36fa for BaseClassLoader@3a71ed{vfsfile:/C:/Uninstall/jboss-5.0/server
/default/deploy/ejb3-interceptors-aop.xml}
14:20:13,984 INFO [JMXConnectorServerService] JMX Connector server: service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1090/jmxconnector
14:20:14,187 INFO [MailService] Mail Service bound to java:/Mail
14:20:14,218 WARN [JBossASSecurityMetadataStore] WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messa
ges from one node to another has not had its password changed from the installation default. Please see the JBoss Messaging user guide for instructions on
how to do this.
14:20:15,000 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
14:20:15,000 INFO [TransactionManagerService] Setting up property manager MBean and JMX layer
14:20:15,515 INFO [TransactionManagerService] Starting recovery manager
14:20:15,843 INFO [TransactionManagerService] Recovery manager started
14:20:15,843 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference
14:20:16,281 INFO [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the
java.library.path: C:\Program Files\Java\jdk1.5.0_13\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\Perl\site\bin;C:\Perl\bin;C:\Program Files\PC Connectivity So
lution\;C:\Program Files\Common Files\NetSarang;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ActivCard\ActivCard Gold\resources
;C:\Program Files\Common Files\Teleca Shared;C:\Program Files\Common Files\Ulead Systems\MPEG;C:\Program Files\Java\jdk1.5.0_13\bin;C:\HP Clients;C:\HP Cli
ents\TeMIP Client V5.3 for Windows;C:\Program Files\IBM\Installation Manager\eclipse\lib;C:\Program Files\TeMIP Client V5.3 for Windows;;
14:20:16,343 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
14:20:16,343 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
14:20:16,343 INFO [Catalina] Initialization processed in 254 ms
14:20:16,343 INFO [StandardService] Starting service jboss.web
14:20:16,343 INFO [StandardEngine] Starting Servlet Engine: JBoss Web/2.1.1.CR3
14:20:16,406 INFO [Catalina] Server startup in 66 ms
14:20:16,750 INFO [RARDeployment] Required license terms exist, view vfszip:/C:/Uninstall/jboss-5.0/server/default/deploy/jboss-local-jdbc.rar/META-INF/ra
.xml
14:20:16,765 INFO [RARDeployment] Required license terms exist, view vfszip:/C:/Uninstall/jboss-5.0/server/default/deploy/jboss-xa-jdbc.rar/META-INF/ra.xm
l
14:20:16,812 INFO [RARDeployment] Required license terms exist, view vfszip:/C:/Uninstall/jboss-5.0/server/default/deploy/jms-ra.rar/META-INF/ra.xml
14:20:16,828 INFO [RARDeployment] Required license terms exist, view vfszip:/C:/Uninstall/jboss-5.0/server/default/deploy/mail-ra.rar/META-INF/ra.xml
14:20:16,890 INFO [RARDeployment] Required license terms exist, view vfszip:/C:/Uninstall/jboss-5.0/server/default/deploy/quartz-ra.rar/META-INF/ra.xml
14:20:17,046 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
14:20:17,093 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
14:20:17,093 INFO [RAMJobStore] RAMJobStore initialized.
14:20:17,093 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.proper
ties'
14:20:17,093 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
14:20:17,109 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
14:20:17,968 INFO [NativeServerConfig] JBoss Web Services - Stack Native Core
14:20:17,984 INFO [NativeServerConfig] 3.0.2.GA
14:20:19,234 INFO [TomcatDeployment] deploy, ctxPath=/, vfsUrl=ROOT.war
14:20:19,781 INFO [TomcatDeployment] deploy, ctxPath=/jmx-console, vfsUrl=jmx-console.war
14:20:19,843 INFO [TomcatDeployment] deploy, ctxPath=/invoker, vfsUrl=http-invoker.sar/invoker.war
14:20:20,015 INFO [TomcatDeployment] deploy, ctxPath=/web-console, vfsUrl=management/console-mgr.sar/web-console.war
14:20:20,531 INFO [TomcatDeployment] deploy, ctxPath=/jbossws, vfsUrl=jbossws.sar/jbossws-management.war
14:20:20,671 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java efaul
tDS'
14:20:21,078 WARN [QuartzTimerServiceFactory] sql failed: CREATE TABLE QRTZ_JOB_DETAILS(JOB_NAME VARCHAR(80) NOT NULL, JOB_GROUP VARCHAR(80) NOT NULL, DES
CRIPTION VARCHAR(120) NULL, JOB_CLASS_NAME VARCHAR(128) NOT NULL, IS_DURABLE VARCHAR(1) NOT NULL, IS_VOLATILE VARCHAR(1) NOT NULL, IS_STATEFUL VARCHAR(1) N
OT NULL, REQUESTS_RECOVERY VARCHAR(1) NOT NULL, JOB_DATA BINARY NULL, PRIMARY KEY (JOB_NAME,JOB_GROUP))
14:20:21,156 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
14:20:21,156 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
14:20:21,156 INFO [JobStoreCMT] Using db table-based data access locking (synchronization).
14:20:21,187 INFO [JobStoreCMT] Removed 0 Volatile Trigger(s).
14:20:21,187 INFO [JobStoreCMT] Removed 0 Volatile Job(s).
14:20:21,187 INFO [JobStoreCMT] JobStoreCMT initialized.
14:20:21,187 INFO [StdSchedulerFactory] Quartz scheduler 'JBossEJB3QuartzScheduler' initialized from an externally provided properties instance.
14:20:21,187 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
14:20:21,187 INFO [JobStoreCMT] Freed 0 triggers from 'acquired' / 'blocked' state.
14:20:21,203 INFO [JobStoreCMT] Recovering 0 jobs that were in-progress at the time of the last shut-down.
14:20:21,203 INFO [JobStoreCMT] Recovery complete.
14:20:21,203 INFO [JobStoreCMT] Removed 0 'complete' triggers.
14:20:21,203 INFO [JobStoreCMT] Removed 0 stale fired job entries.
14:20:21,203 INFO [QuartzScheduler] Scheduler JBossEJB3QuartzScheduler_$_NON_CLUSTERED started.
14:20:21,625 INFO [ServerPeer] JBoss Messaging 1.4.1.CR1 server [0] started
14:20:21,812 INFO [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
14:20:21,812 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@1e10abe started
14:20:21,828 INFO [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
14:20:21,828 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@e2dc4 started
14:20:21,843 WARN [ConnectionFactoryJNDIMapper] supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=Cluste
redConnectionFactory but post office is non clustered. So connection factory will *not* support failover
14:20:21,843 WARN [ConnectionFactoryJNDIMapper] supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=C
lusteredConnectionFactory but post office is non clustered. So connection factory will *not* support load balancing
14:20:21,843 INFO [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
14:20:21,843 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@e3144 started
14:20:21,859 INFO [QueueService] Queue[/queue/DLQ] started, fullSize=200000, pageSize=2000, downCacheSize=2000
14:20:21,875 INFO [QueueService] Queue[/queue/ExpiryQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
14:20:21,875 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:Jms
XA'
14:20:22,031 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
14:20:22,046 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
14:20:22,062 INFO [ServerImpl] JBoss (Microcontainer) [5.0.0.CR1 (build: SVNTag=JBoss_5_0_0_CR1 date=200806301254)] Started in 1m:20s:391ms
14:20:37,515 INFO [JBossASKernel] Created KernelDeployment for: test1.jar
14:20:37,531 INFO [JBossASKernel] installing bean: persistence.units:ear=test1.jar.ear,unitName=test1
14:20:37,531 INFO [JBossASKernel] with dependencies:
14:20:37,531 INFO [JBossASKernel] and demands:
14:20:37,531 INFO [JBossASKernel] jboss.jca:name=MySqlDS,service=DataSourceBinding
14:20:37,531 INFO [JBossASKernel] and supplies:
14:20:37,531 INFO [JBossASKernel] persistence.units:unitName=test1
14:20:37,531 INFO [JBossASKernel] Added bean(persistence.units:ear=test1.jar.ear,unitName=test1) to KernelDeployment of: test1.jar
14:20:37,546 WARN [HDScanner] Failed to process changes
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

*** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}

persistence.units:ear=test1.jar.ear,unitName=test1
-> <UNKNOWN persistence.units:ear=test1.jar.ear,unitName=test1>{Described:** UNRESOLVED Demands 'jboss.jca:name=MySqlDS,service=DataSourceBinding' **}


*** CONTEXTS IN ERROR: Name -> Error

<UNKNOWN persistence.units:ear=test1.jar.ear,unitName=test1> -> ** UNRESOLVED Demands 'jboss.jca:name=MySqlDS,service=DataSourceBinding' **


at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:676)
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:661)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:291)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)



I put mysql connector jar file in jboss-5.0\server\default\lib and also in
jboss-5.0\lib. Jar file name is mysql-connector-java-5.1.3-rc-bin.jar, and i think it is compatible with jdk 1.5.

Looking forward for the reply,
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9941
    
159

Originally posted by Faraz Ali:

4. I placed my data source file in jboss-5.0\docs\examples\jca and its name is mysql-ds.xml


You have to place it in jboss-5.0\server\default\deploy folder.


Originally posted by Faraz Ali:
I put mysql connector jar file in jboss-5.0\server\default\lib and also in
jboss-5.0\lib. Jar file name is mysql-connector-java-5.1.3-rc-bin.jar, and i think it is compatible with jdk 1.5.


Placing it only in jboss-5.0\server\default\lib is enough.
Faraz Ali
Ranch Hand

Joined: May 15, 2008
Posts: 108
Thank you very much. I changed the mysql-ds.xml and jar file location and now EJB is finally deployed.

Now, from a jsp (in another project), i am calling that bean. There is ClassCastException. See the code below and than the exception:

Faraz Ali
Ranch Hand

Joined: May 15, 2008
Posts: 108
Its working now. I am getting below warning message:

10:14:27,968 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
10:14:27,968 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming rg.jnp.interfaces}
10:14:28,156 INFO [EJBContainer] STARTED EJB: test.session.stateless.BookSessionRemoteBean ejbName: BookSessionRemoteBean
10:14:41,687 INFO [STDOUT] Loaded book Bean
10:14:41,687 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container
10:14:41,687 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container

How to resolve it?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9941
    
159

You can safely ignore it, based on the following comment in JIRA EJBTHREE-1246

For a bean developer this warning can be safely ignored.
 
Consider Paul's rocket mass heater.
 
subject: NameNotFoundExcption
 
Similar Threads
need help configuring Jboss, EJB, Derby DB
Incomplete Deployment
Help with ERROR [URLDeploymentScanner] Incomplete Deployment listing:
deployment problem to JBoss 4.2.1-GA
EJB 3.0 and EJB 2.1 Integration