1 28 29 package com.caucho.ejb.protocol; 30 31 import javax.ejb.EJBLocalHome ; 32 import javax.naming.Context ; 33 import javax.naming.InitialContext ; 34 import java.io.ObjectStreamException ; 35 import java.io.Serializable ; 36 37 40 class LocalHomeSkeletonWrapper implements Serializable { 41 protected String serverId; 42 43 46 public LocalHomeSkeletonWrapper() 47 { 48 } 49 50 55 public LocalHomeSkeletonWrapper(String serverId) 56 { 57 this.serverId = serverId; 58 } 59 60 63 public Object readResolve() 64 throws ObjectStreamException 65 { 66 try { 67 Context cmp = (Context ) new InitialContext ().lookup("java:comp/env/cmp"); 68 String name = serverId; 69 if (serverId.startsWith("/")) 70 name = serverId.substring(1); 71 72 EJBLocalHome home = (EJBLocalHome ) cmp.lookup(name); 73 74 if (home == null) 75 throw new ObjectExceptionWrapper("no local ejb " + serverId); 76 77 return home; 78 } catch (Exception e) { 79 throw new ObjectExceptionWrapper(e); 80 } 81 } 82 } 83 84 85 | Popular Tags |