[jboss-user] [JNDI/Naming/Network] - my jndi name is not present in it

ganesh.pol do-not-reply at jboss.com
Mon May 21 11:28:05 EDT 2007


i follow the steps as you told me but my jndi name is not present on the page even ejb module is not shown 

__________________________________________________________
following is part of view which is showing JNDI names


Ejb Module: example.jar

java:comp namespace of the test/MyTestSession bean:

  +- env (class: org.jnp.interfaces.NamingContext)


java:comp namespace of the ejb/CalculatorSessionBean bean:

  +- env (class: org.jnp.interfaces.NamingContext)


java: Namespace

  +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
  +- DefaultDS (class: javax.sql.DataSource)
  +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
  +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
  +- comp (class: javax.naming.Context)
  +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
  +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
  +- jaas (class: javax.naming.Context)
  |   +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
  |   +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
  |   +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
  +- timedCacheFactory (class: javax.naming.Context)
Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy
  +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
  +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
  +- Mail (class: javax.mail.Session)
  +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
  +- TransactionManager (class: org.jboss.tm.TxManager)


Global JNDI Namespace

  +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
  +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
  +- UserTransactionSessionFactory (proxy: $Proxy11 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory,interface org.jboss.proxy.IClientContainer)
  +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
  +- console (class: org.jnp.interfaces.NamingContext)
  |   +- PluginManager (proxy: $Proxy36 implements interface org.jboss.console.manager.PluginManagerMBean)
  +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
  +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)
  +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
  +- topic (class: org.jnp.interfaces.NamingContext)
  |   +- testDurableTopic (class: org.jboss.mq.SpyTopic)
  |   +- testTopic (class: org.jboss.mq.SpyTopic)
  |   +- securedTopic (class: org.jboss.mq.SpyTopic)
  +- queue (class: org.jnp.interfaces.NamingContext)
  |   +- A (class: org.jboss.mq.SpyQueue)
  |   +- testQueue (class: org.jboss.mq.SpyQueue)
  |   +- ex (class: org.jboss.mq.SpyQueue)
  |   +- DLQ (class: org.jboss.mq.SpyQueue)
  |   +- D (class: org.jboss.mq.SpyQueue)
  |   +- C (class: org.jboss.mq.SpyQueue)
  |   +- B (class: org.jboss.mq.SpyQueue)
  +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
  +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
  +- ejb (class: org.jnp.interfaces.NamingContext)
  |   +- CalculatorSessionBean (proxy: $Proxy53 implements interface org.jboss.proxy.IClientContainer,interface calculator.session.calculatorHome,interface javax.ejb.Handle)
  |   +- test (class: org.jnp.interfaces.NamingContext)
  |   |   +- MyTestSessionBean (proxy: $Proxy51 implements interface org.jboss.proxy.IClientContainer,interface test.session.MyTestSessionHome,interface javax.ejb.Handle)
  +- jmx (class: org.jnp.interfaces.NamingContext)
  |   +- invoker (class: org.jnp.interfaces.NamingContext)
  |   |   +- RMIAdaptor (proxy: $Proxy35 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt,interface org.jboss.proxy.IClientContainer)
  |   +- rmi (class: org.jnp.interfaces.NamingContext)
  |   |   +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
  +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
  +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
  +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.nami




___________________________________________________________
this time i will post you the actual whole code


my Servlet class
/**
 * 
 */
package com.pspl.common.admin.user.web;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.pspl.common.delegate.CommonDelegate;
import com.pspl.common.delegate.ICommonDelegate;
import com.pspl.common.models.UserModel;

/**
 * @author ganesh_pol
 *
 */
public class LoginServlet extends HttpServlet {

	/* (non-Javadoc)
	 * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		processRequest(req,resp);
	}

	/* (non-Javadoc)
	 * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		processRequest(req,resp);
	}
	
	private void processRequest(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String mode=req.getParameter("mode");
		System.out.println("mode is"+mode);
		if(mode==null || "".equals(mode)){
			dispatchRequest(req,resp,"/login.jsp");
		}else if("process".equalsIgnoreCase(mode)){
			if(isValidUser(req)){
				System.out.println("valid user");
				dispatchRequest(req,resp,"/home.jsp");
			}else{
				dispatchRequest(req,resp,"/login.jsp");
			}
		}
	}
	
	private void dispatchRequest(HttpServletRequest req, HttpServletResponse resp,String view) throws ServletException, IOException {
		RequestDispatcher rd=req.getRequestDispatcher(view);
		rd.forward(req, resp);
	}
	
	private boolean isValidUser(HttpServletRequest request){
		boolean isValid=false;
		String userName=request.getParameter("userName");
		String password=request.getParameter("password");
		UserModel user=CommonDelegate.getInstance().authenticateUser(userName, password);
		if(user!=null){
			isValid=true;
		}
		
		return isValid;
	}

}

__________________________________________________________
my delegator code

package com.pspl.common.delegate;

import java.rmi.RemoteException;

import javax.ejb.CreateException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;

import com.pspl.common.admin.user.components.IUserSessionEJBHome;
import com.pspl.common.admin.user.components.IUserSessionEJBObject;
import com.pspl.common.admin.user.components.UserSessionBean;
import com.pspl.common.models.UserModel;

public class CommonDelegate implements ICommonDelegate {
	public static final CommonDelegate COMMON_DELEGATE=new CommonDelegate();
	
	public static final CommonDelegate getInstance(){
		return COMMON_DELEGATE;
	}
	
	
	public IUserSessionEJBObject getUserRemoteObject(String jndiName){
		System.out.println("looking for JNDI name"+jndiName);
		InitialContext context=null;
		Object obj=null;
		IUserSessionEJBObject userRemoteObject=null;
		IUserSessionEJBHome userSessionEJBHome=null;
		
		try{
			 context= new InitialContext();
			 obj=context.lookup(jndiName);
			 userSessionEJBHome=(IUserSessionEJBHome)PortableRemoteObject.narrow(obj,IUserSessionEJBHome.class);
			 System.out.println("USer EJB HOME Object"+userSessionEJBHome);
		}catch(NamingException namingEx){
			System.err.println("naming Exception occured");
			namingEx.printStackTrace();
		}
		try{
			userRemoteObject=userSessionEJBHome.create();
		}catch(CreateException creEx){
			System.err.println("create Exception occured");
			creEx.printStackTrace();
		}catch(RemoteException reEx){
			System.err.println("Remote Ex occured");
			reEx.printStackTrace();
		}
		 System.out.println("USer EJB HOME Object"+userSessionEJBHome);
		
		return userRemoteObject;
	}

	public UserModel authenticateUser(String userName, String password) {
	IUserSessionEJBObject userService=getUserRemoteObject("ejb/UserSession");
	UserModel user=null;
	try{
		user=userService.authenticateUser(userName, password);
	}catch(RemoteException reEx){
		System.err.println("Remote Exception occured");
		reEx.printStackTrace();
	}
	
		return user;
	}

}
___________________________________________________





View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047286#4047286

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047286



More information about the jboss-user mailing list