我在Netbeans 7.2.1中擁有Java EE應用程序。嘗試部署它(建築物結束OK),我得到的Tomcat日誌中的錯誤:Java EE異常:在此上下文中未綁定名稱java:comp
Caused by: javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201)
at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1454)
尋找代碼,導致此錯誤,我發現如下:
public Object lookup(String name) throws NamingException {
return getURLOrDefaultInitCtx(name).lookup(name);
}
這是怎麼引起的我該如何解決它?
這將在Tomcat中的情況下,當你有某種原因發生在Web應用程序的'/ WEB-INF/lib'下降任意特定servletcontainer-JAR文件(這是一種常見的首發的錯誤來「修復」編譯錯誤)。是你做的嗎? – BalusC
我使用現成的應用程序,所以我可能會。 –
嗯好的。請用「是」或「否」確認。如果你完全不瞭解這些東西(如果你只是列出當前存在於webapp的'/ WEB-INF/lib'中的JAR文件,那麼它會很有幫助夾。人們可以指出哪些不屬於那裏。 – BalusC