banner

[Rule] Rules  [Home] Main Forum  [Portal] Portal  
[Members] Member Listing  [Statistics] Statistics  [Search] Search  [Reading Room] Reading Room 
[Register] Register  
[Login] Loginhttp  | https  ]
 
Forum Index Thảo luận hệ điều hành Windows InitialContext did not implement EventContext problem?  XML
  [Programming]   InitialContext did not implement EventContext problem? 01/02/2008 02:30:31 (+0700) | #1 | 113174
[Avatar]
LQV0604
Elite Member

[Minus]    0    [Plus]
Joined: 29/12/2003 14:54:13
Messages: 59
Offline
[Profile] [PM]
Mình gặp lỗi này khi chạy Hibernate trên JBoss server:

WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext

Sau khi đọc code của hibernate:

Code:
public static void addInstance(String uid, String name, SessionFactory instance, Properties properties) {

		log.debug("registered: " + uid + " (" + ( (name==null) ? "unnamed" : name ) + ')');
		INSTANCES.put(uid, instance);
		if (name!=null) NAMED_INSTANCES.put(name, instance);

		//must add to JNDI _after_ adding to HashMaps, because some JNDI servers use serialization
		if (name==null) {
			log.info("Not binding factory to JNDI, no JNDI name configured");
		}
		else {

			log.info("Factory name: " + name);

			try {
				Context ctx = NamingHelper.getInitialContext(properties);
				NamingHelper.bind(ctx, name, instance);
				log.info("Bound factory to JNDI name: " + name);
				[b]( (EventContext) ctx ).addNamingListener(name, EventContext.OBJECT_SCOPE, LISTENER);[/b]
			}
			catch (InvalidNameException ine) {
				log.error("Invalid JNDI name: " + name, ine);
			}
			catch (NamingException ne) {
				log.warn("Could not bind factory to JNDI", ne);
			}
			catch(ClassCastException cce) {
				log.warn("InitialContext did not implement EventContext");
			}

		}

	}

public static InitialContext getInitialContext(Properties props) throws NamingException {

		Hashtable hash = getJndiProperties(props);
		log.info("JNDI InitialContext properties:" + hash);
		try {
			return hash.size()==0 ?
					new InitialContext() :
					new InitialContext(hash);
		}
		catch (NamingException e) {
			log.error("Could not obtain initial context", e);
			throw e;
		}
	}


Mình đoán rằng InitialContext của JBoss không có implement EventContext. Để tránh được lỗi này thì phải download một gói nào đó của JBoss có hỗ trợ InitialContext mà có luôn EventContext. Mình đoán JbossJTA. Không biết có phải vậy không?
[Up] [Print Copy]
[digg] [delicious] [google] [yahoo] [technorati] [reddit] [stumbleupon]
Go to: 
 Users currently in here 
1 Anonymous

Powered by JForum - Extended by HVAOnline
 hvaonline.net  |  hvaforum.net  |  hvazone.net  |  hvanews.net  |  vnhacker.org
1999 - 2013 © v2012|0504|218|