2017-08-09 27 views
0
SEVERE: Exception sending context initialized event to listener instance of class [org.springframework.web.util.Log4jConfigListener] 
java.lang.IllegalStateException: Web app root system property already set to different value: 'webapp.root' = [C:\Users\SOMUN\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\wtpwebapps\CRUDWebAppMavenized\] instead of [C:\Users\SOMUN\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\wtpwebapps\Proje\] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files! 
    at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:144) 
    at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:117) 
    at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:45) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4633) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5095) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1425) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1415) 
    at java.util.concurrent.FutureTask.run(Unknown Source) 
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) 
    at java.util.concurrent.AbstractExecutorService.submit(Unknown Source) 
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941) 
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1425) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1415) 
    at java.util.concurrent.FutureTask.run(Unknown Source) 
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) 
    at java.util.concurrent.AbstractExecutorService.submit(Unknown Source) 
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941) 
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 
    at org.apache.catalina.startup.Catalina.start(Catalina.java:657) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355) 
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495) 

這是web-xml。我想我有這個部分的錯誤,但我找不到。我有這個錯誤,我無法解決它。我只是想從網上的oracle數據庫列表,但我不能

我有這部分錯誤,但我找不到。

<context-param> 
     <param-name>log4jConfigLocation</param-name> 
     <param-value>classpath:log4j.xml</param-value> 
    </context-param> 


    <listener> 
     <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> 
    </listener> 

    <servlet> 
     <servlet-name>spring</servlet-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>spring</servlet-name> 
     <url-pattern>/</url-pattern> 
    </servlet-mapping> 

    <welcome-file-list> 
    <welcome-file>index.html</welcome-file> 
    <welcome-file>index.htm</welcome-file> 
    <welcome-file>index.jsp</welcome-file> 
    <welcome-file>default.html</welcome-file> 
    <welcome-file>default.htm</welcome-file> 
    <welcome-file>default.jsp</welcome-file> 
    </welcome-file-list> 

</web-app> 
+0

搜索您的Web-XML進行「webAppRootKey」,除了說這是在錯誤發生的部分。您發送的web-xml文件的一部分不包含該部分。 – arkantos

+0

<的context-param> ​​webAppRootKey webapp.root 我添加這一點,但它並沒有改變。 –

+0

該例外說明您爲兩個不同的web-xml文件設置了相同的值。您應該檢查「C:\ Users \ SOMUN \ eclipse-workspace \ .metadata \ .plugins \ org.eclipse.wst.server.core \ tmp4 \ wtpwebapps \ CRUDWebAppMavenized \」中的web-xml文件和「[C:\ Users \ SOMUN \ eclipse-workspace \ .metadata \ .plugins \ org.eclipse.wst.server.core \ tmp4 \ wtpwebapps \ Proje \「,並給每個文件的webAppRootKey的參數值不同。 – arkantos

回答

0
package com.joseph.model; 

import javax.persistence.Column; 
import javax.persistence.Entity; 
import javax.persistence.GeneratedValue; 
import javax.persistence.GenerationType; 
import javax.persistence.Id; 


@Entity 
public class Student { 





@Id 
    @Column 
//for autonumber 
    private int studentId; 
    @Column 
    private String firstname; 
    @Column 
    private String lastname; 
    @Column 
    private int yearLevel; 

    public Student(){} 
    public Student(int studentId, String firstname, String lastname, 
      int yearLevel) { 
     super(); 
     this.studentId = studentId; 
     this.firstname = firstname; 
     this.lastname = lastname; 
     this.yearLevel = yearLevel; 
    } 
    public int getStudentId() { 
     return studentId; 
    } 
    public void setStudentId(int studentId) { 
     this.studentId = studentId; 
    } 
    public String getFirstname() { 
     return firstname; 
    } 
    public void setFirstname(String firstname) { 
     this.firstname = firstname; 
    } 
    public String getLastname() { 
     return lastname; 
    } 
    public void setLastname(String lastname) { 
     this.lastname = lastname; 
    } 
    public int getYearLevel() { 
     return yearLevel; 
    } 
    public void setYearLevel(int yearLevel) { 
     this.yearLevel = yearLevel; 
    } 


} 

- 我發現我錯了。我的模型類和我的數據庫表名稱不同。他們必須有相同的名字。

0

喜奧馬爾我能解決的問題:你是否會打開關閉:)

+0

這是一個答案? – ExDev

+0

非常感謝你Metin。它解決了。 –

+0

根本不是先生。祝你有美好的一天 –

相關問題