EJB reference not bound
I'm running JBoss 3.0.1 with Tomcat 4.0.4 bundle. I have successfully deployed a EJB to Jboss and created 2 clients (java & JSP client).
For some reasons, I'm able to run the java client but when I try the JSP client (served by Tomcat) I get this error message
javax.servlet.ServletException: Name greetings is not bound in this Context
Below is the code for the 2 clients & web.xml
<----------- jsp client -------------->
<%@ page import="javax.naming.*,
java.util.*,
java.util.Hashtable,
javax.rmi.PortableRemoteObject,
com.stardeveloper.ejb.session.*"%>
<%
long t1 = System.currentTimeMillis();
InitialContext ctx = new InitialContext();
Object ref = ctx.lookup("ejb/First");
FirstHome home = (FirstHome) PortableRemoteObject.narrow (ref, FirstHome.class);
First bean = home.create();
String time = bean.getTime();
bean.remove();
ctx.close();
long t2 = System.currentTimeMillis();
%>
<html>
<head>
<style>p { font-family:Verdana;font-size:12px; }</style>
</head>
<body>
<p>Message received from bean = "<%= time %>".<br>Time taken :
<%= (t2 - t1) %> ms.</p>
</body>
</html>
<----------- java client ------------->
import javax.naming.*;
import com.stardeveloper.ejb.session.*;
import java.util.Hashtable;
import javax.rmi.PortableRemoteObject;
import com.stardeveloper.ejb.session.*;
class firstEJBclient {
public static void main(String[] args) {
try {
long t1 = System.currentTimeMillis();
InitialContext ctx = new InitialContext();
System.out.println("Got CONTEXT");
Object ref = ctx.lookup("ejb/First");
System.out.println("Got REFERENCE");
FirstHome home = (FirstHome) PortableRemoteObject.narrow (ref, FirstHome.class);
First bean = home.create();
String time = bean.getTime();
bean.remove();
ctx.close();
long t2 = System.currentTimeMillis();
System.out.println("Message received from bean = "+time+" Time taken : "+(t2 - t1)+" ms.");
catch (Exception e) {
System.out.println(e.toString());
<----------------- web.xml -------------------->
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<session-config>
<session-timeout>
1800
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
firstEJB2.jsp
</welcome-file>
</welcome-file-list>
<ejb-ref>
<description>A reference to an entity bean</description>
<ejb-ref-name>ejb/First</ejb-ref-name>
<ejb-ref-type>Stateless</ejb-ref-type>
<home>com.stardeveloper.ejb.session.FirstHome</home>
<remote>com.stardeveloper.ejb.session.First</remote>
</ejb-ref>
</web-app>
Why is it not bound?
Please Ignore my other Message(My META-INF was not in Root and now I am able to get my beans bound).
I am using Jboss 3.0
I am able to access service of my HelloWorld Session Bean through a jsp.
But not able to do so using a java client.
my directory structure is :
com\ideas\users\<Bean classes(Remote Interface,home interface,Bean)>
com\ideas\users\<Bean client(a java client)>
My java client program is :
import javax.rmi.*;
import javax.naming.*;
import java.util.*;
import com.ideas.users.*;
public class HelloWorld {
public static void main( String args[]) {
try{
Properties p = new Properties();
p.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
p.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
p.put("java.naming.provider.url","localhost");
InitialContext ctx = new InitialContext(p);
//Lookup the bean using it's deployment id
Object obj = ctx.lookup("users/Hello");
//Be good and use RMI remote object narrowing
//as required by the EJB specification.
HelloHome ejbHome = (HelloHome) PortableRemoteObject.narrow(obj,HelloHome.class);
//Use the HelloHome to create a HelloObject
Hello ejbObject = ejbHome.create();
//The part we've all been wainting for...
String message = ejbObject.sayHello();
//A drum roll please.
System.out.println( " run successfully and message is :" + message);
} catch (Exception e){
e.printStackTrace();
I am able to compile but when i try to Run I get the following error message
javax.naming.CommunicationException. Root exception is java.lang.ClassNotFoundException: org.jboss.proxy.ClientContainer (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source)
at java.io.ObjectInputStream.inputClassDescriptor(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.io.ObjectInputStream.inputObject(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.io.ObjectInputStream.inputClassFields(Unknown Source)
at java.io.ObjectInputStream.defaultReadObject(Unknown Source)
at java.io.ObjectInputStream.inputObject(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.rmi.MarshalledObject.get(Unknown Source)
at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:30)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:449)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)
at javax.naming.InitialContext.lookup(Unknown Source)
at HelloWorld.main(HelloWorld.java:25)
Please help me out .
Thanks in advance
Sujith
Similar Messages
-
Ejb reference not bound when calling a stateless bean in jboss
hi there !
i am trying to deploy a simple stateless session bean in Jboss3.0.4_tomcat-4.1.12
my bean is successfully deployed but when it is looked up in a jsp i am getting an exception as below :
javax.naming.NameNotFoundException ejb not bound
my ejb-jar.xml is as follows :
<session>
<display-name>FirstEJB</display-name>
<ejb-name>First</ejb-name>
<home>com.ejb.session.FirstHome</home>
<remote>com.ejb.session.First</remote>
<ejb-class>com.ejb.session.FirstEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
jboss.xml is as follows:
<jboss>
<enterprise-beans>
<session>
<ejb-name>First</ejb-name>
<jndi-name>ejb/First</jndi-name>
</session>
</enterprise-beans>
</jboss>
my jsp is as follows :
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL,"localhost:1099");
props.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces" );
props.put("java.naming.rmi.security.manager","yes");
Context ctx = new InitialContext(props);
System.out.println("Before LookUp");
FirstHome home = (FirstHome)ctx.lookup("session.First");
System.out.println("LookUp Successfull");
First bean = home.create();
Can anyone fix this ?
Thanx in AdvanceHi,
hi Vicky !
thanx again for ur response.
i created a Demo.jar file as u said.
and now where should i place my JSP ?
first i will tell u my folder structure
<jboss-home>/server/default/deploy/index.war
index.war has the following
firstEJB.jsp
Web-inf/web.xml
Web-inf/jboss-web.xml
Web-inf/lib/First.jar
First.jar file has my home , remote , bean classes.
and ejb-jar.xml and jboss.xml files
web.xml has the <welcome-file-list>
jboss-web.xml has the <context-root>/</context-root>
plz tell me where i have messed up my code.
i have created the Demo.jar file now as u said.
so plz tell me where should i place my jsp file.
thanx
lakshmi
Since your application is having the jsp and ejb hence the deployment should be done as per the J2EE specification, where you have
1)web-module
2)ejb-module
3)appliction-client module
4)JCA(It is included in J2EE1.3+)
Now follow the following steps:
1)Demo.ear folder
2)Create META-INF/application.xml
3)Put your Demo.war and Demo.jar in Demo.ear
4)Demo.jar and Demo.war should be as expalined earlier.Also no need to place the ejb related classes in the WEB-INF/lib of Demo.war.
5)Write the following contents in the applicaiton.xml
<?xml version="1.0"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd">
<application>
<display-name>Project</display-name>
<module>
<ejb>
Demo.jar
</ejb>
</module>
<module>
<web>
<web-uri>Demo.war</web-uri>
<context-root>/demo</context-root>
</web>
</module>
</application>
6)You can create the compressed form of ear or keep it exploded in the Jboss/server/default/Demo.ear
7)Note the console for the results of deplotment
8)call http://localhost:8080/demo/yourjsp.jsp
Hope now I have explained in the detail and it should work now.
Regards
Vicky -
EJB Reference Not In IntitialContext
I have a jsp which accesses a stateless session bean which in turn accesses an entity bean.
The reference to the session bean is in the initial context but the entity bean reference is not (I have printed out the entire initial context to verify this).
When I deploy the application it does say that it is binding both the session bean and the entity bean.
(ie. binding "java:comp/env/ejb/<Name>" for both)
Any ideas as to why the ejb reference doesn't exist in the initial context?
FYI: I am using the J2EE app server and the deploy tool. I have checked the xmls and there is an ejb-ref in it for the entity bean.You should say wheter the entity bean is referenced by the session bean, that is, in the deploytool:
1) select the session bean.
2) select the EJB Refs tab.
3) enter "ejb/YourEntityBean", "Entity" and the interfaces used. "ejb/YourEntityBean" should be as appears in your session bean code.
4) select the EJB jar. (the beans owner)
5) in the JNDI tab you will see this new entry in "References", here you put the JNDI name of your bean as appears bellow in "EJBs" -
I deplyed a simple EJB on S17AS. The server.log tells me it is deployed successful.
CORE3282: stdout: ejbCreate() on obj samples.jdbc.simple.ejb.GreeterDBBean@1017ca1
CORE3282: stdout: ejbCreate() on obj samples.jdbc.simple.ejb.GreeterDBBean@9d5793
LDR5010: All ejb(s) of [simpleEjb] loaded successfully!
The relevant simpleEjb.jar_verified.txt is as follows
Test Name : tests.ejb.ias.ASEjbJndiName
Test Assertion :
Test Description : PASSED [AS-EJB ejb] : jndi-name is simpleHome
However, the server log did not indicate the EJB is bound even if I set the log level to finest.
Therefore when I tried to access it, I get the following error
Exception in thread "main" javax.naming.NameNotFoundException: No object bound f
or java:comp/env/ejb/simpleHome
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.j
ava:116)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at HelloClient.main(HelloClient.java:61)
The client code is as follows
String JNDIName = "java:comp/env/ejb/simpleHome";
myGreeterDBHome = (GreeterDBHome) javax.rmi.PortableRemoteObject.narrow(
initContext.lookup(JNDIName), GreeterDBHome.class);
The sun-ejb-jar.xml is as follows
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2002 Sun Microsystems, Inc. All rights reserved.
-->
<!DOCTYPE sun-ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 EJB 2.0//EN' 'http://www.sun.com/software/sunone/appserver/dtds/sun-ejb-jar_2_0-0.dtd'>
<sun-ejb-jar>
<enterprise-beans>
<name>simpleEjb.jar</name>
<ejb>
<ejb-name>simpleEJB</ejb-name>
<jndi-name>simpleHome</jndi-name>
<is-read-only-bean>false</is-read-only-bean>
<bean-pool>
<steady-pool-size>2</steady-pool-size>
<resize-quantity>5</resize-quantity>
<max-pool-size>20</max-pool-size>
<pool-idle-timeout-in-seconds>3600</pool-idle-timeout-in-seconds>
</bean-pool>
</ejb>
</enterprise-beans>
</sun-ejb-jar>
I tried to use lookup for both "java:comp/env/ejb/simpleHome" and "java:comp/env/simpleHome". None succeed.
Does anyone know why the ejb is deployed successful but not bound?
ShaHi, Parsuram,
I did restart the server and the error is the same.
Here is the sample code. I did not change them. Only the names in deployment descriptors are modified.
Below is the info.
*************************Remote Interface
Copyright � 2002 Sun Microsystems, Inc. All rights reserved.
package samples.jdbc.simple.ejb;
* Remote interface for the GreeterDBEJB. The remote interface defines all possible
* business methods for the bean. These are the methods going to be invoked remotely
* by the servlets, once they have a reference to the remote interface.
* Servlets generally take the help of JNDI to lookup the bean's home interface and
* then use the home interface to obtain references to the bean's remote interface.
public interface GreeterDB extends javax.ejb.EJBObject {
* Returns the greeting String such as "Good morning, John"
* @return the greeting String
public String getGreeting() throws java.rmi.RemoteException;
*************************Home Interface
Copyright � 2002 Sun Microsystems, Inc. All rights reserved.
package samples.jdbc.simple.ejb;
* Home interface for the GreeterDB EJB. Clients generally use home interface
* to obtain references to the bean's remote interface.
public interface GreeterDBHome extends javax.ejb.EJBHome {
* Gets a reference to the remote interface to the GreeterDBBean.
* @exception throws CreateException and RemoteException.
public GreeterDB create() throws java.rmi.RemoteException, javax.ejb.CreateException;
*************************Bean Class
Copyright � 2002 Sun Microsystems, Inc. All rights reserved.
package samples.jdbc.simple.ejb;
import java.util.*;
import java.io.*;
* A simple stateless session bean which generates the greeting string for jdbc-simple
* application. This bean implements the business method as declared by the remote interface.
public class GreeterDBBean implements javax.ejb.SessionBean {
private javax.ejb.SessionContext m_ctx = null;
* Sets the session context. Required by EJB spec.
* @param ctx A SessionContext object.
public void setSessionContext(javax.ejb.SessionContext ctx) {
m_ctx = ctx;
* Creates a bean. Required by EJB spec.
public void ejbCreate() {
System.out.println("ejbCreate() on obj " + this);
* Removes a bean. Required by EJB spec.
public void ejbRemove() {
System.out.println("ejbRemove() on obj " + this);
* Loads the state of the bean from secondary storage. Required by EJB spec.
public void ejbActivate() {
System.out.println("ejbActivate() on obj " + this);
* Keeps the state of the bean to secondary storage. Required by EJB spec.
public void ejbPassivate() {
System.out.println("ejbPassivate() on obj " + this);
* Required by EJB spec.
public void GreeterDBBean() {
* Returns the Greeting String based on the time
* @return the Greeting String.
public String getGreeting() throws java.rmi.RemoteException {
System.out.println("GreeterDB EJB is determining message...");
String message = null;
Calendar calendar = new GregorianCalendar();
int currentHour = calendar.get(Calendar.HOUR_OF_DAY);
if(currentHour < 12) message = "morning";
else {
if( (currentHour >= 12) &&
(calendar.get(Calendar.HOUR_OF_DAY) < 18)) message = "afternoon";
else message = "evening";
System.out.println("- Message determined successfully");
return message;
************************ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2002 Sun Microsystems, Inc. All rights reserved.
-->
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<enterprise-beans>
<session>
<display-name>simple</display-name>
<ejb-name>simpleEJB</ejb-name>
<home>samples.jdbc.simple.ejb.GreeterDBHome</home>
<remote>samples.jdbc.simple.ejb.GreeterDB</remote>
<ejb-class>samples.jdbc.simple.ejb.GreeterDBBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
************************sun-ejb-jar.xml
<sun-ejb-jar>
<enterprise-beans>
<name>simpleEjb.jar</name>
<ejb>
<ejb-name>simpleEJB</ejb-name>
<jndi-name>ejb/simpleHome</jndi-name>
<is-read-only-bean>false</is-read-only-bean>
<bean-pool>
<steady-pool-size>2</steady-pool-size>
<resize-quantity>5</resize-quantity>
<max-pool-size>20</max-pool-size>
<pool-idle-timeout-in-seconds>3600</pool-idle-timeout-in-seconds>
</bean-pool>
</ejb>
</enterprise-beans>
</sun-ejb-jar>
************************Assemble Info
C:\Sun\AppServer7\samples\jdbc\simple\assemble\jar>jar cvf simpleEjb.jar *
added manifest
ignoring entry META-INF/
adding: META-INF/ejb-jar.xml(in = 710) (out= 350)(deflated 50%)
adding: META-INF/sun-ejb-jar.xml(in = 803) (out= 424)(deflated 47%)
adding: samples/(in = 0) (out= 0)(stored 0%)
adding: samples/jdbc/(in = 0) (out= 0)(stored 0%)
adding: samples/jdbc/simple/(in = 0) (out= 0)(stored 0%)
adding: samples/jdbc/simple/ejb/(in = 0) (out= 0)(stored 0%)
adding: samples/jdbc/simple/ejb/GreeterDB.class(in = 210) (out= 168)(deflated 20%)
adding: samples/jdbc/simple/ejb/GreeterDBBean.class(in = 1441) (out= 734)(deflated 49%)
adding: samples/jdbc/simple/ejb/GreeterDBHome.class(in = 257) (out= 177)(deflated 31%)
C:\Sun\AppServer7\samples\jdbc\simple\assemble\jar>jar tf simpleEJB.jar
META-INF/
META-INF/MANIFEST.MF
META-INF/ejb-jar.xml
META-INF/sun-ejb-jar.xml
samples/
samples/jdbc/
samples/jdbc/simple/
samples/jdbc/simple/ejb/
samples/jdbc/simple/ejb/GreeterDB.class
samples/jdbc/simple/ejb/GreeterDBBean.class
samples/jdbc/simple/ejb/GreeterDBHome.class
******************************** Deployment Info
server1: Applications: EJB Modules: simpleEjb
EJB Module Name: simpleEjb
Location: C:\Sun\AppServer7\domains\domain1\server1\applications\j2ee-modules\simpleEjb_1
******************************** simplEJB.jar_verified.txt
STATIC VERIFICATION RESULTS
NUMBER OF FAILURES/WARNINGS/ERRORS
# of Failures : 0
# of Warnings : 1
# of Errors : 0
Test Name : tests.ejb.ias.ASEjbJndiName
Test Assertion :
Test Description : PASSED [AS-EJB ejb] : jndi-name is ejb/simpleHome
WARNINGS :
Test Name : tests.ejb.businessmethod.BusinessMethodException
Test Assertion : Enterprise bean business method throws RemoteException test
Test Description : For [ module_simpleEjb#simpleEjb#simpleEJB ]
For EJB Class [ samples.jdbc.simple.ejb.GreeterDBBean ] business method [ getGreeting ]
Error: Compatibility Note: A public business method [ getGreeting ] was found, but EJB 1.0 allowed the business methods to throw the java.rmi.RemoteException to indicate a non-application exception. This practice is deprecated in EJB 1.1 ---an EJB 1.1 compliant enterprise bean should throw the javax.ejb.EJBException or another RuntimeException to indicate non-application exceptions to the Container.
*********************** server log (no binding info)
[05/Jan/2003:17:07:19] FINE ( 1760): [EJBClassPathUtils] EJB Class Path for [simpleEjb] is ...
[C:\Sun\AppServer7\domains\domain1\server1\applications\j2ee-modules\simpleEjb_1, C:\Sun\AppServer7\domains\domain1\server1\generated\ejb\j2ee-modules\simpleEjb]
[05/Jan/2003:17:07:20] FINE ( 1760): Loading StatelessSessionContainer...
[05/Jan/2003:17:07:20] FINE ( 1760): [BaseContainer] Registered EJB [simpleEJB] with MBeanServer under name [ias:instance-name=server1,mclass=stateless-session-bean,name=simpleEJB,root=root,standalone-ejb-module=simpleEjb,type=monitor]
[05/Jan/2003:17:07:20] FINE ( 1760): main: name = "samples.jdbc.simple.ejb._GreeterDBBean_RemoteHomeImpl_Tie", codebase = ""
[05/Jan/2003:17:07:20] FINE ( 1760): main: name = "samples.jdbc.simple.ejb._GreeterDBHome_Stub", codebase = ""
[05/Jan/2003:17:07:20] FINE ( 1760): main: name = "samples.jdbc.simple.ejb._GreeterDBHome_Stub", codebase = ""
[05/Jan/2003:17:07:20] FINE ( 1760): main: name = "samples.jdbc.simple.ejb._GreeterDBBean_EJBObjectImpl_Tie", codebase = ""
[05/Jan/2003:17:07:20] FINE ( 1760): main: name = "samples.jdbc.simple.ejb._GreeterDB_Stub", codebase = ""
[05/Jan/2003:17:07:20] FINE ( 1760): [Pool-ejb/simpleHome]: Added PoolResizeTimerTask...
[05/Jan/2003:17:07:20] FINE ( 1760): Created container with uinque id: 68275827784351744
[05/Jan/2003:17:07:20] FINE ( 1760): Application deployment successful : com.sun.ejb.containers.StatelessSessionContainer@1083717
[05/Jan/2003:17:07:20] INFO ( 1760): LDR5010: All ejb(s) of [simpleEjb] loaded successfully!
[05/Jan/2003:17:07:22] FINE ( 1760): Started 48 request processing threads
[05/Jan/2003:17:07:22] INFO ( 1760): CORE3274: successful server startup
[05/Jan/2003:17:07:22] FINE ( 1760): The server is now ready to process requests
[05/Jan/2003:17:07:22] INFO ( 1760): CORE3282: stdout: ejbCreate() on obj samples.jdbc.simple.ejb.GreeterDBBean@10613aa
[05/Jan/2003:17:07:22] INFO ( 1760): CORE3282: stdout: ejbCreate() on obj samples.jdbc.simple.ejb.GreeterDBBean@1f52460
[05/Jan/2003:17:07:22] INFO ( 1760): CORE5053: Application onReady complete.
*********************** Client class
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;
import java.util.Hashtable;
import javax.ejb.*;
import java.sql.*;
import javax.sql.*;
import samples.jdbc.simple.ejb.*;
public class HelloClient {
public static void main(String[] args) throws Exception {
javax.ejb.Handle beanHandle;
GreeterDBHome myGreeterDBHome;
GreeterDB myGreeterDBRemote;
InitialContext initContext = null;
Hashtable env = new java.util.Hashtable(1);
initContext = getContextInfo();
String JNDIName = "java:comp/env/ejb/simpleHome";
System.out.println("- Looking up: " + JNDIName);
myGreeterDBHome = (GreeterDBHome) javax.rmi.PortableRemoteObject.narrow(initContext.lookup(JNDIName), GreeterDBHome.class);
myGreeterDBRemote = myGreeterDBHome.create();
String theMessage = myGreeterDBRemote.getGreeting();
myGreeterDBRemote.remove();
public static InitialContext getContextInfo() {
InitialContext ctx = null;
String url = "iiop://1st:3700";
String fac = "com.sun.enterprise.naming.SerialInitContextFactory";
try {
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, fac);
props.put(Context.PROVIDER_URL, url);
ctx = new InitialContext(props);
catch (NamingException ne){
System.out.println("We were unable to get a connection to " +
" the application server at " + url);
ne.printStackTrace();
return ctx;
*********************** Running Client from command line
C:\Sun\AppServer7\samples\jdbc\simple\assemble\jar>java HelloClient
- Looking up: java:comp/env/ejb/simpleHome
Exception in thread "main" javax.naming.NameNotFoundException: No object bound for java:comp/env/ejb/simpleHome
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:116)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at HelloClient.main(HelloClient.java:34) -
Hi
I am just a starter on WLPortal.
I have created a barebone Application from scratch. I have synchronized it properly
from EBCC to WLP. But When I am trying to access the home page of my application,
I am getting from stack trace -
<Nov 6, 2002 5:37:59 PM IST> <Error> <PortalAppflow> <Could not lookup PortalManagerHome
in the JNDI tree using EJB reference java:comp/env/ejb/PortalManager.
javax.naming.NameNotFoundException: Unable to resolve comp/env/ejb/PortalManager
Resolved: 'comp/env' Unresolved:'ejb' ; remaining name 'PortalManager'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:802)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:209)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:173)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:181)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:181)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:36)
at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:124)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at com.bea.p13n.util.JndiHelper.lookupNarrow(JndiHelper.java:96)
at com.bea.portal.appflow.PortalAppflowHelper.<clinit>(PortalAppflowHelper.java:64)
at com.bea.portal.appflow.servlets.internal.PortalWebflowServlet.init(PortalWebflowServlet.java:78)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:700)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:643)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:588)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:368)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:215)
at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:112)
at jsp_servlet.__index._jspService(__index.java:92)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:304)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2459)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2039)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
<Nov 6, 2002 5:37:59 PM IST> <Error> <HTTP> <[WebAppServletContext(19695286,FirstWebApp,/FirstWebApp)]
Servlet failed with Exception
java.lang.NullPointerException:
at com.bea.portal.appflow.PortalAppflowHelper.createPortalManager(PortalAppflowHelper.java:82)
at com.bea.portal.appflow.servlets.internal.PortalWebflowServlet.setupPortalRequest(PortalWebflowServlet.java:187)
at com.bea.portal.appflow.servlets.internal.PortalWebflowServlet.doGet(PortalWebflowServlet.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:215)
at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:112)
at jsp_servlet.__index._jspService(__index.java:92)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:304)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2459)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2039)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
When I decompiled the class PortalAppflowHelper, I found a static block in it,
which was as under-
static
debug = Debug.getInstance(com.bea.portal.appflow.PortalAppflowHelper.class);
try
if(debug.ON)
debug.out("Looking up PortalManagerHome using EJB reference java:comp/env/ejb/PortalManager");
portalManagerHome = (PortalManagerHome)JndiHelper.lookupNarrow("java:comp/env/ejb/PortalManager",
com.bea.portal.manager.ejb.PortalManagerHome.class);
if(debug.ON)
debug.out("Successfully retrieved PortalManagerHome " + portalManagerHome);
catch(Exception e)
PortalAppflowLogger.errorFindingPortalManagerHome("java:comp/env/ejb/PortalManager",
e);
I have checked the PortalManager's JNDI name on WLConsole. Its ${APPNAME}.BEA_portal.PortalManager.
Should I change it?
When I tried to change it, I started getting other weird errors.
Thanks
Neeraj HansNeeraj -
The Portal framework code (including PortalAppflowHelper) uses ejb
references to find the PortalManager (and other EJBs) from servlets and
taglibs; that is what is signified by the java:comp/env/... name.
Since you built your webapp from scratch (instead of using the portal
wizard), you will need to make sure the you have the appropriate
<ejb-ref> entries in your web.xml, and the corresponding
<ejb-reference-description> entries in your weblogic.xml. By default,
you will need at least mappings for:
- ejb/PortalManager
- ejb/UserManager
- ejb/GroupManager
- ejb/PipelineExecutor
- ejb/EventService
See either the resulting webapp from using the portal wizard or
BEA_HOME/weblogic700/samples/portal/sampleportalDomain/beaApps/sampleportal/sampleportal/WEB-INF
for example syntax.
Greg
Neeraj Hans wrote:
Hi
I am just a starter on WLPortal.
I have created a barebone Application from scratch. I have
synchronized it properly
from EBCC to WLP. But When I am trying to access the home page of my
application,
I am getting from stack trace -
<Nov 6, 2002 5:37:59 PM IST> <Error> <PortalAppflow> <Could not lookup
PortalManagerHome
in the JNDI tree using EJB reference java:comp/env/ejb/PortalManager.
javax.naming.NameNotFoundException: Unable to resolve
comp/env/ejb/PortalManager
Resolved: 'comp/env' Unresolved:'ejb' ; remaining name 'PortalManager'
at <stack trace lines snipped>
When I decompiled the class PortalAppflowHelper, I found a static
block in it,
which was as under-
static
debug =
Debug.getInstance(com.bea.portal.appflow.PortalAppflowHelper.class);
try
if(debug.ON)
debug.out("Looking up PortalManagerHome using EJB
reference java:comp/env/ejb/PortalManager");
portalManagerHome =
(PortalManagerHome)JndiHelper.lookupNarrow("java:comp/env/ejb/PortalManager",
com.bea.portal.manager.ejb.PortalManagerHome.class);
if(debug.ON)
debug.out("Successfully retrieved PortalManagerHome "
+ portalManagerHome);
catch(Exception e)
PortalAppflowLogger.errorFindingPortalManagerHome("java:comp/env/ejb/PortalManager",
e);
I have checked the PortalManager's JNDI name on WLConsole. Its
${APPNAME}.BEA_portal.PortalManager.
Should I change it?
When I tried to change it, I started getting other weird errors.
Thanks
Neeraj Hans -
J2EE JNDI-00009 EJB Reference "ejb/SessionEJBCalled" could not be resolved
When load (run) the following EJB (JDev 10.1.3.1.0 embedded server) loads with no problem:
package project2;
import javax.ejb.Stateless;
@Stateless
public class SessionEJBCalledBean implements SessionEJBCalledLocal {
public SessionEJBCalledBean() { }
public void display() { System.out.println("In called - Project2"); }
When load the following, only difference is name attribute for the @Stateless annotation:
package project2;
import javax.ejb.Stateless;
@Stateless(name="SessionEJBCalled")
public class SessionEJBCalledBean implements SessionEJBCalledLocal {
public SessionEJBCalledBean() { }
public void display() { System.out.println("In called - Project2"); }
Get the following error message - Why?
2006-08-24 15:48:54.640 WARNING J2EE JNDI-00009 EJB Reference "ejb/SessionEJBCalled" could not be resolved. Allowing J2EEContext creation to continue anyway
Finally - If I specify the name as per the following all is well:
package project2;
import javax.ejb.Stateless;
@Stateless(name="SessionEJBCalledBean")
public class SessionEJBCalledBean implements SessionEJBCalledLocal {
public SessionEJBCalledBean() { }
public void display() { System.out.println("In called - Project2"); }
Would be appreciated if someone could tell me what is going on?
Thanks - KenWhen load (run) the following EJB (JDev 10.1.3.1.0 embedded server) loads with no problem:
package project2;
import javax.ejb.Stateless;
@Stateless
public class SessionEJBCalledBean implements SessionEJBCalledLocal {
public SessionEJBCalledBean() { }
public void display() { System.out.println("In called - Project2"); }
When load the following, only difference is name attribute for the @Stateless annotation:
package project2;
import javax.ejb.Stateless;
@Stateless(name="SessionEJBCalled")
public class SessionEJBCalledBean implements SessionEJBCalledLocal {
public SessionEJBCalledBean() { }
public void display() { System.out.println("In called - Project2"); }
Get the following error message - Why?
2006-08-24 15:48:54.640 WARNING J2EE JNDI-00009 EJB Reference "ejb/SessionEJBCalled" could not be resolved. Allowing J2EEContext creation to continue anyway
Finally - If I specify the name as per the following all is well:
package project2;
import javax.ejb.Stateless;
@Stateless(name="SessionEJBCalledBean")
public class SessionEJBCalledBean implements SessionEJBCalledLocal {
public SessionEJBCalledBean() { }
public void display() { System.out.println("In called - Project2"); }
Would be appreciated if someone could tell me what is going on?
Thanks - Ken -
Hi All,
Any body can help me to Run my first EJB. I am getting Name not bound error. I thing it is JNDI error. I generate the classes and interfaces using Xdoclet.
I am using eclipse3.1, jboss4
Please see the entry in ejb-jar.xml
<entity >
<description><![CDATA[Description for Simple]]></description>
<display-name>Name for Simple</display-name>
<ejb-name>Simple</ejb-name>
<local-home>com.interfaces.SimpleLocalHome</local-home>
<local>com.interfaces.SimpleLocal</local>
<ejb-class>com.ejb.SimpleCMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Simple</abstract-schema-name>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>id</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>name</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
</entity>
Please see the entry in jboss.xml file
<entity>
<ejb-name>Simple</ejb-name>
<local-jndi-name>ejb/SimpleLocal</local-jndi-name>
<method-attributes>
</method-attributes>
</entity>
When i do lookup with "ejb/SimpleLocal" name then It gives me Not Bound error.
Please help me to solve this problem.
Thanks in advance
Message was edited by:
raviadhahi
Here is my client
HelloClient
import javax.naming.*;
import javax.ejb.*;
import javax.rmi.*;
public class HelloClient
public static void main(String [] args)
try{
InitialContext ctx=new InitialContext();
Object obj=ctx.lookup("HelloEJB");
HelloHome home=(HelloHome)PortableRemoteObject.narrow(obj, HelloHome.class);
Integer id=new Integer(Integer.parseInt(args[0]));
Hello h=home.create(id,args[1]);
}catch(Exception e)
System.out.println(e);
ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>HelloEJB</ejb-name>
<local-home>HelloHome</local-home>
<local>Hello</local>
<ejb-class>HelloBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<abstract-schema-name>HelloAA</abstract-schema-name>
<cmp-field>
<field-name>helloId</field-name>
</cmp-field>
<cmp-field>
<field-name>helloName</field-name>
</cmp-field>
<primkey-field>helloId</primkey-field>
</entity>
</enterprise-beans>
</ejb-jar> -
Hello
Recently i faced an Exception when i run the client that "EJB not Bound exception". It only comes on Entity bean when i run any session bean i run porperly i don't know whats happen with Entity bean plz guide me on that i m using Jboss server.
And when i define relation b/w local ejbs how can i define forigen key?
Best Regards
Uzairhi
Here is my client
HelloClient
import javax.naming.*;
import javax.ejb.*;
import javax.rmi.*;
public class HelloClient
public static void main(String [] args)
try{
InitialContext ctx=new InitialContext();
Object obj=ctx.lookup("HelloEJB");
HelloHome home=(HelloHome)PortableRemoteObject.narrow(obj, HelloHome.class);
Integer id=new Integer(Integer.parseInt(args[0]));
Hello h=home.create(id,args[1]);
}catch(Exception e)
System.out.println(e);
ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>HelloEJB</ejb-name>
<local-home>HelloHome</local-home>
<local>Hello</local>
<ejb-class>HelloBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<abstract-schema-name>HelloAA</abstract-schema-name>
<cmp-field>
<field-name>helloId</field-name>
</cmp-field>
<cmp-field>
<field-name>helloName</field-name>
</cmp-field>
<primkey-field>helloId</primkey-field>
</entity>
</enterprise-beans>
</ejb-jar> -
EJB Reference could not be resolved (javax.naming.NameNotFoundException)
I am new to EJBs and am trying to get a simple Java client to run which I've generated from a EJB3.0 session bean.
The code for the client (LoanAppFacadeClient.java) is
package buslogic;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class LoanAppFacadeClient {
public static void main(String [] args) {
try {
final Context context = getInitialContext();
LoanAppFacade loanAppFacade = (LoanAppFacade)context.lookup("java:comp/env/ejb/LoanAppFacade");
// Call any of the Remote methods below to access the EJB
// System.out.println( loanAppFacade.getLoans( ) );
loanAppFacade.addLoan( "Galactic Loans", 30, "fixed", 6.25 );
String ssn = "123-12-1234";
System.out.println(loanAppFacade.getCreditRating( ssn ));
} catch (Exception ex) {
ex.printStackTrace();
private static Context getInitialContext() throws NamingException {
Hashtable env = new Hashtable();
// Standalone OC4J connection details
env.put( Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.naming.ApplicationClientInitialContextFactory" );
env.put( Context.SECURITY_PRINCIPAL, "oc4jadmin" );
env.put( Context.SECURITY_CREDENTIALS, "welcome1" );
env.put(Context.PROVIDER_URL, "ormi://localhost:23791/LoanApp");
return new InitialContext( env );
When the trying to run the client I get a warning:
"WARNING: EJB Reference "ejb/LoanAppFacade" could not be resolved."
followed by the error
"javax.naming.NameNotFoundException: java:comp/env/ejb/LoanAppFacade not found in Lab1_BusinessServices-app-client"
When the client was created I right-clicked on the session bean (LoanAppFacadeBean which implements LoanAppFacade) and chose New Sample Java Client.
This automatically creates the java client and also created the following xml file (application-client.xml)
<?xml version = '1.0' encoding = 'windows-1252'?>
<application-client xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee">
<display-name>Lab1_BusinessServices-app-client</display-name>
<ejb-ref>
<ejb-ref-name>ejb/LoanAppFacade</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<remote>buslogic.LoanAppFacade</remote>
<ejb-link>LoanAppFacade</ejb-link>
</ejb-ref>
</application-client>
Could someone please help me to fix these errors?
Thanks,
AndrewI used windows for years whereby I stored all photos in folders. As macs don't use this concept I am finding it hard to organize my photos.
You can do this on your Mac too. Just don't use iPhoto. But iPhoto is a lot more flexible.
For instance:
I usually sort them by month so when I say move to an album I mean I create an album called for example '2013 March' so I can easily find specific photos/videos.
Click on the Magnifying Glass lower left to reveal the search box. Then click on the magnifying glass in the search box, and select Date. Now you can instantly find all the photos from a particular month, or day.
File -> New Smart Album will allow you to create an automatic album for any date or date range you choose.
Select one of the affected videos in the iPhoto Window and go File -> Reveal in Finder -> Original. A Finder Window should open with the file selected. Does it play? -
Javax.naming.NameNotFoundException: jdbc not bound
Hi !
I've a application deployed with JBoss 4.0.2 Solaris 2.8, I've create a Oracle DS, when I try to read data from a database throw DS works fine, but when I try to insert, delete or update records from database the jboss show the next error.
2005-09-07 09:17:55,662 ERROR [org.jboss.ejb.plugins.LogInterceptor] Transaction
RolledbackLocalException in method: public abstract int com.soluzionasf.arqw10.g
c.cmp.OracleSequenceSessionLocal.getNextSequenceNumber(java.lang.String) throws
javax.ejb.FinderException, causedBy:
javax.naming.NameNotFoundException: jdbc not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
at org.jnp.server.NamingServer.lookup(NamingServer.java:249)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.soluzionasf.arqw10.gc.cmp.OracleSequenceSessionBean.getConnection
(OracleSequenceSessionBean.java:76)
at com.soluzionasf.arqw10.gc.cmp.OracleSequenceSessionBean.getNextSequen
ceNumber(OracleSequenceSessionBean.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(S
tatelessSessionContainer.java:214)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
ke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Stat
elessSessionInstanceInterceptor.java:130)
at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(Service
EndpointInterceptor.java:51)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidation
Interceptor.java:48)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
rceptor.java:105)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
torCMT.java:335)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:1
66)
This is my DS definition
<?xml version="1.0" encoding="UTF-8"?>
<local-tx-datasource>
<jndi-name>jdbc/OracleDS</jndi-name>
<connection-url>jdbc:oracle:thin:@10.98.10.42:1532:orcl28</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>evo_adminis</user-name>
evo_adminis1
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<type-mapping>Oracle9i</type-mapping>
</local-tx-datasource>
Who knows the solutions for my problem
Thanks for advanceCould be that your EJB is connected to a wrong datasource called only "jdbc"?
Strangely you say that while reading data all works fine (so the datasource definition is ok) but only when writing data there is a NamingException.
The stacktrace seems to report an error while getting datasource reference inside com.soluzionasf.arqw10.gc.cmp.OracleSequenceSessionLocal.getNextSequenceNumber method, the problems seems to be a bad name resource name ("jdbc" instead of java:jdbc/OracleDS or java:comp/env/jdbc/OracleDS if you use resource reference in your web.xml file). If you created this class as a CMP perhaps you misstype the right datasource name, otherwise if you code this method by yourseft you misstype the naming reference. -
Error:CalculatorBeanRemote not bound
Hi Good People,
I am developing a sample EJB3 application in eclipse3.4. I am following the following steps:
1) First of all i am creating an EJB project (testEJB) in the eclipse. While creating this Project i am selecting the options of 1) Create an EJB Client Jar Module (testEJBClient) to hold the client interfaces and classes and 2) Add Project to an EAR (testEJBEAR) for this project. So it will create three different projects with the given names in the eclipse.
2) Now in the project testEJB i will create a stateless session bean. Its corresponding remote interface will be automatically created in the testEJBClient. Now i will declare a simple method hello() in the remote interface and will implement it in the testEJB.
So this completes my ejb beans.
3) Now in the third step i am creating a dynamic web project (with jboss as server). In this project's properties, in the java EE Module Dependencies section i am giving reference to both the testEJB.jar and testEJBClient.jar so that i can access the method in my jsp or servlets. My index.jsp is looks like:
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.*, javax.naming.*,java.util.Properties"%>
<%
Properties p = new Properties();
p.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
p.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
p.put("java.naming.provider.url", "localhost");
Context ctx = new InitialContext(p);
calculator = (CalculatorBeanRemote)ctx.lookup(CalculatorBeanRemote.class.getName());
System.out.println("Loaded Calculator Bean");
} catch (Exception ex) {
System.out.println("Error:"+
ex.getMessage());
%>But when i am trying to run this file it is giving the following exception :
Error:com.CalculatorBeanRemote not bound
I am trying to solve this from last 3 days but still not successful. If any one has any idea please help me.
I am also attaching the log file of jboss server.
Regards,
KhushwinderI think your EJB's are not bound.
You can find this message when deploying the ejb server jar in the jboss app server.
And also check your web-inf/lib path for any jar files.
1.if your web-inf/lib contains the testEJBClient.jar(client jar) then remove it from there and place it in
jbosshome/server/default/lib
2.Place your testEJB.jar (server jar) in the deploy folder of jboss.similary your web app war file also place in the same location
by verifying the step1.
Don't use eclipse deployment. Manually place these jar files in the jboss and run the jboss in command prompt.
If you found in exception like binding then check your deployment packaging once again.
If you have any problem then ask me.
I hope it will solve your problem.
Regards
Venki -
Ejb-link not working when i access ejb in different ear
Hi All
I am here trying to access ejb's which is in different ear, I am providing ejb-link inside web.xml of war file deployed inside deffirent ear file.
I am using wls8.1sp5. I tried different combination with elb-link name , but its not working . <ejb-ref>
<ejb-ref-name>ejb/AuditService</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.onstar.audit.ejb.AuditServiceHome</home>
<remote>com.onstar.audit.ejb.AuditService</remote>
<ejb-link>ccarenewal.jar#AuditService</ejb-link>
</ejb-ref>
<ejb-ref>
<ejb-ref-name>ejb/AccountService</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.onstar.account.ejb.AccountServiceHome</home>
<remote>com.onstar.account.ejb.AccountService</remote>
<ejb-link>ccarenewal.jar#AccountService</ejb-link>
</ejb-ref>
Exception:weblogic.management.ApplicationException: activate failed for sbwo Module: sbwo Error: weblogic.management.DeploymentException: Could not setup environment - with nested exception: [weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'ccarenewal.jar#AuditService' declared in the ejb-ref or ejb-local-ref 'ejb/AuditService' in the application module 'accountadj.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.] weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'ccarenewal.jar#AuditService' declared in the ejb-ref or ejb-local-ref 'ejb/AuditService' in the application module 'accountadj.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct. at weblogic.deployment.EnvironmentBuilder.addEJBLinkRef(EnvironmentBuilder.java:658) at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:467) at weblogic.servlet.internal.CompEnv.init(CompEnv.java:123) at weblogic.servlet.internal.WebAppServletContext.activate
I will appreciate any help.
RajivRob,
Thanks for your reply.
Below is all deployment descriptor entries i have(ejb-jar.xml, weblogic-ejb-jar.xml, web.xml, weblogic.xml)
please correct me if i have wrong entries any where.
ejb-jar.xml
ejb-ref>
<description />
<ejb-ref-name>ejb/AccountService</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.onstar.account.ejb.AccountServiceHome</home>
<remote>com.onstar.account.ejb.AccountService</remote>
<ejb-link>AccountService</ejb-link>
</ejb-ref>
weblogic-ejb-jar.xml
<ejb-reference-description>
<ejb-ref-name>ejb/AccountService</ejb-ref-name>
<jndi-name>cca/AccountService</jndi-name>
</ejb-reference-description>
web.xml
<ejb-ref>
<ejb-ref-name>ejb/AccountService</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.onstar.account.ejb.AccountServiceHome</home>
<remote>com.onstar.account.ejb.AccountService</remote>
<ejb-link>ccarenewal.jar#AccountService</ejb-link>
</ejb-ref>
weblogic.xml
<ejb-reference-description>
<ejb-ref-name>ejb/AccountService</ejb-ref-name>
<jndi-name>cca/AccountService</jndi-name>
</ejb-reference-description>
I appreciate your help.
Thanks
Rajiv -
Access via 'NULL' object reference not possible Error in WD application execution
Experts,
I am getting following error for web dynpro application intermittently, please find following error log:
What happened?
Error in the ABAP Application Program
The current ABAP program "CL_SALV_WD_C_TABLE_V_TABLE====CP" had to be
terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was not
caught in
procedure "IF_SALV_WD_COMP_TABLE_DATA_MAP~MAP_TO_RESULT_CHANGES" "(METHOD)",
nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
You attempted to use a 'NULL' object reference (points to 'nothing')
access a component.
An object reference must point to an object (an instance of a class)
before it can be used to access components.
Either the reference was never set or it was set to 'NULL' using the
CLEAR statement.
Information on where terminated
Termination occurred in the ABAP program "CL_SALV_WD_C_TABLE_V_TABLE====CP" -
in "IF_SALV_WD_COMP_TABLE_DATA_MAP~MAP_TO_RESULT_CHANGES".
The main program was "SAPMHTTP ".
In the source code you have the termination point in line 168
of the (Include) program "CL_SALV_WD_C_TABLE_V_TABLE====CM080".
The termination is caused because exception "CX_SY_REF_IS_INITIAL" occurred in
procedure "IF_SALV_WD_COMP_TABLE_DATA_MAP~MAP_TO_RESULT_CHANGES" "(METHOD)",
but it was neither handled locally nor declared
in the RAISING clause of its signature.
The procedure is in program "CL_SALV_WD_C_TABLE_V_TABLE====CP "; its source
code begins in line
1 of the (Include program "CL_SALV_WD_C_TABLE_V_TABLE====CM080 ".
Line SourceCde
138
139 "Set new value to result data
140 if ls_changelist-r_old_value is not bound.
141 "insert new table line
142 lr_component->r_result_data->if_salv_bs_r_data_table_edit~insert_table_line(
143 index = l_result_data_index ).
144 else.
145 "Modify existing table line
146 lr_component->r_result_data->if_salv_bs_r_data_table_edit~set_table_line(
147 index = l_result_data_index
148 data_line = <ls_table> ).
149 endif.
150 else.
151 "A single attribute value has to be updated
152
153 "Get context element from output data node
154 data lr_element type ref to if_wd_context_element.
155
156 "Retrieve the element to update from the data output node
157 if l_mass_edit_row_inserted = abap_true.
158 "The Element only exists virtually due to the mass edit mode.
159 lr_element = lr_node->get_element( l_mass_edit_virtual_index ).
160 l_mass_edit_row_inserted = abap_false.
161 else.
162 "The element already exists in the data output node.
163 lr_element = lr_node->get_element( ls_changelist-index ).
164 endif.
165
166 "Determine if the cell to be updated is set to null (Nullable)
167 data l_is_null type abap_bool.
>>>>> l_is_null = lr_element->is_attribute_null( ls_changelist-attribute ).
169
170 "Update result data with change
171 if <l_value> is assigned.
172 "update ResultData with cell value
173 lr_component->r_result_data->if_salv_bs_r_data_table_edit~set_table_cell(
174 index = l_result_data_index
175 attribute = ls_changelist-attribute
176 data_cell = <l_value>
177 is_null = l_is_null ).
178 else.
179 "Update result data without any updated cell value
180 lr_component->r_result_data->if_salv_bs_r_data_table_edit~set_table_cell(
181 index = l_result_data_index
182 attribute = ls_changelist-attribute
183 is_null = l_is_null ).
184 endif.
Please help us on what could be the reason behind this?
Thanks,
MadanHi Madan,
It seems that, there are user settings saved and the attribute in the layout settings is not available with current changes.
try to delete the user settings if any.
Please find my answer in the below link
Reset user settings in WDA
Hope this helps you.
Regards,
Rama -
Hi I am new to EJB . Now in our project we are using ejb3 and persistance. So tried
a simple program which I found out from net. But when I am trying to run I am getting
bean not bound. And in JBoss console it is showing error like
ObjectName: jboss.jca:service=DataSourceBinding,name=DefaultDS State: NOTYETINSTALLED
These are all my files.
Book.java
package de.laliluna.library;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@Table(name="book")
@SequenceGenerator(name = "book_sequence", sequenceName = "book_id_seq")
public class Book implements Serializable {
private static final long serialVersionUID = 7422574264557894633L;
private Integer id;
private String title;
private String author;
public Book() {
super();
public Book(Integer id, String title, String author) {
super();
this.id = id;
this.title = title;
this.author = author;
@Override
public String toString() {
return "Book: " + getId() + " Title " + getTitle() + " Author "
+ getAuthor();
public String getAuthor() {
return author;
public void setAuthor(String author) {
this.author = author;
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "book_id")
public Integer getId() {
return id;
public void setId(Integer id) {
this.id = id;
public String getTitle() {
return title;
public void setTitle(String title) {
this.title = title;
}BookTestBean.java
package de.laliluna.library;
import java.util.Iterator;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Stateless
public class BookTestBean implements BookTestBeanLocal, BookTestBeanRemote {
@PersistenceContext(name="FirstEjb3Tutorial")
EntityManager em;
public static final String RemoteJNDIName = BookTestBean.class.getSimpleName() + "/remote";
public static final String LocalJNDIName = BookTestBean.class.getSimpleName() + "/local";
public void test() {
Book book = new Book(null, "My first bean book", "Sebastian");
em.persist(book);
Book book2 = new Book(null, "another book", "Paul");
em.persist(book2);
Book book3 = new Book(null, "EJB 3 developer guide, comes soon",
"Sebastian");
em.persist(book3);
System.out.println("list some books");
List someBooks = em.createQuery("from Book b where b.author=:name")
.setParameter("name", "Sebastian").getResultList();
for (Iterator iter = someBooks.iterator(); iter.hasNext();)
Book element = (Book) iter.next();
System.out.println(element);
System.out.println("List all books");
List allBooks = em.createQuery("from Book").getResultList();
for (Iterator iter = allBooks.iterator(); iter.hasNext();)
Book element = (Book) iter.next();
System.out.println(element);
System.out.println("delete a book");
em.remove(book2);
System.out.println("List all books");
allBooks = em.createQuery("from Book").getResultList();
for (Iterator iter = allBooks.iterator(); iter.hasNext();)
Book element = (Book) iter.next();
System.out.println(element);
}BookTestBeanLocal.java
package de.laliluna.library;
import javax.ejb.Local;
@Local
public interface BookTestBeanLocal {
public void test();
}BookTestBeanRemote.java
package de.laliluna.library;
import javax.ejb.Remote;
@Remote
public interface BookTestBeanRemote {
public void test();
}client part--> FirstEJB3TutorialClient.java
package de.laliluna.library;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import de.laliluna.library.BookTestBean;
import de.laliluna.library.BookTestBeanRemote;
* @author hennebrueder
public class FirstEJB3TutorialClient {
* @param args
public static void main(String[] args) {
* get a initial context. By default the settings in the file
* jndi.properties are used. You can explicitly set up properties
* instead of using the file.
Properties properties = new Properties();
properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.factory.url.pkgs","=org.jboss.naming:org.jnp.interfaces");
properties.put("java.naming.provider.url","localhost:1099");
Context context;
try {
context = new InitialContext(properties);
BookTestBeanRemote beanRemote = (BookTestBeanRemote) context
.lookup(BookTestBean.RemoteJNDIName);
beanRemote.test();
} catch (NamingException e) {
e.printStackTrace();
* I rethrow it as runtimeexception as there is really no need to
* continue if an exception happens and I do not want to catch it
* everywhere.
throw new RuntimeException(e);
}I have created persistance.xml and application.xml under META-INF folder.
persistance.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence>
<persistence-unit name="FirstEjb3Tutorial">
<jta-data-source>hsqldb-db</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto"
value="create-drop"/>
</properties>
</persistence-unit>
</persistence>application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
<display-name>Stateless Session Bean Example</display-name>
<module>
<ejb>FirstEjb3Tutorial.jar</ejb>
</module>
</application>and in hsqldb-ds i have configured the driver and connection
<datasources>
<local-tx-datasource>
<!-- The jndi name of the DataSource, it is prefixed with java:/ -->
<!-- Datasources are not available outside the virtual machine -->
<jndi-name>ejb3ProjectDS</jndi-name>
<!-- For server mode db, allowing other processes to use hsqldb over tcp.
This requires the org.jboss.jdbc.HypersonicDatabase mbean.
<connection-url>jdbc:hsqldb:hsql://${jboss.bind.address}:1701</connection-url>
-->
<!-- For totally in-memory db, not saved when jboss stops.
The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
<connection-url>jdbc:hsqldb:.</connection-url>
-->
<!-- For in-process persistent db, saved when jboss stops.
The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
-->
<!-- <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url-->
<connection-url>jdbc:hsqldb:data/tutorial</connection-url>
<!-- The driver class -->
<driver-class>org.hsqldb.jdbcDriver</driver-class>
<!-- The login and password -->
<user-name>sa</user-name>
<password></password>
<!--example of how to specify class that determines if exception means connection should be destroyed-->
<!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name-->
<!-- this will be run before a managed connection is removed from the pool for use by a client-->
<!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> -->
<!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
<min-pool-size>5</min-pool-size>
<!-- The maximum connections in a pool/sub-pool -->
<max-pool-size>20</max-pool-size>
<!-- The time before an unused connection is destroyed -->
<!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
<!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
<idle-timeout-minutes>0</idle-timeout-minutes>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->
<!-- sql to call on an existing pooled connection when it is obtained from pool
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->
<!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name>
-->
<!-- Whether to check all statements are closed when the connection is returned to the pool,
this is a debugging feature that should be turned off in production -->
<track-statements/>
<!-- Use the getConnection(user, pw) for logins
<application-managed-security/>
-->
<!-- Use the security domain defined in conf/login-config.xml -->
<security-domain>HsqlDbRealm</security-domain>
<!-- Use the security domain defined in conf/login-config.xml or the
getConnection(user, pw) for logins. The security domain takes precedence.
<security-domain-and-application>HsqlDbRealm</security-domain-and-application>
-->
<!-- HSQL DB benefits from prepared statement caching -->
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>Hypersonic SQL</type-mapping>
</metadata>
<!-- When using in-process (standalone) mode -->
<depends>jboss:service=Hypersonic,database=localDB</depends>
<!-- Uncomment when using hsqldb in server mode
<depends>jboss:service=Hypersonic</depends>
-->
</local-tx-datasource>
<!-- Uncomment if you want hsqldb accessed over tcp (server mode)
<mbean code="org.jboss.jdbc.HypersonicDatabase"
name="jboss:service=Hypersonic">
<attribute name="Port">1701</attribute>
<attribute name="BindAddress">${jboss.bind.address}</attribute>
<attribute name="Silent">true</attribute>
<attribute name="Database">default</attribute>
<attribute name="Trace">false</attribute>
<attribute name="No_system_exit">true</attribute>
</mbean>
-->
<!-- For hsqldb accessed from jboss only, in-process (standalone) mode -->
<mbean code="org.jboss.jdbc.HypersonicDatabase"
name="jboss:service=Hypersonic,database=localDB">
<attribute name="Database">localDB</attribute>
<attribute name="InProcessMode">true</attribute>
</mbean>
</datasources>.
Edited by: bhanu on Dec 2, 2008 9:45 AMHi jadespirit ,
I have the same problem in the same Book example ,my ejb3 project name "BaseHotele" so i follow what u said and this is my persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence>
<persistence-unit name="FirstEjb3Tutorial">
*<jta-data-source>java:BaseHoteleDS</jta-data-source>*
<properties>
<property name="hibernate.hbm2ddl.auto"
value="create-drop"/>
</properties>
</persistence-unit>
</persistence>
But it didn't work i have always HotelTestBean not bound!!
Help PLEASE i think that i had a mistake in the persistence.xml:i have 2 days searching for solutions without a good result!!!!!!!!!!!!! -
hi all,
when i have an enterprise application with a session bean and a webapp,
i can access the session bean either over an ejb-reference in the webapp or directly access the jndi entry. what is the advantage of using ejb references? here an example of what i mean (both from within a webapp):
ctx.lookup("myBean"); // without ejb ref
ctx.lookup("java:comp/env/ejb/myRef"); // with ejb ref
I get back the same, so whats the difference?
rgdsWith ejb-reference a container optimizes access to collocated beans. For example, say you have a deployment where beans A and B are both replicated in two different containers, for performance and/or availability reasons. For optimal use every instance of A in container would use instances of B also in container one. Likewise for container two. An EJB container can enforce this locality constraint using ejb-links, but not always using direct JNDI names.
Maybe you are looking for
-
acrobat 7 not working wont work since acrobat loaded automatical to my desk top
-
I have a Nikon AW100 and I use a SanDisk for the memory and I download that with My Pictures and Videos but I cant get my videos onto IMovie
-
Can you edit a Coldfusion website using Kompozer
OK so I have never used Coldfusion before but want to amend some text on a website which is Coldfusion based - can I do this using Kompozer or do I need the Coldfusion software itself, or is there another free alternative I can use?
-
Revision: 4074 Author: [email protected] Date: 2008-11-11 14:10:34 -0800 (Tue, 11 Nov 2008) Log Message: FxNumericStepper now has a maxChars property, and it now restricts the characters that can be entered into its FxTextInput. Fixed a problem with
-
Deploy applications thru autodeploy in production mode in Weblogic 10
In Weblogic 10, we can deploy applications though autodeploy in development mode. But now I need to deploy my applications in production mode. Iam very much convenient using autodeploy. Can I use this autodeploy in production mode..?..Any alternative