Announcement Announcement Module
No announcement yet.
Getting 404 Error when deploying ROO project on Server in STS Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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..

    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 -

    CustomerController ->
    @RooWebScaffold(path = "customers", formBackingObject = Customer.class)
    public class CustomerController {
    Server Log message:
    Failed to instantiate SLF4J LoggerFactory
    Reported exception:
    java.lang.NoClassDefFoundError: org/apache/log4j/Level
        at org.slf4j.LoggerFactory.bind(
        at org.slf4j.LoggerFactory.performInitialization(
        at org.slf4j.LoggerFactory.getILoggerFactory(
        at org.slf4j.LoggerFactory.getLogger(
        at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(
        at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(
        at org.apache.commons.logging.LogFactory.getLog(
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(
        at org.apache.catalina.core.StandardContext.listenerStart(
        at org.apache.catalina.core.StandardContext$
        at org.apache.catalina.core.StandardContext$
        at java.util.concurrent.FutureTask$Sync.innerRun(
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
        at java.util.concurrent.ThreadPoolExecutor$
    Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
        at org.apache.catalina.loader.WebappClassLoader.loadClass(
        at org.apache.catalina.loader.WebappClassLoader.loadClass(
        ... 17 more
    Also "perform eclipse" command sys -
    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


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

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


      • #4

        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.


        • #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 - ""

          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.