Help needed - javax.naming.NameNotFoundException:
Hi,
I am writing a stateless local session bean that is invoked within an EJB,
it deploys fine,
console
16:52:58,719 INFO [EjbModule] Deploying LocalRuleEngine
but when I run it I get NameNotFoundException,
javax.naming.NameNotFoundException: LocalRuleEngine 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:278)
at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
this is mapping files,
jboss.xml,
<?xml version="1.0"?>
<jboss>
<enterprise-beans>
<message-driven>
<ejb-name>DistributionManager</ejb-name>
<destination-jndi-name>queue/dr</destination-jndi-name>
<resource-ref>
<res-ref-name>jms/QCF</res-ref-name>
<jndi-name>ConnectionFactory</jndi-name>
</resource-ref>
</message-driven>
<session>
<ejb-name>LocalRuleEngine</ejb-name>
<jndi-name>ejb/LocalRuleEngine</jndi-name>
</session>
</enterprise-beans>
</jboss>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>
<message-driven>
<ejb-name>DistributionManager</ejb-name>
<ejb-class>com.test.DataDistributionManager</ejb-class>
<transaction-type>Container</transaction-type>
<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
<ejb-local-ref>
<ejb-ref-name>ejb/LocalRuleEngine</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.test.LocalRuleEngineHome</local-home>
<local>com.test.LocalRuleEngine</local>
<ejb-link>LocalRuleEngine</ejb-link>
</ejb-local-ref>
<resource-ref>
<res-ref-name>jms/QCF</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</message-driven>
<session>
<ejb-name>LocalRuleEngine</ejb-name>
<local-home>com.test.LocalRuleEngineHome</local-home>
<local>com.test.LocalRuleEngine</local>
<ejb-class>com.test.RuleEngineBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>this is my local home interface
package com.test;
import javax.ejb.CreateException;
import javax.ejb.EJBLocalHome;
public interface LocalRuleEngineHome extends EJBLocalHome{
public LocalRuleEngine create() throws CreateException;
}this is my local interface
package com.test;
import java.util.List;
import javax.ejb.EJBLocalObject;
import com.raytheon.jetts.domain.DomainClass;
import com.raytheon.jetts.domain.DomainKey;
public interface LocalRuleEngine extends EJBLocalObject {
public List findMatchingRules(DomainClass itemToDistribute);
public List createRules(DomainKey domainKey, List<Address> addresses);
public ImAdapter getImAdapter();
public void setImAdapter(ImAdapter imAdapter);
public List getAddressesFromRules(List<DistributionRule> distributionRules);
public void addRule(DistributionRule distributionRule);
public void removeRule(DomainKey domainKey);
public String testReturn();
}this is my bean,
package com.test;
import java.rmi.RemoteException;
import java.util.List;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.EJBLocalHome;
import javax.ejb.EJBLocalObject;
import javax.ejb.RemoveException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.jetts.domain.DomainClass;
import com.raytheon.jetts.domain.DomainKey;
public class RuleEngineBean implements SessionBean, LocalRuleEngine{
private static Log log = LogFactory.getLog(DataDistributionManager.class);
private LocalRuleEngine engine;
private LocalRuleEngineHome localHome;
public RuleEngineBean(){}
public List findMatchingRules(DomainClass itemToDistribute){
List list = null;
return list;
public String testReturn(){
return new String("is home time");
public List createRules(DomainKey domainKey, List<Address> addresses){
List list = null;
return list;
public ImAdapter getImAdapter(){
ImAdapter imAdapter = null;
return imAdapter;
public void setImAdapter(ImAdapter imAdapter){
public List getAddressesFromRules(List<DistributionRule> distributionRules){
List list = null;
return list;
public void addRule(DistributionRule distributionRule){
public void removeRule(DomainKey domainKey){
public void ejbCreate(String info){}
public void setSessionContext(SessionContext context){}
public void remove(){}
public void ejbActivate(){}
public void ejbPassivate(){}
public void ejbRemove(){}
public void ejbCreate(){}
public boolean isIdentical(EJBLocalObject obj)throws EJBException{
return true;
public EJBLocalHome getEJBLocalHome(){
return localHome;
public Object getPrimaryKey()throws EJBException{
return new Object();
}Thanks for any help on this,
Jp.
sorry about that,
I'm doing this,
InitialContext ctx = new InitialContext();
LocalRuleEngineHome localRuleEngineHome = (LocalRuleEngineHome)ctx.lookup("ejb/LocalRuleEngine");
//localRuleEngineHome = (LocalRuleEngineHome)PortableRemoteObject.narrow(objref, LocalRuleEngineHome.class);
LocalRuleEngine lre = localRuleEngineHome.create();
log.info(lre.testReturn());
Similar Messages
-
Javax.naming.NameNotFoundException: Unable to resolve
Dear friends,
I am doing simple application EJB3 with JSF but I got this exception any help please.
javax.naming.NameNotFoundException: Unable to resolve 'SessionEJB'. Resolved ''; remaining name 'SessionEJB'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:252)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:393)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at asu.view.backing.Login.validate(Login.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:698)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:285)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.share.http.ServletADFFilter.doFilter(ServletADFFilter.java:62)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)now I got this error,
even my select is simple
javax.ejb.EJBException: EJB Exception: ; nested exception is:
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Error compiling the query [select o.username , o.password from Authentication o where username=:p_username ], line 1, column 59: unknown identification variable [username]. The FROM clause of the query does not declare an identification variable [username].; nested exception is: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Error compiling the query [select o.username , o.password from Authentication o where username=:p_username ], line 1, column 59: unknown identification variable [username]. The FROM clause of the query does not declare an identification variable [username].
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Error compiling the query [select o.username , o.password from Authentication o where username=:p_username ], line 1, column 59: unknown identification variable [username]. The FROM clause of the query does not declare an identification variable [username].
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:93)
at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:91)
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:80)
at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:26)
at $Proxy144.createQuery(Unknown Source)
at asu.model.SessionEJBBean.validateLogin(SessionEJBBean.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy147.validateLogin(Unknown Source)
at asu.model.SessionEJB_qxt9um_SessionEJBImpl.validateLogin(SessionEJB_qxt9um_SessionEJBImpl.java:316)
at asu.model.SessionEJB_qxt9um_SessionEJBImpl_CBV.validateLogin(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:84)
at $Proxy145.validateLogin(Unknown Source)
at asu.view.backing.Login.validate(Login.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:698)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:285)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.share.http.ServletADFFilter.doFilter(ServletADFFilter.java:62)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: Exception [EclipseLink-8004] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Error compiling the query [select o.username , o.password from Authentication o where username=:p_username ], line 1, column 59: unknown identification variable [username]. The FROM clause of the query does not declare an identification variable [username].
at org.eclipse.persistence.exceptions.JPQLException.aliasResolutionException(JPQLException.java:192)
at org.eclipse.persistence.internal.jpa.parsing.VariableNode.validate(VariableNode.java:166)
at org.eclipse.persistence.internal.jpa.parsing.Node.validate(Node.java:91)
at org.eclipse.persistence.internal.jpa.parsing.BinaryOperatorNode.validate(BinaryOperatorNode.java:34)
at org.eclipse.persistence.internal.jpa.parsing.EqualsNode.validate(EqualsNode.java:41)
at org.eclipse.persistence.internal.jpa.parsing.WhereNode.validate(WhereNode.java:34)
at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:211)
at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:187)
at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:177)
at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateReadQueryInternal(JPQLParseTree.java:110)
at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateQuery(JPQLParseTree.java:84)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:202)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:173)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:125)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:109)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1326)
... 90 more
javax.ejb.EJBException: EJB Exception: ; nested exception is:
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Error compiling the query [select o.username , o.password from Authentication o where username=:p_username ], line 1, column 59: unknown identification variable [username]. The FROM clause of the query does not declare an identification variable [username].; nested exception is: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Error compiling the query [select o.username , o.password from Authentication o where username=:p_username ], line 1, column 59: unknown identification variable [username]. The FROM clause of the query does not declare an identification variable [username].
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.unwrapRemoteException(RemoteBusinessIntfProxy.java:120)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:102)
at $Proxy145.validateLogin(Unknown Source)
at asu.view.backing.Login.validate(Login.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:698)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:285)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.share.http.ServletADFFilter.doFilter(ServletADFFilter.java:62)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Error compiling the query [select o.username , o.password from Authentication o where username=:p_username ], line 1, column 59: unknown identification variable [username]. The FROM clause of the query does not declare an identification variable [username].
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:93)
at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:91)
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:80)
at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:26)
at $Proxy144.createQuery(Unknown Source)
at asu.model.SessionEJBBean.validateLogin(SessionEJBBean.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy147.validateLogin(Unknown Source)
at asu.model.SessionEJB_qxt9um_SessionEJBImpl.validateLogin(SessionEJB_qxt9um_SessionEJBImpl.java:316)
at asu.model.SessionEJB_qxt9um_SessionEJBImpl_CBV.validateLogin(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:84)
... 52 more
Caused by: Exception [EclipseLink-8004] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Error compiling the query [select o.username , o.password from Authentication o where username=:p_username ], line 1, column 59: unknown identification variable [username]. The FROM clause of the query does not declare an identification variable [username].
at org.eclipse.persistence.exceptions.JPQLException.aliasResolutionException(JPQLException.java:192)
at org.eclipse.persistence.internal.jpa.parsing.VariableNode.validate(VariableNode.java:166)
at org.eclipse.persistence.internal.jpa.parsing.Node.validate(Node.java:91)
at org.eclipse.persistence.internal.jpa.parsing.BinaryOperatorNode.validate(BinaryOperatorNode.java:34)
at org.eclipse.persistence.internal.jpa.parsing.EqualsNode.validate(EqualsNode.java:41)
at org.eclipse.persistence.internal.jpa.parsing.WhereNode.validate(WhereNode.java:34)
at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:211)
at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:187)
at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:177)
at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateReadQueryInternal(JPQLParseTree.java:110)
at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateQuery(JPQLParseTree.java:84)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:202)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:173)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:125)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:109)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1326)
... 90 more -
Javax.naming.NameNotFoundException plz guys help
hi am try to create simple ejb prj and i got this exception iam beginner so can u plz help me to knwow hats wrong
this is my entity bean
working on netbean 6 glassfish v2
* To change this template, choose Tools | Templates
* and open the template in the editor.
package doctor;
import java.io.Serializable;
import java.math.BigInteger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.transaction.UserTransaction;
* @author kriem
@Entity
@Table(name = "DOCTOR")
@NamedQueries({@NamedQuery(name = "Doctor.findByDocFname", query = "SELECT d FROM Doctor d WHERE d.docFname = :docFname"), @NamedQuery(name = "Doctor.findByDocId", query = "SELECT d FROM Doctor d WHERE d.docId = :docId"), @NamedQuery(name = "Doctor.findByDocLname", query = "SELECT d FROM Doctor d WHERE d.docLname = :docLname"), @NamedQuery(name = "Doctor.findByDocPhone", query = "SELECT d FROM Doctor d WHERE d.docPhone = :docPhone"), @NamedQuery(name = "Doctor.findByDocAddress", query = "SELECT d FROM Doctor d WHERE d.docAddress = :docAddress"), @NamedQuery(name = "Doctor.findByDocMobileNo", query = "SELECT d FROM Doctor d WHERE d.docMobileNo = :docMobileNo"), @NamedQuery(name = "Doctor.findByDocSpecialty", query = "SELECT d FROM Doctor d WHERE d.docSpecialty = :docSpecialty"), @NamedQuery(name = "Doctor.findByDocTitle", query = "SELECT d FROM Doctor d WHERE d.docTitle = :docTitle")})
public class Doctor implements Serializable {
private static final long serialVersionUID = 1L;
@Column(name = "DOC_FNAME", nullable = false)
private String docFname;
@Id
@Column(name = "DOC_ID", nullable = false)
private String docId;
@Column(name = "DOC_LNAME", nullable = false)
private String docLname;
@Column(name = "DOC_PHONE")
private BigInteger docPhone;
@Column(name = "DOC_ADDRESS", nullable = false)
private String docAddress;
@Column(name = "DOC_MOBILE_NO")
private BigInteger docMobileNo;
@Column(name = "DOC_SPECIALTY", nullable = false)
private String docSpecialty;
@Column(name = "DOC_TITLE", nullable = false)
private String docTitle;
public Doctor() {
public Doctor(String docId) {
this.docId = docId;
public Doctor(String docId, String docFname, String docLname, String docAddress, String docSpecialty, String docTitle) {
this.docId = docId;
this.docFname = docFname;
this.docLname = docLname;
this.docAddress = docAddress;
this.docSpecialty = docSpecialty;
this.docTitle = docTitle;
public String getDocFname() {
return docFname;
public void setDocFname(String docFname) {
this.docFname = docFname;
public String getDocId() {
return docId;
public void setDocId(String docId) {
this.docId = docId;
public String getDocLname() {
return docLname;
public void setDocLname(String docLname) {
this.docLname = docLname;
public BigInteger getDocPhone() {
return docPhone;
public void setDocPhone(BigInteger docPhone) {
this.docPhone = docPhone;
public String getDocAddress() {
return docAddress;
public void setDocAddress(String docAddress) {
this.docAddress = docAddress;
public BigInteger getDocMobileNo() {
return docMobileNo;
public void setDocMobileNo(BigInteger docMobileNo) {
this.docMobileNo = docMobileNo;
public String getDocSpecialty() {
return docSpecialty;
public void setDocSpecialty(String docSpecialty) {
this.docSpecialty = docSpecialty;
public String getDocTitle() {
return docTitle;
public void setDocTitle(String docTitle) {
this.docTitle = docTitle;
@Override
public int hashCode() {
int hash = 0;
hash += (docId != null ? docId.hashCode() : 0);
return hash;
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Doctor)) {
return false;
Doctor other = (Doctor) object;
if ((this.docId == null && other.docId != null) || (this.docId != null && !this.docId.equals(other.docId))) {
return false;
return true;
@Override
public String toString() {
return "doctor.Doctor[docId=" + docId + "]";
public void persist(Object object) {
/* Add this to the deployment descriptor of this module (e.g. web.xml, ejb-jar.xml):
* <persistence-context-ref>
* <persistence-context-ref-name>persistence/LogicalName</persistence-context-ref-name>
* <persistence-unit-name>simple-ejbPU</persistence-unit-name>
* </persistence-context-ref>
* <resource-ref>
* <res-ref-name>UserTransaction</res-ref-name>
* <res-type>javax.transaction.UserTransaction</res-type>
* <res-auth>Container</res-auth>
* </resource-ref> */
try {
Context ctx = new InitialContext();
UserTransaction utx = (UserTransaction) ctx.lookup("java:comp/env/UserTransaction");
utx.begin();
EntityManager em = (EntityManager) ctx.lookup("java:comp/env/persistence/LogicalName");
em.persist(object);
utx.commit();
} catch (Exception e) {
java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE, "exception caught", e);
throw new RuntimeException(e);
}my session bean
* To change this template, choose Tools | Templates
* and open the template in the editor.
package doctor;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
* @author kriem
@Stateless
public class DoctorFacade implements DoctorFacadeRemote {
@PersistenceContext
(unitName="simple-ejbPU")
private EntityManager em;
public void create(Doctor doctor) {
em.persist(doctor);
public void edit(Doctor doctor) {
em.merge(doctor);
public void remove(Doctor doctor) {
em.remove(em.merge(doctor));
public Doctor find(Object id) {
return em.find(doctor.Doctor.class, id);
public List<Doctor> findAll() {
return em.createQuery("select object(o) from Doctor as o").getResultList();
public void persist(Object object) {
em.persist(object);
}myremote interface
* To change this template, choose Tools | Templates
* and open the template in the editor.
package doctor;
import java.util.List;
import javax.ejb.Remote;
* @author kriem
@Remote
public interface DoctorFacadeRemote {
void create(Doctor doctor);
void edit(Doctor doctor);
void remove(Doctor doctor);
Doctor find(Object id);
List<Doctor> findAll();
}and for the clinet side its simple java aplication
* To change this template, choose Tools | Templates
* and open the template in the editor.
package doctor;
import java.util.Properties;
import javax.naming.Context;
import javax.rmi.PortableRemoteObject;
* @author kriem
public class client extends test {
public static void main(String [] args) {
try {
// NewServiceLocator obj=new NewServiceLocator();
test simple=new test();
simple.getDataSource("doctor");
simple.getSession("DoctorFaca");
Context jndiContext = getInitialContext( );
Object ref = jndiContext.lookup("DoctorFacade/remote");
DoctorFacadeRemote dao = (DoctorFacadeRemote)
PortableRemoteObject.narrow(ref,DoctorFacadeRemote.class);
Doctor doc=new Doctor();
doc.setDocFname("test");
doc.setDocAddress("bla bla");
doc.setDocId("D1005");
doc.setDocLname("mohamedd");
// doc.setDocMobileNo(121112223);
doc.setDocTitle("MD");
//doc.getDocPhone(2);
dao.create(doc);
Doctor doc2 = dao.find("D1002");
System.out.println(doc2.getDocSpecialty());
System.out.println(doc2.getDocFname());
System.out.println(doc2.getDocLname());
System.out.println(doc2.getDocAddress());
System.out.println(doc2.getDocMobileNo());
System.out.println(doc2.getDocPhone());
System.out.println(doc2.getDocSpecialty());
System.out.println(doc2.getDocTitle());
catch (javax.naming.NamingException ne)
{ne.printStackTrace( );
public static Context getInitialContext( )
throws javax.naming.NamingException {
Properties p = new Properties( );
// ... Specify the JNDI properties specific to the vendor.
return new javax.naming.InitialContext(p);
}and i got this exception knowing that am using entity bean from existing database that i had created
javax.naming.NameNotFoundException:
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:129)
at sun.reflect.GeneratedMethodAccessor121.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
run-simple-app-client:guys anyhelp am really lost in this
Edited by: marwacs on May 19, 2008 9:32 PMhey guys i made some updates on my sample and i figure out that as long as am creating enterprise application on netbeans 6 that contain both ejb module and client module i don`t need to write mapedName i only put the @ejb in the client side and it creates an instance of the remote interface
here is what i have done in the client code /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
package enterpriseapplication4;
import ejb.Doctor;
import ejb.DoctorFacadeRemote;
import javax.ejb.EJB;
import java.math.BigInteger;
* @author kriem
public class Main {
@EJB
private static DoctorFacadeRemote doctorFacade;
* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
// Object id="D1002";
// Doctor find = doctorFacade.find(id);
// find.toString();
// System.out.println(find.getDocSpecialty());
// System.out.println(find.getDocFname());
// System.out.println(find.getDocLname());
// System.out.println(find.getDocAddress());
// System.out.println(find.getDocMobileNo());
// System.out.println(find.getDocPhone());
// System.out.println(find.getDocSpecialty());
// System.out.println(find.getDocTitle());
Doctor doc=new Doctor();
BigInteger bi = BigInteger.valueOf(123);
BigInteger bh = BigInteger.valueOf(111);
doc.setDocFname("test");
doc.setDocAddress("bla bla");
System.err.print("doc Fname and address");
doc.setDocId("D1005");
doc.setDocLname("mohamedd");
doc.setDocMobileNo(bh);
doc.setDocTitle("MD");
doc.setDocMobileNo (bi);
doctorFacade.create(doc);
System.err.print("doc was added");
}but when i run i found this
May 21, 2008 6:37:08 PM com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNING: ACC003: Application threw an exception.
javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.; nested exception is:
javax.transaction.RollbackException: Transaction marked for rollback.
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.; nested exception is:
javax.transaction.RollbackException: Transaction marked for rollback.
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:243)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:205)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
at ejb.__DoctorFacadeRemote_Remote_DynamicStub.create(ejb/__DoctorFacadeRemote_Remote_DynamicStub.java)
at ejb._DoctorFacadeRemote_Wrapper.create(ejb/_DoctorFacadeRemote_Wrapper.java)
at enterpriseapplication4.Main.main(Main.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:449)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
at com.sun.enterprise.appclient.Main.main(Main.java:200)
Caused by: java.rmi.RemoteException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.; nested exception is:
javax.transaction.RollbackException: Transaction marked for rollback.
at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java:251)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1386)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1316)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:210)
at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:117)
at $Proxy82.create(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
Caused by: javax.transaction.RollbackException: Transaction marked for rollback.
at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:440)
at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:371)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3792)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3571)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1354)
... 19 more
javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.; nested exception is:
javax.transaction.RollbackException: Transaction marked for rollback.
at ejb._DoctorFacadeRemote_Wrapper.create(ejb/_DoctorFacadeRemote_Wrapper.java)
at enterpriseapplication4.Main.main(Main.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:449)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
at com.sun.enterprise.appclient.Main.main(Main.java:200)
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:461)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
at com.sun.enterprise.appclient.Main.main(Main.java:200)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:449)
... 2 more
Caused by: javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.; nested exception is:
javax.transaction.RollbackException: Transaction marked for rollback.
at ejb._DoctorFacadeRemote_Wrapper.create(ejb/_DoctorFacadeRemote_Wrapper.java)
at enterpriseapplication4.Main.main(Main.java:50)
... 8 morethe thing is am connecting my sample with oracle db and i debuged my sample it breaks when i try to create(doc) last line in the client code ,i guess its about connecting with the database,i don`t know i also working on netbean 6
so plaz me guys another question is it possible to create statfule web services and if its plz can u send me examples -
I have followed the tutorial on http://www.oracle.com/technology/obe/obe1013jdev/10131/10131_ejb_30/ejb_30.htm to create my own EJB with Jdeveloper, but I got some errors. Please help.
When I run the client, it gave out the following errors:
javax.naming.NameNotFoundException: buslogic.HRAppFacade not found
at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:52)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at client.HRAppFacadeClient.main(HRAppFacadeClient.java:15)
Process exited with exit code 0.
I have created the entity and facade (with interface), but the client couldn't lookup the facade, giving out the above error. How to solve the problm? Thanks.
The following is my source code:
Employees.java
package buslogic.persistence;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
@Entity
@NamedQueries({
@NamedQuery(name = "Employees.findAll", query = "select o from Employees o"),
@NamedQuery(name = "Employees.findEmployeeById", query = "select o from Employees o where o.empid = :empid")
@Table(name = "\"employees\"")
public class Employees implements Serializable {
@Id
@Column(name="empid")
private int empid;
@Column(name="name")
private String name;
@Column(name="phone")
private int phone;
public Employees() {
public int getEmpid() {
return empid;
public void setEmpid(int empid) {
this.empid = empid;
public String getName() {
return name;
public void setName(String name) {
this.name = name;
public int getPhone() {
return phone;
public void setPhone(int phone) {
this.phone = phone;
(HRAppFacadeBean.java)
package buslogic;
import buslogic.persistence.Employees;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Stateless(name="HRAppFacade")
public class HRAppFacadeBean implements HRAppFacade, HRAppFacadeLocal {
@PersistenceContext(unitName="EJB_Project")
private EntityManager em;
public HRAppFacadeBean() {
public Object mergeEntity(Object entity) {
return em.merge(entity);
public Object persistEntity(Object entity) {
em.persist(entity);
return entity;
/** <code>select o from Employees o</code> */
public List<Employees> queryEmployeesFindAll() {
return em.createNamedQuery("Employees.findAll").getResultList();
/** <code>select o from Employees o where o.empid = :empid</code> */
public Employees queryEmployeesFindEmployeeById(int empid) {
return (Employees)em.createNamedQuery("Employees.findEmployeeById").setParameter("empid", empid).getSingleResult();
public void removeEmployees(Employees employees) {
employees = em.find(Employees.class, employees.getEmpid());
em.remove(employees);
(HRAppFacade.java)
package buslogic;
import buslogic.persistence.Employees;
import java.util.List;
import javax.ejb.Remote;
@Remote
public interface HRAppFacade {
Object mergeEntity(Object entity);
Object persistEntity(Object entity);
List<Employees> queryEmployeesFindAll();
Employees queryEmployeesFindEmployeeById(int empid);
void removeEmployees(Employees employees);
(HRAppFacadeLocal.java)
package buslogic;
import buslogic.persistence.Employees;
import java.util.List;
import javax.ejb.Local;
@Local
public interface HRAppFacadeLocal {
Object mergeEntity(Object entity);
Object persistEntity(Object entity);
List<Employees> queryEmployeesFindAll();
Employees queryEmployeesFindEmployeeById(int empid);
void removeEmployees(Employees employees);
}I hit the exact same error. In my case it was due to missing "@Id" line in Departments.java. I must have accidently deleted it when pasting in some code.
(my clue was the errors I got when starting imbedded OC4J)
This section of Departments.java should read as follows:
public class Departments implements Serializable {
@Id
@GeneratedValue(strategy=SEQUENCE, generator="DEPARTMENTS_SEQ")
@Column(name="DEPARTMENT_ID", nullable = false)
After fixing this, I ran a "make" of "HRApp", restarted the embedded OC4J server (terminate it, then right click HRAppFacadeBean.java, and click Run).
Then ran the application... -
Help: javax.naming.NameNotFoundException
I am new to EJB and learning the examples in J2EE tutorial.
I try to run my client from a different machine with my J2EE application server. The client runs fine in the same machine with the application server. I change the code as below and try to make the client work in remote machine:
Original code:
Context initial = new InitialContext();
I changed to:
Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory" );
env.setProperty("java.naming.provider.url", "iiop://192.168.1.55:3700");
InitialContext initial = new InitialContext(env);
but it can't work even in the local machine. The below exception is occured:
javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
The problem must in these two line:
env.setProperty("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory" );
env.setProperty("java.naming.provider.url", "iiop://192.168.1.55:3700");
I am new to EJB and can't find any document that tell me how to set these two properties.
Anybody can help me please? Any suggestion is welcome, thanks.....http://docs.sun.com/source/817-6087/dgjndi.html This will give you hopefully the info that you need
-
Can you guys help me with javax.naming.NameNotFoundException:
Using Oracle App Server 10.1.2, OC4J managed by OPMN
Which OC4J I am using
oracle@SUSE-E:~/OracleAS/j2ee/home> java -jar oc4j.jar -version
Oracle Application Server Containers for J2EE 10g (10.1.2.0.0) (build 041222.1873)
oracle@SUSE-E:~/OracleAS/j2ee/home>
/OracleAS/j2ee/home/config/server.xml
<application name="xPression" path="../applications/xPression.ear" auto-start="true" />
OracleAS/opmn/conf/opmn.xml
<opmn xmlns="http://www.oracle.com/ias-instance">
<notification-server>
<port local="6100" remote="6200" request="6003"/>
<log-file path="$ORACLE_HOME/opmn/logs/ons.log" level="4" rotation-size="1500000"/>
<ssl enabled="true" wallet-file="$ORACLE_HOME/opmn/conf/ssl.wlt/default"/>
</notification-server>
<ias-component id="OC4J">
<process-type id="home" module-id="OC4J" status="enabled">
</ias-component>
</opmn>
Parameters that I used to construct the InitialContext in my Java Code.
InitialContextFactory=com.evermind.server.rmi.RMIInitialContextFactory
ProviderURL=opmn:ormi://10.10.5.41:6003:home/xPression
SECURITY_PRINCIPAL=<user>
SECURITY_CREDENTIALS=<password>
Refered:
http://radio.weblogs.com/0135826/2005/10/06.html
Logfile extract: OracleAS/opmn/logs/OC4J~home~default_island~1
53 06/10/19 11:38:04 EL providerUrl: opmn:ormi://10.10.5.41:6003:home/xPression
54 06/10/19 11:38:04 EL namingFactory: com.evermind.server.rmi.RMIInitialContextFactory
56 06/10/19 11:38:04 EL Creating the Initial Context
57 06/10/19 11:38:04 EL jndi Name: com/dsc/uniarch/cr/ejb/CRContentSF
58 06/10/19 11:38:04 EL Inside Class.forName
59 06/10/19 11:38:04 EL Class.forName succeeded
60 06/10/19 11:38:04 PROVIDER_URL =opmn:ormi://10.10.5.41:6003:home/xPression
61 06/10/19 11:38:04 INITIAL_CONTEXT_FACTORY =com.evermind.server.rmi.RMIInitialContextFactory
62 06/10/19 11:38:04 SECURITY_PRINCIPAL =user
63 06/10/19 11:38:04 SECURITY_CREDENTIALS =password
64 06/10/19 11:38:04 JNDI NAME =com/dsc/uniarch/cr/ejb/CRContentSF
65 06/10/19 11:38:04 EL Exception Occurred while lookup
66 06/10/19 11:38:04 EL Exception occurred at PortableRemoteObject.narrow
67 06/10/19 11:38:04 javax.naming.NameNotFoundException: com/dsc/uniarch/cr/ejb/CRContentSF not found
68 06/10/19 11:38:04 at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:164)
69 06/10/19 11:38:04 at javax.naming.InitialContext.lookup(InitialContext.java:347)
70 06/10/19 11:38:04 at com.dsc.uniarch.com2ejb.COM2EJBBridge._processInitializeCommand(COM2EJBBridge.java:521)
71 06/10/19 11:38:04 at com.dsc.uniarch.com2ejb.COM2EJBBridge.processInitializeCommand(COM2EJBBridge.java:656)
72 06/10/19 11:38:04 at com.dsc.uniarch.op.cmpcalwrapper.csetCompose(Native Method)
73 06/10/19 11:38:04 at com.dsc.uniarch.op.cmpcalwrapper.csetOutput2PDL(cmpcalwrapper.java:96)
74 06/10/19 11:38:04 at com.dsc.uniarch.op.OutputProfileController.processDocument(OutputProfileController.java:
orion-ejb-jar.xml
<session-deployment name="CRContentSF"
location="com/dsc/uniarch/cr/ejb/CRContentSF">
</session-deployment>
ejb-jar.xml
<session id="CRContentSF">
<ejb-name>CRContentSF</ejb-name>
<home>com.dsc.uniarch.cr.ejb.CRContentSFHome</home>
<remote>com.dsc.uniarch.cr.ejb.CRContentSF</remote>
<ejb-class>com.dsc.uniarch.cr.ejb.CRContentSFBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
</session>
THANKS FOR YOUR TIME AND HELPSome more info on from where I am looking up.
It is a java class in the EAR and OC4J container same as the EJB (Home) class.
Just highlighting the exception.
Logfile extract: OracleAS/opmn/logs/OC4J~home~default_island~1
53 06/10/19 11:38:04 EL providerUrl: opmn:ormi://10.10.5.41:6003:home/xPression
54 06/10/19 11:38:04 EL namingFactory: com.evermind.server.rmi.RMIInitialContextFactory
56 06/10/19 11:38:04 EL Creating the Initial Context
57 06/10/19 11:38:04 EL jndi Name: com/dsc/uniarch/cr/ejb/CRContentSF
58 06/10/19 11:38:04 EL Inside Class.forName
59 06/10/19 11:38:04 EL Class.forName succeeded
60 06/10/19 11:38:04 PROVIDER_URL =opmn:ormi://10.10.5.41:6003:home/xPression
61 06/10/19 11:38:04 INITIAL_CONTEXT_FACTORY =com.evermind.server.rmi.RMIInitialContextFactory
62 06/10/19 11:38:04 SECURITY_PRINCIPAL =user
63 06/10/19 11:38:04 SECURITY_CREDENTIALS =password
64 06/10/19 11:38:04 JNDI NAME =com/dsc/uniarch/cr/ejb/CRContentSF
65 06/10/19 11:38:04 EL Exception Occurred while lookup
66 06/10/19 11:38:04 EL Exception occurred at PortableRemoteObject.narrow
67 06/10/19 11:38:04 javax.naming.NameNotFoundException: com/dsc/uniarch/cr/ejb/CRContentSF not found
68 06/10/19 11:38:04 at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:164)
69 06/10/19 11:38:04 at javax.naming.InitialContext.lookup(InitialContext.java:347)
70 06/10/19 11:38:04 at com.dsc.uniarch.com2ejb.COM2EJBBridge._processInitializeCommand(COM2EJBBridge.java:521)
71 06/10/19 11:38:04 at com.dsc.uniarch.com2ejb.COM2EJBBridge.processInitializeCommand(COM2EJBBridge.java:656)
72 06/10/19 11:38:04 at com.dsc.uniarch.op.cmpcalwrapper.csetCompose(Native Method)
73 06/10/19 11:38:04 at com.dsc.uniarch.op.cmpcalwrapper.csetOutput2PDL(cmpcalwrapper.java:96)
74 06/10/19 11:38:04 at com.dsc.uniarch.op.OutputProfileController.processDocument(OutputProfileController.java: -
Javax.naming.NameNotFoundException: error in whil calling EJB Bean
Dear friends,
I have created (Bean Managed Entity) a remote,home and bean objects for adding a country in a database. When i convert
into jar and and deploy means, its working fine. But if i put into a package means it does work
and raise "javax.naming.NameNotFoundException" error.
i keep my files as following folder structure
d:\siva\projects\ShopCart\
(under this )
CountryMas.java
CountryHome.java
CountryBean.java
CountryMasPK.java
<meta-inf>
ejb-jar.xml
weblogic-ejb-jar.xml
and deployed in weblogic 6.1 using console.
i have copied the source code here with
Remote interface
package ShopCart;
import javax.ejb.*;
import javax.rmi.*;
public interface CountryMas extends EJBObject {
Home Interface
package ShopCart;
import javax.ejb.*;
import java.rmi.*;
public interface CountryHome extends EJBHome {
public CountryMas create(String Cname) throws CreateException,RemoteException;
public CountryMas findByPrimaryKey(CountryMasPK pk) throws
FinderException,RemoteException;
BEAN OBJECT
package ShopCart;
import java.io.*;
import java.util.*;
import java.sql.*;
import javax.sql.*;
import javax.ejb.*;
import javax.naming.*;
public class CountryBean implements EntityBean {
private EntityContext ctx;
private int CountryId;
private String CountryName;
public void setEntityContext(EntityContext ctx){
this.ctx = ctx;
public void unsetEntityContext(){
this.ctx = null;
public void ejbActivate(){
public void ejbPassivate(){
public void ejbLoad(){
public void ejbStore(){
public void ejbRemove(){
Connection con = null;
PreparedStatement ps = null ;
try {
con = getConnection();
ps = con.prepareStatement("Delete from CountryMas where id=?");
ps.setInt(1,CountryId);
if (ps.executeUpdate() !=1) {
String Error = "JDBC did not create any row";
throw new CreateException (Error);
}catch (Exception e){
System.out.println (e);
public CountryMasPK ejbCreate(String Cname) throws CreateException {
this.CountryName =Cname;
Connection con = null;
PreparedStatement ps = null ;
try {
con = getConnection();
ps = con.prepareStatement("insert into CountryMas values(?)");
ps.setString (1,CountryName);
if (ps.executeUpdate() !=1) {
String Error = "JDBC did not delete any row";
throw new CreateException (Error);
con.commit();
}catch (Exception e){
System.out.println (e);
int PKid=0;
ResultSet rs;
PreparedStatement ps1 = null;
try {
ps1 = con.prepareStatement("select max(id) as Mid from CountryMas");
rs = ps1.executeQuery();
PKid = rs.getInt("mid");
}catch(Exception e){
System.out.println (e);
return new CountryMasPK(PKid);
public void ejbPostCreate(String Cname) throws CreateException {
private Connection getConnection()throws SQLException {
InitialContext initCtx = null;
DataSource ds = null;
try{
initCtx = new InitialContext ();
ds = (javax.sql.DataSource)
initCtx.lookup("java:comp/env/jdbc/ShopCartPool");
}catch(Exception e){
System.out.println(e);
return ds.getConnection();
public CountryMasPK ejbFindByPrimaryKey(CountryMasPK pk)throws ObjectNotFoundException {
Connection con= null;
PreparedStatement ps = null ;
try{
con = getConnection();
ps = con.prepareStatement("select cname from CountryMas where id=?");
ps.setInt(1,pk.ID);
ps.executeQuery();
ResultSet rs= ps.getResultSet();
if (rs.next()){
this.CountryName = rs.getString(1);
}catch(Exception e){
System.out.println(e);
//return new CountryMasPK(pk.i);
return pk;
PRIMARY KEY OBJECT
package ShopCart;
import java.io.Serializable;
public class CountryMasPK implements java.io.Serializable {
public int ID;
public CountryMasPK(int ID){
this.ID =ID;
public CountryMasPK(){
public CountryMasPK(CountryMasPK pk){
this.ID = pk.ID;
public String toString(){
return new Integer(ID).toString();
public int hashCode(){
return new Integer(ID).hashCode();
public boolean equals(Object countrymas){
//return ((CountryMasPK)countrymas).ID.equals(ID);
return true;
EJB-JAR.XML
<?xml version="1.0"?>
<!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>ShopCart</ejb-name>
<home>ShopCart.CountryHome</home>
<remote>ShopCart.CountryMas</remote>
<ejb-class>ShopCart.CountryBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>ShopCart.CountryMasPK</prim-key-class>
<reentrant>False</reentrant>
<resource-ref>
<res-ref-name>jdbc/ShopCartPool</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>ShopCart</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
WEBLOGIC-EJB-JAR.XML
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC
'-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN'
'http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>ShopCart</ejb-name>
<reference-descriptor>
<resource-description>
<res-ref-name>jdbc/ShopCartPool</res-ref-name>
<jndi-name>ShopCartDataSource</jndi-name>
</resource-description>
</reference-descriptor>
<jndi-name>Country</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
i converted jar file like this
d:\siva\projects\> set claapath=%classpath%;.;
cd d:\siva\projects\ShopCart > javac *.java
cd d:\siva\projects\ShopCart > jar -cvf Sh.jar *
cd..
d:\siva\projects> java weblogic.ejbc ShopCart\Sh.jar ShopCart\Shop.jar
and deployed using weblogic 6.1 console
and client code as follows
Client.java
import java.io.*;
import javax.naming.*;
import javax.ejb.*;
import javax.rmi.*;
import java.util.*;
import ShopCart.*;
class Client {
public static void main(String args[]){
Context ctx=null;
try{
Properties pr = new Properties();
pr.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
pr.put(Context.PROVIDER_URL,"t3://localhost:7001");
ctx= new InitialContext(pr);
Object obj = ctx.lookup("Country");
CountryHome cm = (CountryHome)
javax.rmi.PortableRemoteObject.narrow(obj,CountryHome.class);
cm.create(args[0]);
System.out.println ("Creating Country " + args[0] +" ..... [Done]");
}catch (Exception e){
System.out.println(e);
when i run this file it raise the error
D:\Siva\Projects>java Client.java
Exception in thread "main" java.lang.NoClassDefFoundError: Client/java
D:\Siva\Projects>java Client
javax.naming.NameNotFoundException: Unable to resolve Country. Resolved: '' Unre
solved:'Country' ; remaining name ''
D:\Siva\Projects>
This is the error message. Please observe it and do let me know what would be the error. There
would be small configuration error. But i couldn't locate it . plz help me somebody.
Thanx & Regards,
Siva.you need to use the name java:comp/env/Country in the client.
and the client deployment descriptor will need an ejb-ref entry:
<ejb-ref>
<ejb-ref-name>
Country
</ejb-ref-name>
<ejb-ref-type>
Session
</ejb-ref-type>
<home>
ShopCart.CountryHome
</home>
<remote>
ShopCart.CountryMas
</remote>
</ejb-ref>toby -
JNDI lookup from OC4J to weblogic throws javax.naming.NameNotFoundException
Hi All,
We have the below setup in our production environment.
EJB application is deployed in the Weblogic 10.3.4.0 Server on Sun Solaris. The EJB version is 3.0
OC4J 10.2.0 is running on another Sun Solaris machine.
There are 2 webservice applications WEBSERV1 & TestSoapEJB running on this OC4J container.
We need to do lookup the EJBs deployed on the Weblogic server. For this we used the below logic in the web service's Stateless session bean:
String weblogicURL = "";
Properties props = new Properties();
try
props.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("wl.properties"));
weblogicURL = props.getProperty("weblogicURL");
catch (FileNotFoundException e)
e.printStackTrace();
catch (IOException e)
e.printStackTrace();
Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
ht.put(Context.SECURITY_PRINCIPAL,"weblogic");
ht.put(Context.SECURITY_CREDENTIALS,"weblogic654");
ht.put(Context.PROVIDER_URL, weblogicURL);
ctx = NamingManager.getInitialContext(ht) ;
// tried using //ctx = new InitialContext(ht); same behavior.
TestEJB.AdministratorEJB ejb = (TestEJB.AdministratorEJB) ctx.lookup("TestEJB#TestEJB.AdministratorEJB");
ctx.close();
When we first test first WEBSER1, the lookup is fine.
But when we test the second webservice WEBSER2, the webservice name itself not able to lookup: It gives the below error:
javax.naming.NameNotFoundException: remaining name: env/TestSoapEJB
Below is the stack throws thrown on browser:
500 Internal Server Error
javax.naming.NameNotFoundException: remaining name: env/TestSoapEJB
at weblogic.j2eeclient.SimpleContext.resolve(SimpleContext.java:35)
at weblogic.j2eeclient.SimpleContext.resolve(SimpleContext.java:39)
at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:59)
at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:59)
at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:64)
at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)
at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:130)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at oracle.j2ee.ws.SessionBeanRpcWebService.init(SessionBeanRpcWebService.java:65)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpApplication.loadServlet(HttpApplication.java:2354)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpApplication.findServlet(HttpApplication.java:4795)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2821)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:680)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:662)
It seems that, the OC4J is looking in Weblogic context. But it should be looking in its own context. How to resolve this issue.
The same case happens if i restart the OC4J and first test the TestSoapEJB the lookup is fine . But if i test the WEBSERV1 , it throws the same error as above. In short, if one of the webservices lookup is working fine, the other webservice is not working. At the same time only one webservice's lookup is working.
Kindly help me to resolve this issue.
regards,
Zia
Edited by: PT Expert on Sep 9, 2012 3:16 AMI work now more that two days on this error!!!
-> I remade my complete jdev project, it did not work!
-> I deleted the jdev/system/j2ee/oc4j/workspace dir
-> I search for some .lock files
-> and many more tries!!! But without success...
Is there a way to reset the Embedded OC4J? -
Javax.naming.NameNotFoundException
I am using Weblogic 7.0 and while deploying an EJB during startup I get this error?
Somehow, this application deployed in some developers' machines and failed on
others. I have no idea why? Pls help!
Wen
[exec] weblogic.ejb20.UnDeploymentException: cps_server_ejb.jar; nested exception
is:
[exec] javax.naming.NameNotFoundException: Unable to resolve 'app/ejb/cps_server_ejb.jar#StatefulWorkflowEJB'
Resolved: 'app/ejb' Unresolved:
'cps_server_ejb.jar#StatefulWorkflowEJB' ; remaining name 'cps_server_ejb.jar#StatefulWorkflowEJB'
[exec] javax.naming.NameNotFoundException: Unable to resolve 'app/ejb/cps_server_ejb.jar#StatefulWorkflowEJB'
Resolved: 'app/ejb' Unresolved:'cps
serverejb.jar#StatefulWorkflowEJB' ; remaining name 'cps_server_ejb.jar#StatefulWorkflowEJB'
[exec] at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:858)
[exec] at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:223)
[exec] at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:187)
[exec] at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)
[exec] at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:333)
[exec] at weblogic.ejb20.deployer.EJBDeployer.cleanupAppContext(EJBDeployer.java:1739)
[exec] at weblogic.ejb20.deployer.EJBDeployer.rollback(EJBDeployer.java:1420)
[exec] at weblogic.ejb20.deployer.EJBDeployer.undeploy(EJBDeployer.java:310)
[exec] at weblogic.ejb20.deployer.Deployer.deploy(Deployer.java:884)
[exec] at weblogic.j2ee.EJBComponent.deploy(EJBComponent.java:79)
[exec] at weblogic.j2ee.Application.addComponent(Application.java:294)
[exec] at weblogic.j2ee.J2EEService.addDeployment(J2EEService.java:163)
[exec] at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:396)
[exec] at weblogic.management.mbeans.custom.DeploymentTarget.addDeployments(DeploymentTarget.java:302)
[exec] at weblogic.management.mbeans.custom.DeploymentTarget.updateServerDeployments(DeploymentTarget.java:256)
[exec] at weblogic.management.mbeans.custom.DeploymentTarget.updateDeployments(DeploymentTarget.java:207)
[exec] at java.lang.reflect.Method.invoke(Native Method)
[exec] at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:717)
[exec] at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:699)
[exec] at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:405)
[exec] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
[exec] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
[exec] at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBeanServerImpl.java:921)
[exec] at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:470)
[exec] at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:198)
[exec] at $Proxy40.updateDeployments(Unknown Source)
[exec] at weblogic.management.configuration.ServerMBean_CachingStub.updateDeployments(ServerMBean_CachingStub.java:3957)
[exec] at weblogic.management.deploy.slave.SlaveDeployer.updateServerDeployments(SlaveDeployer.java:2258)
[exec] at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.java:365)
[exec] at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resume(DeploymentManagerServerLifeCycleImpl.java:235)
[exec] at weblogic.t3.srvr.ServerLifeCycleList.resume(ServerLifeCycleList.java:61)
[exec] at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:812)
[exec] at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:294)
[exec] at weblogic.Server.main(Server.java:31)
[exec] <Oct 30, 2002 10:15:28 AM PST> <Error> <J2EE> <160001> <Error deploying
application cps_server_ejb:Could it be caused by a wrong configuration in the Weblogic Server console?That, or you are simply using the wrong JNDI lookup path. Or both. The server should provide a function to see what is deployed in its JNDI context, hopefully also mentioning the JNDI path to use. If you need more help, I suggest you take your question to the weblogic forum.
https://forums.oracle.com/forums/category.jspa?categoryID=193 -
OC4J Configuration - javax.naming.NameNotFoundException
Here is a description of the problem we are having:
The Problem
We have a remote client that wishes to invoke services
that we are
going to provide. These services will be accessible via a JNDI
lookup from
the client's JVM. The client, is operating in a JRE, version
1.2.2, but is
an in-house Java Server Engine (developed before the Servlet API
specification) and not a command line client application. It is
desirable to
do a simple JNDI lookup from the RMIInitialContext and gain
access to the
services (Home Interface). Attached is a demonstration of a
client
application doing a lookup against the deployment shown below
(orion-ejb-jar.xml ). Notice the name of the service in the
lookup on the
client application are exactly the same as the location
declaration of the
session deployment element of the orion-ejb-jar.xml. The service
(EJB, not
attached) was deployed without any errors. The exception we are
getting is:
Exception in thread "main" javax.naming.NameNotFoundException:
DAServicesDemo not found
at com.evermind.server.rmi.RMIContext.lookup
(RMIContext.java:121)
at javax.naming.InitialContext.lookup
(InitialContext.java:350)
at test.RemoteServiceClient.main
(RemoteServiceClient.java:26)
The RMI server has been configured with the default
settings, and is
listening on port 8474
The Source
package test;
import ORG.oclc.da.beans.*;
import javax.naming.*;
import java.util.*;
import java.rmi.*;
import javax.ejb.*;
public class RemoteServiceClient
public static void main(String[] args)
throws NamingException, CreateException,
RemoteException,
Exception{
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"com.evermind.server.rmi.RMIInitialContextFactory");
h.put
(Context.PROVIDER_URL, "ormi://risc14.dev.oclc.org:8474");
InitialContext context = new InitialContext(h);
DAServicesDemoHome remoteServiceHome =
(DAServicesDemoHome) (new
InitialContext(h)).lookup("DAServicesDemo");
DAServicesDemo remoteService =
(DAServicesDemo)remoteServiceHome.create();
System.out.println("Here it is: " +
remoteService.getContentGroup());
C_DemoServices remoteService = new C_DemoServices();
String result = remoteService.getContentGroup();
System.out.println("This is the result form the remote
service: " +
result);
EJB-jar.xml
<ejb-jar>
<description>
Proof of concept application for the integration of DA to
CORC
</description>
<display-name>Digital Archive Remote Services</display-name>
<enterprise-beans>
<session>
<ejb-name>DAServicesDemo</ejb-name>
<home>ORG.oclc.da.beans.DAServicesDemoHome</home>
<remote>ORG.oclc.da.beans.DAServicesDemo</remote>
<ejb-class>ORG.oclc.da.beans.DAServicesDemoBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>DAServicesDemo</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>NotSupported</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
Orion-ejb.jar
<orion-ejb-jar deployment-version="1.0.2.2" deployment-
time="ea2215b915">
<enterprise-beans>
<session-deployment name="DAServicesDemo"
location="DAServicesDemo"
wrapper="DAServicesDemoHome_StatelessSessionHomeWrapper1"
timeout="1800"
persistence-filename="DAServicesDemo" />
</enterprise-beans>
<assembly-descriptor>
<default-method-access>
<security-role-mapping
name="<default-ejb-caller-role>" impliesAll="true" />
</default-method-access>
</assembly-descriptor>
</orion-ejb-jar>
Any help would be greatly appreciated, thanks in advanced...Hi Jonathan,
If I understand you correctly, you are trying to access an EJB in
OC4J from a separate, external JVM. If that is correct, then, in
order to achieve that, the (EJB) home interface "stub" class must
be located in the client's JVM. Unfortunately, I haven't figured
out how to do that, and therefore, as far as I can see, the only
two client options available are:
1. Web-based client -- servlet or JSP
2. Application client -- standalone java application.
However, for both options, the client must also be deployed to
OC4J. I don't know how to obtain "stub" classes generated by OC4J
so that I can give external clients access to them.
According to the J2EE spec, application clients need to be run
within containers, too -- albeit thin containers. I presume that
means you need 2 instances of OC4J running -- one for the server
and one for the client. Seems a bit "heavy" to me, so for now I'm
going with the web-based (servlet) client and having external
java classes communicate with the servlet.
Hope this has been of assistance to you,
Avi. -
Javax.naming.NameNotFoundException: service not bound
hi
i am trying to access web services using JNDI lookup.
this is my client code snippet
ctx=new InitialContext();
//customerSessionRemote remote=(customerSessionRemote)ctx.lookup("customer/remote");
Service service=(Service)ctx.lookup("java:comp/env/service/CustomerRegisteration");
try {
EndpointInterface port = (EndpointInterface)service.getPort(EndpointInterface.class);
String user=port.validateUser(getUserName(), getPassword());
System.out.println(user);
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
but i am getting following error,
javax.naming.NameNotFoundException: service not bound
17:55:56,468 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
17:55:56,468 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
17:55:56,468 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
17:55:56,468 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
17:55:56,468 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
17:55:56,468 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
17:55:56,484 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:716)
17:55:56,484 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
17:55:56,484 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351)
17:55:56,484 ERROR [STDERR] at client.UserBean.loginUser(UserBean.java:125)
17:55:56,484 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:55:56,484 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
17:55:56,484 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
17:55:56,484 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
17:55:56,484 ERROR [STDERR] at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
17:55:56,484 ERROR [STDERR] at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
17:55:56,484 ERROR [STDERR] at javax.faces.component.UICommand.broadcast(UICommand.java:312)
17:55:56,484 ERROR [STDERR] at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
17:55:56,484 ERROR [STDERR] at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
17:55:56,484 ERROR [STDERR] at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
17:55:56,484 ERROR [STDERR] at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
17:55:56,484 ERROR [STDERR] at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
17:55:56,484 ERROR [STDERR] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
17:55:56,484 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
17:55:56,484 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
17:55:56,484 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
17:55:56,484 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
17:55:56,484 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
17:55:56,484 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
17:55:56,484 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
17:55:56,484 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
17:55:56,484 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
17:55:56,484 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
17:55:56,484 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
17:55:56,484 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
17:55:56,484 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
17:55:56,484 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
17:55:56,484 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
17:55:56,484 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
17:55:56,484 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
17:55:56,484 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
17:55:56,484 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
please help me in resolving thishi
As i am exposing ejb3 components as web servcices there is no deployment descriptor files.its based on annotation.Even i am developing enterprise applicatoin.I am using Jboss app server.
only 2 xml files are there,
persistence.xml and web.xml
should i need to post any other file?
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>AccountListServlet</servlet-name>
<servlet-class>client.AccountListServlet</servlet-class>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>accountDetailServlet</servlet-name>
<servlet-class>client.accountDetailServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AccountListServlet</servlet-name>
<url-pattern>/AccountListServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>accountDetailServlet</servlet-name>
<url-pattern>/accountDetailServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence 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" version="1.0">
<persistence-unit name="customer" transaction-type="JTA">
<jta-data-source>java:/MSSqlDS</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" />
</properties>
</persistence-unit>
</persistence>
could u tell me where i went wrong? -
Hi
I use JDev Studio 10.1.3.40.66 and EJB 3.0 with annotations. I am working in the same Project (Model) with two stateless beans and some entities. In the same Project I have one test-client which implemented the lookup.
Here a snippet of the EJB:
@Stateless( name = "MyDao" )
public class MyDaoImpl implements IMyDao {
... }Here piece of code out of test-client:
final Context context = getInitialContext();
IMyDao iMyDao = (IMyDao)context.lookup("MyDao");Now everything worked fine and nobody changed anything in the project. So it may be that after a "power off" and a restart I couldn't find my EJBs with the lookup?!
Here is what I get from OC4J log:
07/04/02 10:32:09 FEIN: TxSecIORInterceptor.addCSIv2Components Unable to obtain mutual auth port
07/04/02 10:32:09 FEIN: TxSecIORInterceptor.addCSIv2Components UnknownType exceptioncom.sun.corba.ee.spi.legacy.interceptor.UnknownType
(Here is some more stack trace!)
FEIN: [current-workspace-app:Azima_AzimaModel_0] Initializing EntityManagerFactory named Azima-local with persistence provider oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.
07/04/02 10:32:13 WARNUNG: Application.setConfig Application: current-workspace-app is in failed state as initialization failed.
java.lang.LinkageError: loader constraints violated when linking javax/persistence/spi/PersistenceUnitInfo class
Checking that EJBs were successfully deployed in embedded OC4J...
All EJBs are successfully deployed.From my test-client log I get:
javax.naming.NameNotFoundException: MyDao not found
at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:52)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.promatis.azima.model.test.Client.main(Client.java:390)
...So I couldn't test my EJB anymore. If you have some suggestions or if you need more information about my project just post...
I need some help with this problem!
ThanksI work now more that two days on this error!!!
-> I remade my complete jdev project, it did not work!
-> I deleted the jdev/system/j2ee/oc4j/workspace dir
-> I search for some .lock files
-> and many more tries!!! But without success...
Is there a way to reset the Embedded OC4J? -
Hi
I have developed a search servlet and deployed it in tomcat 4.0.3 and connected to mysql database through jdbc by specifying jndi.
I have coded JNDI lokkup name as "java:comp/env/jdbc/KgoogleDB"
I have added a context in server.xml file of tomcat for DBCP connection pooling .I have tested this in windows and it is running well in it.
But when i hosted this in linux i got error like this
INIT OF SEARCH SERVLET
Error in file reading Connection refused
File Not Found
javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at javax.naming.InitialContext.lookup(InitialContext.java:354)
at DbConnect.getConnection(DbConnect.java:35)
at QueryDetails.Query(QueryDetails.java:32)
at Search.doPost(Search.java:66)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:446)
at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.warp.WarpRequestHandler.handle(WarpRequestHandler.java:217)
at org.apache.catalina.connector.warp.WarpConnection.run(WarpConnection.java:194)
at java.lang.Thread.run(Thread.java:536)
Connection ID null
Entered FINALLY
=================================
What would be the cause of this error?.Please help me.
My server.xml context is
- <Host className="org.apache.catalina.connector.warp.WarpHost" name="www.keralagoogle.com" debug="0" appBase="/domains/www.yy.com/tomcat/webapps" unpackWARs="true">
- <Context path="/yyjava" docBase="/domains/www.yy.com/tomcat/webapps/yyjava" debug="0" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_KgoogleDB." suffix=".txt" timestamp="true" />
<Resource name="jdbc/KgoogleDB" auth="Container" type="javax.sql.DataSource" />
- <ResourceParams name="jdbc/KgoogleDB">
- <parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
- <!--
Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
-->
- <parameter>
<name>maxActive</name>
<value>500</value>
</parameter>
- <!--
Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit.
-->
- <parameter>
<name>maxIdle</name>
<value>300</value>
</parameter>
- <!--
Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely.
-->
- <parameter>
<name>maxWait</name>
<value>12000</value>
</parameter>
- <!-- MySQL dB username and password for dB connections
-->
- <parameter>
<name>username</name>
<value>pratap</value>
</parameter>
- <parameter>
<name>password</name>
<value>ky67yumXg</value>
</parameter>
- <!-- Class name for mm.mysql JDBC driver
-->
- <parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
- <!--
The JDBC connection url for connecting to your MySQL dB.
The autoReconnect=true argument to the url makes sure that the
mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
connection. mysqld by default closes idle connections after 8 hours.
-->
- <parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/kgoogle?</value>
</parameter>
</ResourceParams>
</Context>
==============================
Please help me find if i have to change the syntax for linux in the above code.
Thanks in Advance
Prathaphi
Thanks for your advise.
But when i chenged my web.xml and jndi name in my servlet file i got error like this
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
at javax.naming.InitialContext.lookup(InitialContext.java:354)
at DbConnect.getConnection(DbConnect.java:35)
at QueryDetails.Query(QueryDetails.java:32)
at Search.doPost(Search.java:66)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServl
et.java:446)
at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.jav
a:216)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:475)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve
.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2343)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
rValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
r.java:1012)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
va:1107)
at java.lang.Thread.run(Thread.java:536)
Connection ID null
Entered FINALLY
Please help me
Thanks in Advance
Prathap -
Javax.naming.NameNotFoundException while Message driven bean
I am adding a message driven bean in to my EJB application and trying
to deploy it in the WebLogic 6.0 server.
Now please let me know is there any other step i am missing.
1) This is what i have added in my ejb-jar.xml
<enterprise-beans>
<message-driven>
<description>no description</description>
<display-name>ActivatorBean</display-name>
<ejb-name>ActivatorBean</ejb-name>
<ejb-class>com.savvion.bizlogic.server.ActivatorBean</ejb-class>
<transaction-type>Container</transaction-type>
<message-driven-destination>
<jms-destination-type>javax.jms.Queue</jms-destination-type>
</message-driven-destination>
<security-identity>
<description/>
<run-as-specified-identity>
<description/>
<role-name/>
</run-as-specified-identity>
</security-identity>
</message-driven>
2) I am adding this is in the weblogic-ejb.xml
<weblogic-enterprise-bean>
<ejb-name>ActivatorBean</ejb-name>
<message-driven-descriptor>
<destination-jndi-name>MyMessageQueueFactory</destination-jndi-name>
</message-driven-descriptor>
<transaction-descriptor>
<trans-timeout-seconds>1200</trans-timeout-seconds>
</transaction-descriptor>
<jndi-name>MessageQueue</jndi-name>
</weblogic-enterprise-bean>
anything else which needs to added in WebLogic-ejb.xml or in config.xml
because as per the following error message there should be some
entry in config.xml.
onemore thing i am little bit confused in
<destination-jndi-name>MyMessageQueueFactory</destination-jndi-name>
and
<jndi-name>MessageQueue</jndi-name>
and when i deploed this in WebLogic got this error message on the
prompt
<Error> <J2EE> <Error deploying EJB Component : LEngine
weblogic.ejb20.EJBDeploymentException: Error deploying Message-Driven
Bean,
couldn't find Queue 'MyMessageQueueFactory'. Make sure it was declared
in your config.xml.
; nested exception is:
javax.naming.NameNotFoundException: Unable to resolve MyMessageQueueFactory.
Resolved: '' Unresolved:'MyMessageQueueFactory' ; remaining name
javax.naming.NameNotFoundException: Unable to resolve MyMessageQueueFactory.
Reso
lved: '' Unresolved:'MyMessageQueueFactory' ; remaining name ''
<<no stack trace available>>
>
<Error> <J2EE> <Error deploying application
WFEngine: Could not deploy: 'xyz.jar'
Possible reasons include:
1. The bean or an interface class has been modified but
the deployment descriptor has not been updated
2. The database mappings in the deployment descriptor do not
match the database definition
3. The jar file is not a valid jar file
4. The jar file does not contain a valid bean>
Thanks
NareshI am adding a message driven bean in to my EJB application and trying
to deploy it in the WebLogic 6.0 server.
Now please let me know is there any other step i am missing.
1) This is what i have added in my ejb-jar.xml
<enterprise-beans>
<message-driven>
<description>no description</description>
<display-name>ActivatorBean</display-name>
<ejb-name>ActivatorBean</ejb-name>
<ejb-class>com.savvion.bizlogic.server.ActivatorBean</ejb-class>
<transaction-type>Container</transaction-type>
<message-driven-destination>
<jms-destination-type>javax.jms.Queue</jms-destination-type>
</message-driven-destination>
<security-identity>
<description/>
<run-as-specified-identity>
<description/>
<role-name/>
</run-as-specified-identity>
</security-identity>
</message-driven>
2) I am adding this is in the weblogic-ejb.xml
<weblogic-enterprise-bean>
<ejb-name>ActivatorBean</ejb-name>
<message-driven-descriptor>
<destination-jndi-name>MyMessageQueueFactory</destination-jndi-name>
</message-driven-descriptor>
<transaction-descriptor>
<trans-timeout-seconds>1200</trans-timeout-seconds>
</transaction-descriptor>
<jndi-name>MessageQueue</jndi-name>
</weblogic-enterprise-bean>
anything else which needs to added in WebLogic-ejb.xml or in config.xml
because as per the following error message there should be some
entry in config.xml.
onemore thing i am little bit confused in
<destination-jndi-name>MyMessageQueueFactory</destination-jndi-name>
and
<jndi-name>MessageQueue</jndi-name>
and when i deploed this in WebLogic got this error message on the
prompt
<Error> <J2EE> <Error deploying EJB Component : LEngine
weblogic.ejb20.EJBDeploymentException: Error deploying Message-Driven
Bean,
couldn't find Queue 'MyMessageQueueFactory'. Make sure it was declared
in your config.xml.
; nested exception is:
javax.naming.NameNotFoundException: Unable to resolve MyMessageQueueFactory.
Resolved: '' Unresolved:'MyMessageQueueFactory' ; remaining name
javax.naming.NameNotFoundException: Unable to resolve MyMessageQueueFactory.
Reso
lved: '' Unresolved:'MyMessageQueueFactory' ; remaining name ''
<<no stack trace available>>
>
<Error> <J2EE> <Error deploying application
WFEngine: Could not deploy: 'xyz.jar'
Possible reasons include:
1. The bean or an interface class has been modified but
the deployment descriptor has not been updated
2. The database mappings in the deployment descriptor do not
match the database definition
3. The jar file is not a valid jar file
4. The jar file does not contain a valid bean>
Thanks
Naresh -
Javax.naming.NameNotFoundException: SessionEJBBean not found
Please help I am getting error: javax.naming.NameNotFoundException: SessionEJBBean not found.
I am using JDeveloper 10g as editor.
The embedded server is running, SessionEJBBean is also there. I have restarted the computer, changed 'SessionEJB' from 'SessionEJBBean'. Yet No success. This is what I get.:
javax.naming.NameNotFoundException: SessionEJBBean not found
at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:52)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at friends.SessionEJBClient.main(SessionEJBClient.java:11)
Process exited with exit code 0.
SessionEJBClient.java
package friends;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class SessionEJBClient {
public static void main(String [] args) {
try {
final Context context = getInitialContext();
SessionEJB sessionEJB = (SessionEJB)context.lookup("SessionEJBBean");
} catch (Exception ex) {
ex.printStackTrace();
private static Context getInitialContext() throws NamingException {
// Get InitialContext for Embedded OC4J
// The embedded server must be running for lookups to succeed.
return new InitialContext();
}Thank you.Thanks Karma-9 for your reply. My issue has got resolved as I followed this link:
http://www.oracle.com/technology/obe/obe1013jdev/10131/10131_ejb_30/ejb_30.htm
However I have now new problem in hand, when I am trying to insert data in database
using JSP. I am having problem with request.getParameter(). It is not
recognised by JSP. A red underline is being shown below
request.getParameter(). One more thing, in JSP page, if I take cursor over
'request' in request.getParameter, it shows, 'Name request not found'. When
I take cursor over 'getParameter' in request.getParameter, it shows, 'Method
getParameter (java.lang.String) not found in<unknown>'.
This is my code:
MyPage.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page import="java.sql.*, javax.naming.Context,
javax.naming.InitialContext, javax.naming.NamingException,
friendspackage.*, java.text.*, java.util.*"%>
<%!
public void jspInit () {
String name, city;
name = request.getParameter("name");
city = request.getParameter("city");
try {
final Context context = getInitialContext();
SessionFriends sessionFriends =
(SessionFriends)context.lookup("SessionFriends");
sessionFriends.addFriends("name","city");
//System.out.println( "Success" );
} catch (Exception ex) {
ex.printStackTrace();
private static Context getInitialContext() throws NamingException {
// Get InitialContext for Embedded OC4J
// The embedded server must be running for lookups to succeed.
return new InitialContext();
%>MyPage.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252"></meta>
<title>My Friends</title>
</head>
<body>
<form name="MyFriends" action="MyFriends.jsp" method="post">
Name:
<input type="text" name="name">
City:
<input type="text" name="city">
<input type="submit" value="Submit">
</form>
</body>
</html>Please let me know if I have to make any changes in web.xml which is:
<?xml version = '1.0' encoding = 'windows-1252'?>
<web-app 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/web-app_2_4.xsd" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee">
<description>Empty web.xml file for Web Application</description>
<session-config>
<session-timeout>35</session-timeout>
</session-config>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
</web-app>Thank you again.
Anurag
Maybe you are looking for
-
Hide the expansion icon on a jtree.
I need to hide the expansion icon (the "+") on a jtree. I tried to use DefaultTreeCellRenderer and the L&F options, but they hide all of the "+" icons of the tree. I need to hide the icons depending if the node has no-leaf icons. Thanx. pmadridb
-
Back Function key is not working
I have created report programing. and also add buttons to application tool bar using transaction 'SE41'. But in this case whenever I run program and click on Back.it is asking me to populate fields. Even after populating fields and clicking Back
-
Doubts in internal table logic
Hi All, I have two internal table, according to the posnr value i need to add the kbetr value from the 2nd internal table and update the value in the 1st line internal table. below the example of my internal table. Here for the line item 0010 i need
-
No GPS lock in the Dominican Republic
I have installed this version of 3.06 on my Nokia 5230 Nuron ovi_maps_installer_3.06_11wk7_b11_s60_5.0_nocs_beta.sis which works very well in the USA. I have no data plan with T-mobile so I do not use any internet connectivity to assist the GPS. I we
-
I don't have the Camera Shake Reduction Option in Photoshop CC
I don't have the Camera Shake Reduction Option in Photoshop CC, why is this and how can do I resolve this? I have a CC subscription, I have Photoshop version 13.1.2.x64. Thanks.