Announcement Announcement Module
Collapse
No announcement yet.
Getting 404 Error when deploying ROO project on Server in STS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting 404 Error when deploying ROO project on Server in STS

    I was following tutorial from "Getting Started with Roo" book and everthing went fine until I began moving project root to server, when error 404 is coming..

    Code:
    persistence setup --provider HIBERNATE --database MYSQL --userName root --password
    entity --class ~.model.Customer
    field string --fieldName lastName --notNull
    field string --fieldName firstName --notNull
    database reverse engineer --package ~.domain --schema rootest
    controller scaffold --entity ~.domain.Customer --class ~.web.CustomerController
    scaffold command ended successfully, I am not able to undersnand why this URL is giving 404 error -
    http://localhost:8080/crm/customers

    CustomerController ->
    Code:
    @RooWebScaffold(path = "customers", formBackingObject = Customer.class)
    @RequestMapping("/customers")
    @Controller
    public class CustomerController {
    }
    Server Log message:
    Code:
    Failed to instantiate SLF4J LoggerFactory
    Reported exception:
    java.lang.NoClassDefFoundError: org/apache/log4j/Level
        at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
        at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
        at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
        at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
        at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:272)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
        at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
        at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
        ... 17 more
    Also "perform eclipse" command sys -
    Code:
    Cannot run program "mvn.bat" (in directory "C:\Users\viji\Documents\workspace-sts-2.8.1.RELEASE\crm"): CreateProcess error=2, The system cannot find the file specified
    Last edited by fortm; Mar 4th, 2012, 02:19 PM.

  • #2
    OK.. i was able to workaround this by first manually adding log4j jar to library with same version as before.
    Then, somehow tc server is not able to run the project that I created.

    So, ran it as a maven build with command as "-e clean tomcat:run" and it runs..

    But, there is another thing I have to fix.
    When I run project for first time, tables were created for different entities. But, data is not persisted between runs.
    So, closing tomcat and running a new is creating new tables and deleting data every time stored from before.

    Please suggest on this.

    I have 2 controllers - PageController and ArticleContoller.
    So, there are 2 entity - articles and pages

    Comment


    • #3
      I think I am replying myself ..
      Anways, since I figured out solution for persistence, I am posting it here -

      I changed "hibernate.hbm2ddl.auto" property from create to validate as below -
      Code:
                  <property name="hibernate.hbm2ddl.auto" value="validate"/>
      This ensures that data is not deleted between runs.

      Comment


      • #4
        Try:

        Code:
        C:\Users\viji>mvn -version
        If you see something like:

        Apache Maven 3.0.2 (r...)
        Java version: 1.6.0, vendor: ...
        Java home: C:\Program Files\Java\jdk1.6.0_...
        Default locale: es_ES, ...
        OS name: "windows vista"...
        I don't know the problem.

        Otherwise, install maven (or add the mvn.pat to the PATH), because it's necessary for Roo.

        In STS, the maven plugin adds a Maven library that contains the maven dependencies as JARs, so you don't need to add them manually. In fact, in a web application they will be included in the war file, in the WEB-INF/lib (unless you avoid it with some configurations in the maven-war-plugin).

        Because in STS with the maven plugin you can (right button click):
        1.- Configure your project as a maven project.
        2.- Update project configuration (and dependencies)
        3.- Add the project to the TC Server that comes with STS
        4.- Deploy, run, and go to http://localhost:8080/crm/customers

        I hope it helps you.

        Comment


        • #5
          Thanks jbbarque As soon as I added path for maven in Environment Path and then also had to add JAVA_HOME ,internal server started working. I had to also do "update Maven Project Configuration" for the project. But, I am faced with anoher problem for which I opened a thread - "http://forum.springsource.org/showthread.php?123870-Unable-to-run-database-reverse-engineer"

          To start with, I am not able to do - "database introspect --schema rootest"
          Even though it was working before. I had once successfully reverse enginner using ROO.
          Then, I deleted those classes. It is not working now asking me to install same extension every time..
          Last edited by fortm; Mar 5th, 2012, 07:33 AM.

          Comment

          Working...
          X