users@glassfish.java.net

Re: javax.naming.NameNotFoundException: UserManager not ...

From: <forums_at_java.net>
Date: Thu, 7 Jul 2011 02:06:35 -0500 (CDT)

Thanks a lot for replay,below is the my code could you please let me know
where i need to change.and i have attached xml files.

/*     */ package com.gehc.sf.service;
/*     */
/*     */ import com.gehc.sf.admin.ejb.AdminManager;
/*     */ import com.gehc.sf.admin.ejb.AdminManagerHome;
/*     */ import com.gehc.sf.admin.ejb.AdminManagerUtil;
/*     */ import com.gehc.sf.dto.Page;
/*     */ import com.gehc.sf.dto.SawfishException;
/*     */ import com.gehc.sf.dto.SfAppColumn;
/*     */ import com.gehc.sf.dto.SfApplication;
/*     */ import com.gehc.sf.dto.SfColumnType;
/*     */ import com.gehc.sf.dto.SfUser;
/*     */ import java.rmi.RemoteException;
/*     */ import java.util.Collection;
/*     */ import java.util.Hashtable;
/*     */ import javax.ejb.CreateException;
/*     */ import javax.naming.NamingException;
/*     */ import org.apache.commons.logging.Log;
/*     */ import org.apache.commons.logging.LogFactory;
/*     */
/*     */ public class AdminRemoteService
/*     */   implements AdminService
/*     */ {
/*  23 */   private static AdminRemoteService instance = null;
/*     */
/* 461 */   private static Log log =
LogFactory.getLog(AdminRemoteService.class);
/*     */
/*     */   public static synchronized AdminRemoteService getInstance()
/*     */   {
/*  28 */     if (instance == null)
/*  29 */       instance = new AdminRemoteService();
/*  30 */     return instance;
/*     */   }
/*     */
/*     */   public SfApplication createApp(SfApplication sfapplication)
/*     */     throws ServiceException
/*     */   {
/*  36 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try {
/*  38 */       sfapplication = adminmanager.createApp(sfapplication);
/*     */     }
/*     */     catch (RemoteException e) {
/*  41 */       e.printStackTrace();
/*     */     }
/*     */     catch (SawfishException e) {
/*  44 */       e.printStackTrace();
/*     */     }
/*  46 */     return sfapplication;
/*     */   }
/*     */
/*     */   public void modifyApp(SfApplication sfapplication)
/*     */     throws ServiceException
/*     */   {
/*  57 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try
/*     */     {
/*  60 */       adminmanager.modifyApp(sfapplication);
/*     */     }
/*     */     catch (SawfishException sawfishexception)
/*     */     {
/*  64 */       throw new ServiceException(sawfishexception);
/*     */     }
/*     */     catch (RemoteException remoteexception)
/*     */     {
/*  68 */       throw new ServiceException(remoteexception);
/*     */     }
/*     */   }
/*     */
/*     */   public SfApplication[] getApps()
/*     */     throws ServiceException
/*     */   {
/*  75 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try {
/*  77 */       return adminmanager.getApps();
/*     */     }
/*     */     catch (RemoteException e) {
/*  80 */       e.printStackTrace();
/*     */     }
/*     */     catch (SawfishException e) {
/*  83 */       e.printStackTrace();
/*     */     }
/*     */
/*  90 */     return null;
/*     */   }
/*     */
/*     */   public SfApplication getAppDetails(Long long1)
/*     */     throws ServiceException
/*     */   {
/*  96 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try {
/*  98 */       return adminmanager.getAppDetails(long1);
/*     */     }
/*     */     catch (RemoteException e) {
/* 101 */       e.printStackTrace();
/*     */     }
/*     */     catch (SawfishException e) {
/* 104 */       e.printStackTrace();
/*     */     }
/*     */
/* 111 */     return null;
/*     */   }
/*     */
/*     */   public SfApplication[] getAppsForUser(SfUser sfuser)
/*     */     throws ServiceException
/*     */   {
/* 117 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try {
/* 119 */       return adminmanager.getAppsForUser(sfuser);
/*     */     }
/*     */     catch (RemoteException e) {
/* 122 */       e.printStackTrace();
/*     */     }
/*     */     catch (SawfishException e) {
/* 125 */       e.printStackTrace();
/*     */     }
/*     */
/* 132 */     return null;
/*     */   }
/*     */
/*     */   public SfAppColumn[] getColumnForApp(Long long1)
/*     */     throws ServiceException
/*     */   {
/* 138 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try {
/* 140 */       return adminmanager.getColumnForApp(long1);
/*     */     }
/*     */     catch (RemoteException e) {
/* 143 */       e.printStackTrace();
/*     */     }
/*     */     catch (SawfishException e) {
/* 146 */       e.printStackTrace();
/*     */     }
/*     */
/* 153 */     return null;
/*     */   }
/*     */
/*     */   public SfColumnType[] getColumnTypes()
/*     */     throws ServiceException
/*     */   {
/* 159 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try {
/* 161 */       return adminmanager.getColumnTypes();
/*     */     }
/*     */     catch (RemoteException e) {
/* 164 */       e.printStackTrace();
/*     */     }
/*     */     catch (SawfishException e) {
/* 167 */       e.printStackTrace();
/*     */     }
/*     */
/* 174 */     return null;
/*     */   }
/*     */
/*     */   public void disableApp(Long long1)
/*     */     throws ServiceException
/*     */   {
/* 180 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try
/*     */     {
/* 183 */       adminmanager.disableApp(long1);
/*     */     }
/*     */     catch (SawfishException sawfishexception)
/*     */     {
/* 187 */       throw new ServiceException(sawfishexception);
/*     */     }
/*     */     catch (RemoteException remoteexception)
/*     */     {
/* 191 */       throw new ServiceException(remoteexception);
/*     */     }
/*     */   }
/*     */
/*     */   public void enableApp(Long long1)
/*     */     throws ServiceException
/*     */   {
/* 198 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try
/*     */     {
/* 201 */       adminmanager.enableApp(long1);
/*     */     }
/*     */     catch (SawfishException sawfishexception)
/*     */     {
/* 205 */       throw new ServiceException(sawfishexception);
/*     */     }
/*     */     catch (RemoteException remoteexception)
/*     */     {
/* 209 */       throw new ServiceException(remoteexception);
/*     */     }
/*     */   }
/*     */
/*     */   public void addAppColumn(SfAppColumn sfappcolumn, String s,
String s1)
/*     */     throws ServiceException
/*     */   {
/* 216 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try
/*     */     {
/* 219 */       adminmanager.addAppColumn(sfappcolumn, s, s1);
/*     */     }
/*     */     catch (SawfishException sawfishexception)
/*     */     {
/* 223 */       throw new ServiceException(sawfishexception);
/*     */     }
/*     */     catch (RemoteException remoteexception)
/*     */     {
/* 227 */       throw new ServiceException(remoteexception);
/*     */     }
/*     */   }
/*     */
/*     */   public void disableAppColumn(Long long1)
/*     */     throws ServiceException
/*     */   {
/* 234 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try
/*     */     {
/* 237 */       adminmanager.disableAppColumn(long1);
/*     */     }
/*     */     catch (SawfishException sawfishexception)
/*     */     {
/* 241 */       throw new ServiceException(sawfishexception);
/*     */     }
/*     */     catch (RemoteException remoteexception)
/*     */     {
/* 245 */       throw new ServiceException(remoteexception);
/*     */     }
/*     */   }
/*     */
/*     */   public void enableAppColumn(Long long1)
/*     */     throws ServiceException
/*     */   {
/* 252 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try
/*     */     {
/* 255 */       adminmanager.enableAppColumn(long1);
/*     */     }
/*     */     catch (SawfishException sawfishexception)
/*     */     {
/* 259 */       throw new ServiceException(sawfishexception);
/*     */     }
/*     */     catch (RemoteException remoteexception)
/*     */     {
/* 263 */       throw new ServiceException(remoteexception);
/*     */     }
/*     */   }
/*     */
/*     */   public Page getTasksForApp(Long long1, int i)
/*     */     throws ServiceException
/*     */   {
/* 270 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try {
/* 272 */       return adminmanager.getTasksForApp(long1, i);
/*     */     }
/*     */     catch (RemoteException e) {
/* 275 */       e.printStackTrace();
/*     */     }
/*     */     catch (SawfishException e) {
/* 278 */       e.printStackTrace();
/*     */     }
/*     */
/* 285 */     return null;
/*     */   }
/*     */
/*     */   public void deleteTaskForApp(Long[] along)
/*     */     throws ServiceException
/*     */   {
/* 291 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try
/*     */     {
/* 294 */       adminmanager.deleteTaskForApp(along);
/*     */     }
/*     */     catch (SawfishException sawfishexception)
/*     */     {
/* 298 */       throw new ServiceException(sawfishexception);
/*     */     }
/*     */     catch (RemoteException remoteexception)
/*     */     {
/* 302 */       throw new ServiceException(remoteexception);
/*     */     }
/*     */   }
/*     */
/*     */   public Collection getTableDetails(String s)
/*     */     throws ServiceException
/*     */   {
/* 309 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try {
/* 311 */       return adminmanager.getTableDetails(s);
/*     */     }
/*     */     catch (RemoteException e) {
/* 314 */       e.printStackTrace();
/*     */     }
/*     */     catch (SawfishException e) {
/* 317 */       e.printStackTrace();
/*     */     }
/*     */
/* 324 */     return null;
/*     */   }
/*     */
/*     */   public void addMasterRecord(String s, String s1, String s2)
/*     */     throws ServiceException
/*     */   {
/* 330 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try
/*     */     {
/* 333 */       adminmanager.addMasterRecord(s, s1, s2);
/*     */     }
/*     */     catch (SawfishException sawfishexception)
/*     */     {
/* 337 */       throw new ServiceException(sawfishexception);
/*     */     }
/*     */     catch (RemoteException remoteexception)
/*     */     {
/* 341 */       throw new ServiceException(remoteexception);
/*     */     }
/*     */   }
/*     */
/*     */   public void modifyMasterTable(String s, String s1, String
s2, String s3)
/*     */     throws ServiceException
/*     */   {
/* 348 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try
/*     */     {
/* 351 */       adminmanager.modifyMasterTable(s, s1, s2, s3);
/*     */     }
/*     */     catch (SawfishException sawfishexception)
/*     */     {
/* 355 */       throw new ServiceException(sawfishexception);
/*     */     }
/*     */     catch (RemoteException remoteexception)
/*     */     {
/* 359 */       throw new ServiceException(remoteexception);
/*     */     }
/*     */   }
/*     */
/*     */   public void enableMasterRecord(String s, String s1, String
s2)
/*     */     throws ServiceException
/*     */   {
/* 366 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try
/*     */     {
/* 369 */       adminmanager.enableMasterRecord(s, s1, s2);
/*     */     }
/*     */     catch (SawfishException sawfishexception)
/*     */     {
/* 373 */       throw new ServiceException(sawfishexception);
/*     */     }
/*     */     catch (RemoteException remoteexception)
/*     */     {
/* 377 */       throw new ServiceException(remoteexception);
/*     */     }
/*     */   }
/*     */
/*     */   public void disableMasterRecord(String s, String s1, String
s2)
/*     */     throws ServiceException
/*     */   {
/* 384 */     AdminManager adminmanager = lookUpSessionBean();
/*     */     try
/*     */     {
/* 387 */       adminmanager.disableMasterRecord(s, s1, s2);
/*     */     }
/*     */     catch (SawfishException sawfishexception)
/*     */     {
/* 391 */       throw new ServiceException(sawfishexception);
/*     */     }
/*     */     catch (RemoteException remoteexception)
/*     */     {
/* 395 */       throw new ServiceException(remoteexception);
/*     */     }
/*     */   }
/*     */
/*     */   private AdminManager lookUpSessionBean()
/*     */     throws ServiceException
/*     */   {
/* 402 */     Hashtable hashtable = new Hashtable();
/* 403 */     hashtable.put("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
/*     */
/* 405 */     hashtable.put("java.naming.provider.url",
"jnp://localhost:8080");
/* 406 */     hashtable.put("java.naming.factory.url.pkgs",
"org.jnp.interfaces");
/*     */     try
/*     */     {
/* 410 */       adminmanagerhome = AdminManagerUtil.getHome(hashtable);
/*     */     }
/*     */     catch (NamingException namingexception)
/*     */     {
/*     */       AdminManagerHome adminmanagerhome;
/* 414 */       debug(namingexception);
/* 415 */       throw new ServiceException(namingexception);
/*     */     }
/*     */     try
/*     */     {
/*     */       AdminManagerHome adminmanagerhome;
/* 420 */       adminmanager = adminmanagerhome.create();
/*     */     }
/*     */     catch (CreateException createexception)
/*     */     {
/*     */       AdminManager adminmanager;
/* 424 */       debug(createexception);
/* 425 */       throw new ServiceException(createexception);
/*     */     }
/*     */     catch (RemoteException remoteexception)
/*     */     {
/* 429 */       debug(remoteexception);
/* 430 */       throw new ServiceException(remoteexception);
/*     */     }
/*     */     AdminManager adminmanager;
/* 432 */     return adminmanager;
/*     */   }
/*     */
/*     */   private void debug(Exception exception)
/*     */   {
/* 437 */     if (log.isErrorEnabled())
/* 438 */       log.error("<AdminRemoteService> <ERROR_MSG> : " +
exception);
/*     */   }
/*     */
/*     */   static Class _mthclass$(String s)
/*     */   {
/*     */     try
/*     */     {
/* 448 */       return Class.forName(s);
/*     */     }
/*     */     catch (ClassNotFoundException e) {
/* 451 */       e.printStackTrace();
/*     */     }
/*     */
/* 456 */     return null;
/*     */   }
/*     */ }


--
[Message sent by forum member 'gtulasidhar']
View Post: http://forums.java.net/node/819040