public Object getObjectInstance(Object reference, Name name, Context ctx, Hashtable env) throws Exception { log.debug("JNDI lookup: " + name); String uid = (String) ( (Reference) reference ).get(0).getContent(); return getInstance(uid); }
public Object getObjectInstance(Object reference, Name name, Context ctx, Hashtable env) throws Exception { log.debug("JNDI lookup: " + name); String uid = (String) ( (Reference) reference ).get(0).getContent(); return getInstance(uid); }
private Object readResolve() throws ObjectStreamException { // look for the instance by uuid Object result = SessionFactoryObjectFactory.getInstance(uuid); if (result==null) { // in case we were deserialized in a different JVM, look for an instance with the same name // (alternatively we could do an actual JNDI lookup here....) result = SessionFactoryObjectFactory.getNamedInstance(name); if (result==null) { throw new InvalidObjectException("Could not find a stub SessionFactory named: " + name); } else { log.debug("resolved stub SessionFactory by name"); } } else { log.debug("resolved stub SessionFactory by uid"); } return result; }
private Object readResolve() throws ObjectStreamException { // look for the instance by uuid Object result = SessionFactoryObjectFactory.getInstance(uuid); if (result==null) { // in case we were deserialized in a different JVM, look for an instance with the same name // (alternatively we could do an actual JNDI lookup here....) result = SessionFactoryObjectFactory.getNamedInstance(name); if (result==null) { throw new InvalidObjectException("Could not find a stub SessionFactory named: " + name); } else { log.debug("resolved stub SessionFactory by name"); } } else { log.debug("resolved stub SessionFactory by uid"); } return result; }
private Object readResolve() throws ObjectStreamException { log.trace("Resolving serialized SessionFactory"); // look for the instance by uuid Object result = SessionFactoryObjectFactory.getInstance(uuid); if (result==null) { // in case we were deserialized in a different JVM, look for an instance with the same name // (alternatively we could do an actual JNDI lookup here....) result = SessionFactoryObjectFactory.getNamedInstance(name); if (result==null) { throw new InvalidObjectException("Could not find a SessionFactory named: " + name); } else { log.debug("resolved SessionFactory by name"); } } else { log.debug("resolved SessionFactory by uid"); } return result; }
private Object readResolve() throws ObjectStreamException { log.trace("Resolving serialized SessionFactory"); // look for the instance by uuid Object result = SessionFactoryObjectFactory.getInstance(uuid); if (result==null) { // in case we were deserialized in a different JVM, look for an instance with the same name // (alternatively we could do an actual JNDI lookup here....) result = SessionFactoryObjectFactory.getNamedInstance(name); if (result==null) { throw new InvalidObjectException("Could not find a SessionFactory named: " + name); } else { log.debug("resolved SessionFactory by name"); } } else { log.debug("resolved SessionFactory by uid"); } return result; }
/** * @see StatisticsServiceMBean#setSessionFactoryJNDIName(java.lang.String) */ public void setSessionFactoryJNDIName(String sfJNDIName) { this.sfJNDIName = sfJNDIName; try { Object obj = new InitialContext().lookup(sfJNDIName); if (obj instanceof Reference) { Reference ref = (Reference) obj; setSessionFactory( (SessionFactory) SessionFactoryObjectFactory.getInstance( (String) ref.get(0).getContent() ) ); } else { setSessionFactory( (SessionFactory) obj ); } } catch (NameNotFoundException e) { log.error("No session factory with JNDI name " + sfJNDIName, e); setSessionFactory(null); } catch (NamingException e) { log.error("Error while accessing session factory with JNDI name " + sfJNDIName, e); setSessionFactory(null); } catch (ClassCastException e) { log.error("JNDI name " + sfJNDIName + " does not handle a session factory reference", e); setSessionFactory(null); } }
/** * @see StatisticsServiceMBean#setSessionFactoryJNDIName(java.lang.String) */ public void setSessionFactoryJNDIName(String sfJNDIName) { this.sfJNDIName = sfJNDIName; try { Object obj = new InitialContext().lookup(sfJNDIName); if (obj instanceof Reference) { Reference ref = (Reference) obj; setSessionFactory( (SessionFactory) SessionFactoryObjectFactory.getInstance( (String) ref.get(0).getContent() ) ); } else { setSessionFactory( (SessionFactory) obj ); } } catch (NameNotFoundException e) { log.error("No session factory with JNDI name " + sfJNDIName, e); setSessionFactory(null); } catch (NamingException e) { log.error("Error while accessing session factory with JNDI name " + sfJNDIName, e); setSessionFactory(null); } catch (ClassCastException e) { log.error("JNDI name " + sfJNDIName + " does not handle a session factory reference", e); setSessionFactory(null); } }