0
votes

The first project that I using Spring. I didn't use Maven. Please, help me! I get error this. If you want to see my code, I will share it. Thank you.

**
27.Ağu.2015 09:39:17 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on

the java.library.path: C:\Program Files\Java\jre6\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:\Sybase\IQ-15_2\bin32;C:\Sybase\IQ-15_2\bin64;C:\Oracle\Administrator\product\client\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Enterprise Vault\EVClient\x64\;C:\Program Files (x86)\IBM\Personal Communications\;C:\Program Files (x86)\IBM\Trace Facility\;. 27.Ağu.2015 09:39:17 org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:springornek' did not find a matching property. 27.Ağu.2015 09:39:17 org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 27.Ağu.2015 09:39:17 org.apache.catalina.startup.Catalina load INFO: Initialization processed in 272 ms 27.Ağu.2015 09:39:17 org.apache.catalina.core.StandardService start INFO: Starting service Catalina 27.Ağu.2015 09:39:17 org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/6.0.44 27.Ağu.2015 09:39:17 org.apache.catalina.core.ApplicationContext log INFO: Marking servlet springornek as unavailable 27.Ağu.2015 09:39:17 org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /springornek threw load() exception java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) at org.springframework.web.servlet.DispatcherServlet.(DispatcherServlet.java:188) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1149) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4425) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060) at org.apache.catalina.core.StandardHost.start(StandardHost.java:822) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:759) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) 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:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 27.Ağu.2015 09:39:17 org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8080 27.Ağu.2015 09:39:17 org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 27.Ağu.2015 09:39:17 org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/10 config=null 27.Ağu.2015 09:39:17 org.apache.catalina.startup.Catalina start INFO: Server startup in 320 ms 27.Ağu.2015 09:39:19 org.apache.catalina.core.StandardWrapperValve invoke INFO: Servlet springornek is currently unavailable

**

3

3 Answers

0
votes

Reading your log says, apache commons logging classes are not found.. So add the jar of apache commons logging in your lib. Here you can get that jar http://mvnrepository.com/artifact/commons-logging/commons-logging

SEVERE: Servlet /springornek threw load() exception java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at

NOTE: Use maven or gradle to simplify building projects dependencies for you.

0
votes

You need to make sure you have all the required jar's in the lib directory.

the good part with maven it will pull all the versions you specify and put it into WEB-INF/lib

If you want to start without maven or gradle you should do things one step at a time. Make a simple web app with web.xml and then add 1 thing at a time.

Post your web.xml so that we can help you.

The below is nothing to be scared off for your local development but is just an info

The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on
0
votes
My web.xml is :

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4">
        <servlet>
            <servlet-name>springornek</servlet-name>
            <servlet-class>
                org.springframework.web.servlet.DispatcherServlet
            </servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>springornek</servlet-name>
            <url-pattern>*.htm</url-pattern>
        </servlet-mapping>
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
    </web-app>

My springornek-servlet is :

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
        <bean id="basitDenetimci" class="denetim.BasitDenetimci" />
        <bean id="urlEsleme"
            class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                <props>
                    <prop key="/index.htm">basitDenetimci</prop>
                </props>
            </property>
        </bean>
        <bean id="gorunumCozumleyici"
            class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="viewClass">
                <value>org.springframework.web.servlet.view.JstlView</value>
            </property>
            <property name="prefix">
                <value>/WEB-INF/jsp/</value>
            </property>
            <property name="suffix">
                <value>.jsp</value>
            </property>
        </bean>
    </beans>

My springornek Class is :

    package denetim;

    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.mvc.Controller;

    public class BasitDenetimci implements Controller{

        @Override
        public ModelAndView handleRequest(HttpServletRequest arg0,
                HttpServletResponse arg1) throws Exception {
            return new ModelAndView("basit");
        }

    }

My index.jsp is : 

    <%@ page contentType="text/html; charset=ISO-8859-9"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <c:redirect url="/index.htm"/>
    <html>
    <head>
    <title>Hello World</title>
    </head>
    <body>
        <h1>Hello World!</h1>
    </body>
    </html>

My basit.jsp is :

    <%@ page contentType="text/html; charset=ISO-8859-9"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9">
    <title>springornek</title>
    </head>
    <body>
        <h1>Welcome!</h1>
    </body>
    </html>

Jars that I using :

jstl-1.2.jar
jstl-api-1.2-sources.jar
jstl-connector-3.0.jar
spring.jar
spring-aop.jar
spring-beans-3.1.1.release-sources.jar
spring-context.jar
spring-core.jar
spring-dao.jar
spring-mock.jar
spring-orm.jar
spring-web.jar
spring-webmvc.jar