EzDevInfo.com

vraptor

Simple Java Web MVC Framework VRaptor 4 - Home

Integrating deltaspike with vraptor

I have one project work with Vraptor 4 and i want to use deltaspike jpa and data modules to perform some operations. I need to deploy the application in tomcat 7+. Is it possible to integrate vraptor with deltaspike ?

Also i do not want to use vraptor-jpa or vraptor-hibernate plugin.


Source: (StackOverflow)

Arrays in raptor

How can I store an array in my raptor program so I can refer to it for the entire program?

This is what the program's output should look like:

Day               Calories Consumed               Calories Burned
Monday               2600                              150
Tuesday              2400                              100

Source: (StackOverflow)

Advertisements

Vraptor @Put brings null objects

I'm trying to update an object using the @Put instead of @Post The problem is, if i try with @Put Vraptor won't bring me my User object, but if i do a Post it will, without the object i cant update it, and i don't want to be updating something with @Post...

My method is:

    @Post("/update/{id}")
    //@Put("/update/{id}")
    public void update(long id,@Valid User user){
        user.setId(id);
        validator.onErrorForwardTo(this).formUpdate(user);

        user = dao.update(user);

        result.redirectTo(this).formUpdate(user);
    }

I am able to achiev both, but when using PUT the user comes null.

btw, i'm submitting the form via javascript


Source: (StackOverflow)

is this a good way to template my site

im planning to do something using bootstrap, where i will split the .jsp in 2 divs, the top one is the menubar.jsp and the other is the contentclicked eg:

start.jsp

<div id="menubar"></div>
<div id="content"></div>

when the users get access(after a login) and go to the http://www.localhost.com/restrict/start

it will run this .js

$(document).ready(function(){
    $("#menubar").load("restrict/menubar");        
});

the /restrict/menubar is because i have a file called menu.jsp that have the bootstrap code of the menubar and for each link that the client click in the menubar it will do:

$("#content").load("restrict/linkCliked");     

and for each link i will have a linkCliked.jsp

it seems to work, BUT i dont know if this is a good way and secure, because if the use write the uri http://www.localhost.com/restrict/linkCliked, he will get just the linkClicked.jsp, but i want it to render the menubar.jsp too without, is there any solution that i dont have to "include" in each .jsp the menubar?

obs: using VRaptor MVC


Source: (StackOverflow)

How to download xls file by ajax

I'm doing a direct download xls via Ajax and VRaptor, VRaptor makes your paper straight and provides the file as code below:

public Download geraExcel() {
 File arquivo = //generate file 
 return new FileDownload(file, "MyFile.xls", "application/vnd.ms-excel", true);
}

The problem is to receive this file in the success of ajax, I have a code that does this and it works perfectly for txt, the problem is that the xls opens corrupted and I'm a long time researching solutions to get around, all were unsuccessful, the continuing file corrupted. If anyone knows another way to make it work I thank you. Ajax.success following code:

success: function(response, status, xhr) {
    // check for a filename
    var filename = "";
    var disposition = xhr.getResponseHeader('Content-Disposition');
    if (disposition && disposition.indexOf('attachment') !== -1) {
        var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
        var matches = filenameRegex.exec(disposition);
        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
    }

    var type = xhr.getResponseHeader('Content-Type');
    var blob = new Blob([response], { type: type });

    if (typeof window.navigator.msSaveBlob !== 'undefined') {
        // IE workaround for "HTML7007: One or more blob URLs were revoked by closing the blob for which they were created. These URLs will no longer resolve as the data backing the URL has been freed."
        window.navigator.msSaveBlob(blob, filename);
    } else {
        var URL = window.URL || window.webkitURL;
        var downloadUrl = URL.createObjectURL(blob);

        if (filename) {
            // use HTML5 a[download] attribute to specify filename
            var a = document.createElement("a");
            // safari doesn't support this yet
            if (typeof a.download === 'undefined') {                
                window.location = downloadUrl;
            } else {
                a.href = downloadUrl;
                a.download = filename;
                document.body.appendChild(a);
                a.click();

                //Here is the problem, the original is about 15k,  
                // but the download file is about 26K

            }
        } else {                    
            window.location = downloadUrl;
        }

        setTimeout(function () { URL.revokeObjectURL(downloadUrl); }, 100); // cleanup
    }
}

Source: (StackOverflow)

Modularized System

I'm refactoring an application at my work and we have a problem with its modules, the web-app has some modules but they are all together at moment, for example, if we need to update 1 of its module we need to shutdown all of em (just one project with all modules) and update the module.

The refactoring or in better words, the new application will keep basically the same rules but i need to make it in modules where i can shutdown 1 of em and don't impact the others when its possible.

The system is for managing Callcenter with a PABX IP and asterisk, so basically we have the following modules:

  1. Core (Hold all the business logic and Persistence Info) is possible to break the logic and persistence info in two modules or better stay as it is now?
  2. AMI - Interacts with Asterisk listening to event and execute some actions to collect data and make calls
  3. AGI - Answer the asterisk calls and execute business logic, depends on Core and AMI
  4. Three independent integrations with third part softwares, depends on nothing withing our system
  5. Web-Module, Provide access to configuration, reports and panels for agents work

Today all these modules are in just one project and i can't simple split them, thats why i'm refactoring.

The major problem is, most of times we need to update web-module with new features or some corrections for bugs, but when we do it we stop all the callcenter for just that, and its not good, clients get mad and blame the system... etc.

On the new project i'll use VRaptor 4 + EJB because some clientes will use cluster due to performance and high availability

I was doing some tests and i got some problems, for example, in which module should i keep my persistence.xml for JPA? Core should be a deploy and call the EJB services using remote ? Is possible to use CDI to inject remote EJB from another deploy, how can i do that?

I wanna listen your opinion about how to make it the best so we here can maintain it the easy way.

Thx !


Source: (StackOverflow)

Error in same project in another machine

im just trying to run a test project, but i cant understand why it return this errors, its the same computer configuration

Firewall OFF Eclipse Kepler SR1 32bits (the same in the other computer) JRE7 32bits JDK7 32bits Maven 3.2.1 JBoss from Eclipse Market

i just imported the zip but look the errors: http://i.stack.imgur.com/lphI3.png enter image description here

where it ask for the vraptor-jpa, the version in this pom is the same that is working in this project in other machine, why it has a lot of errors for the SAME THING?

solved some problems by removing the reference to a old .jar and deleting the .m2 folder, not i ended with this:

http://i.stack.imgur.com/gRFll.png enter image description here


Source: (StackOverflow)

VRaptor - Guice Creation Errors

i cant understand why this error dont go away i tryed several things like using all version of hibernate-entitymanager, adding the vraptor-jpa 1.0, but nothing works:

ERROR:

21:58:20,041 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /vraptor/: com.google.inject.CreationException: Guice creation errors:

1) No implementation for javax.persistence.EntityManager was bound.
  while locating javax.persistence.EntityManager
    for parameter 0 at vraptor.UsuarioDao.<init>(UsuarioDao.java:14)
  at br.com.caelum.vraptor.ioc.guice.GuiceComponentRegistry.bindToConstructor(GuiceComponentRegistry.java:151)

1 error
    at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435) [guice-3.0.jar:]
    at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:154) [guice-3.0.jar:]
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106) [guice-3.0.jar:]
    at com.google.inject.Guice.createInjector(Guice.java:95) [guice-3.0.jar:]
    at com.google.inject.Guice.createInjector(Guice.java:83) [guice-3.0.jar:]
    at br.com.caelum.vraptor.ioc.guice.GuiceProvider.start(GuiceProvider.java:97) [vraptor-3.5.3.jar:]
    at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:119) [vraptor-3.5.3.jar:]
    at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:113) [vraptor-3.5.3.jar:]
    at io.undertow.servlet.core.ManagedFilter.getFilter(ManagedFilter.java:69) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
...

The IndexController.java:

package vraptor;
    import br.com.caelum.vraptor.Path;
    import br.com.caelum.vraptor.Post;
    import br.com.caelum.vraptor.Resource;
    import br.com.caelum.vraptor.Result;

    @Resource
    public class IndexController {

      private final Result result;
      private final UsuarioDao userDao;

      public IndexController(Result result, UsuarioDao userDao) {
        this.result = result;
        this.userDao= userDao;
      }

      @Path("/")
      public void index() {}

      @Post @Path("/cadastro")
      public void cadastro(Usuario usuario){


          //System.out.println(usuario);

          this.userDao.InsertUser(usuario);
          this.result.forwardTo(IndexController.class).index();
      }
    }

the UsuarioDAO

package vraptor;
import javax.persistence.EntityManager;

import br.com.caelum.vraptor.ioc.Component;


@Component
public class UsuarioDao {

    //private EntityManager em = new EntityManagerCreator().getInstance();

    private EntityManager em;

    public UsuarioDao(EntityManager em){
        this.em = em;
    }

    public void InsertUser(Usuario usuario) {
        try{
            this.em.persist(usuario);
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}

the Usuario.java

package vraptor;
 import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;


    @Entity
    public class Usuario {

        @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
        private long idUsuario;
        private String nome;
        private String sobreNome;

        public long getIdUsuario() {
            return idUsuario;
        }

        public void setIdUsuario(long idUsuario) {
            this.idUsuario = idUsuario;
        }

        public String getNome() {
            return nome;
        }

        public void setNome(String nome) {
            this.nome = nome;
        }

        public String getSobreNome() {
            return sobreNome;
        }

        public void setSobreNome(String sobreNome) {
            this.sobreNome = sobreNome;
        }
    }

the persistence:

<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  <persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>vraptor.Usuario</class>
    <properties>
      <property name="hibernate.connection.username" value="postgres"/>
      <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
      <property name="hibernate.connection.password" value="12345"/>
      <property name="hibernate.connection.url" value="jdbc:postgresql://localhost/teste"/>
      <property name="hibernate.connection.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
      <property name="hibernate.hbm2ddl.auto" value="update"/>
      <property name="hibernate.show.sql" value="false"/>
      <property name="hibernate.format.sql" value="false"/>
   </properties>
  </persistence-unit>
</persistence>

and the pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>modelo0</groupId>
    <artifactId>modelo0</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <dependencies>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.2.5</version>
        </dependency>
        <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.1-901.jdbc4</version>
        </dependency>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>4.3.4.Final</version>
</dependency>
<dependency>
    <groupId>br.com.caelum</groupId>
    <artifactId>vraptor</artifactId>
    <version>3.5.3</version>
</dependency>
</dependencies>

    <properties>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>
</project>

Source: (StackOverflow)

Send data from view to controller

Hi i'm using a brazillian framework called Vraptor and now I have a object in my JSP

${solicitacao }

And now i want to send this object to the controller or back-end without need add inputs to put the information of the object.


Source: (StackOverflow)

Conversion error not return full name in category

I implemented a simple post ajax in vraptor4, when send a value with conversion proble (Example: my field is integer and sent a string) the category in errors has not the fullname how said in documentation.

"category: represents the full path of the attribute like object.attribute"

Real example:

  • field name: rodapeForm.nro
  • category returned: nro

Source: (StackOverflow)

Is it possible to use CDI with VRaptor?

Is it possible to use CDI as dependendcy injection container for VRaptor framework?


Source: (StackOverflow)

How to Deploy in Heroku using VRaptor

Developed a project using VRaptor in development environment (using Eclipse) had no problem.

However when trying to do a deploy on Heroku an error occurs in which I am not able to play in the development environment.

2013-02-13T13:36:01+00:00 heroku[web.1]: State changed from crashed to starting
2013-02-13T13:36:05+00:00 heroku[web.1]: Starting process with command `${PRE_JAVA}java ${JAVA_OPTS} -jar webapp-runner-7.0.34.0.jar --port ${PORT} ${WEBAPP_RUNNER_OPTS} teste.war`
2013-02-13T13:36:06+00:00 app[web.1]: Adding Context / for teste.war
2013-02-13T13:36:08+00:00 app[web.1]: Feb 13, 2013 1:36:08 PM org.apache.coyote.AbstractProtocol init
2013-02-13T13:36:08+00:00 app[web.1]: INFO: Initializing ProtocolHandler ["http-nio-57620"]
2013-02-13T13:36:08+00:00 app[web.1]: Feb 13, 2013 1:36:08 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
2013-02-13T13:36:08+00:00 app[web.1]: INFO: Using a shared selector for servlet write/read
2013-02-13T13:36:08+00:00 app[web.1]: Feb 13, 2013 1:36:08 PM org.apache.catalina.core.StandardService startInternal
2013-02-13T13:36:08+00:00 app[web.1]: INFO: Starting service Tomcat
2013-02-13T13:36:08+00:00 app[web.1]: Feb 13, 2013 1:36:08 PM org.apache.catalina.core.StandardEngine startInternal
2013-02-13T13:36:08+00:00 app[web.1]: INFO: Starting Servlet Engine: Apache Tomcat/7.0.34
2013-02-13T13:36:09+00:00 app[web.1]: Feb 13, 2013 1:36:09 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
2013-02-13T13:36:09+00:00 app[web.1]: INFO: validateJarFile(/app/target/tomcat.57620/work/Tomcat/localhost/_/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
2013-02-13T13:36:09+00:00 app[web.1]: Feb 13, 2013 1:36:09 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
2013-02-13T13:36:09+00:00 app[web.1]: INFO: No global web.xml found
2013-02-13T13:36:09+00:00 heroku[web.1]: State changed from starting to up
2013-02-13T13:36:17+00:00 app[web.1]: log4j:ERROR No appender named [rolling-file] could be found.
2013-02-13T13:36:17+00:00 app[web.1]: 13:36:17,288  INFO [BasicConfiguration  ] Using class br.com.caelum.vraptor.ioc.spring.SpringProvider as Container Provider
2013-02-13T13:36:17+00:00 app[web.1]: 13:36:17,288 [localhost-startStop-1] INFO  BasicConfiguration - Using class br.com.caelum.vraptor.ioc.spring.SpringProvider as Container Provider
2013-02-13T13:36:17+00:00 app[web.1]: 13:36:17,303  INFO [DefaultSpringLocator] No application context found
2013-02-13T13:36:17+00:00 app[web.1]: 13:36:17,303 [localhost-startStop-1] INFO  DefaultSpringLocator - No application context found
2013-02-13T13:36:17+00:00 app[web.1]: 13:36:17,367  INFO [BasicConfiguration  ] br.com.caelum.vraptor.scanning = null
2013-02-13T13:36:17+00:00 app[web.1]: 13:36:17,367 [localhost-startStop-1] INFO  BasicConfiguration - br.com.caelum.vraptor.scanning = null
2013-02-13T13:36:17+00:00 app[web.1]: 13:36:17,367  INFO [WebAppBootstrapFactory] Dynamic WebAppBootstrap found.
2013-02-13T13:36:17+00:00 app[web.1]: 13:36:17,367 [localhost-startStop-1] INFO  WebAppBootstrapFactory - Dynamic WebAppBootstrap found.
2013-02-13T13:36:17+00:00 app[web.1]: Feb 13, 2013 1:36:17 PM org.apache.catalina.core.StandardContext filterStart
2013-02-13T13:36:17+00:00 app[web.1]: SEVERE: Exception starting filter vraptor
2013-02-13T13:36:17+00:00 app[web.1]: br.com.caelum.vraptor.scan.ScannerException: Could not determine WEB-INF/classes location
2013-02-13T13:36:17+00:00 app[web.1]:  at br.com.caelum.vraptor.scan.WebBasedClasspathResolver.findWebInfClassesLocation(WebBasedClasspathResolver.java:58)
2013-02-13T13:36:17+00:00 app[web.1]:  at br.com.caelum.vraptor.scan.ScannotationComponentScanner.scan(ScannotationComponentScanner.java:50)
2013-02-13T13:36:17+00:00 app[web.1]:  at br.com.caelum.vraptor.scan.WebAppBootstrapFactory.scannerFor(WebAppBootstrapFactory.java:81)
2013-02-13T13:36:17+00:00 app[web.1]:  at br.com.caelum.vraptor.scan.WebAppBootstrapFactory.create(WebAppBootstrapFactory.java:51)
2013-02-13T13:36:17+00:00 app[web.1]:  at br.com.caelum.vraptor.ioc.spring.SpringProvider.start(SpringProvider.java:83)
2013-02-13T13:36:17+00:00 app[web.1]:  at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:108)
2013-02-13T13:36:17+00:00 app[web.1]:  at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:102)
2013-02-13T13:36:17+00:00 app[web.1]:  at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:278)
2013-02-13T13:36:17+00:00 app[web.1]:  at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:259)
2013-02-13T13:36:17+00:00 app[web.1]:  at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:383)
2013-02-13T13:36:17+00:00 app[web.1]:  at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:104)
2013-02-13T13:36:17+00:00 app[web.1]:  at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
2013-02-13T13:36:17+00:00 app[web.1]:  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
2013-02-13T13:36:17+00:00 app[web.1]:  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2013-02-13T13:36:17+00:00 app[web.1]:  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
2013-02-13T13:36:17+00:00 app[web.1]:  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
2013-02-13T13:36:17+00:00 app[web.1]:  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
2013-02-13T13:36:17+00:00 app[web.1]:  at java.util.concurrent.FutureTask.run(FutureTask.java:166)
2013-02-13T13:36:17+00:00 app[web.1]:  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
2013-02-13T13:36:17+00:00 app[web.1]:  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
2013-02-13T13:36:17+00:00 app[web.1]:  at java.lang.Thread.run(Thread.java:636)
2013-02-13T13:36:17+00:00 app[web.1]: Caused by: br.com.caelum.vraptor.scan.ScannerException: Could not locate web.xml. Please use the proper argument in command-line.
2013-02-13T13:36:17+00:00 app[web.1]:  at br.com.caelum.vraptor.scan.StandaloneClasspathResolver.getWebxml(StandaloneClasspathResolver.java:139)
2013-02-13T13:36:17+00:00 app[web.1]:  at br.com.caelum.vraptor.scan.StandaloneClasspathResolver.findWebInfClassesLocation(StandaloneClasspathResolver.java:72)
2013-02-13T13:36:17+00:00 app[web.1]:  at br.com.caelum.vraptor.scan.WebBasedClasspathResolver.findWebInfClassesLocation(WebBasedClasspathResolver.java:55)
2013-02-13T13:36:17+00:00 app[web.1]:  ... 20 more
2013-02-13T13:36:17+00:00 app[web.1]: Feb 13, 2013 1:36:17 PM org.apache.catalina.core.StandardContext startInternal
2013-02-13T13:36:17+00:00 app[web.1]: SEVERE: Error filterStart
2013-02-13T13:36:17+00:00 app[web.1]: Feb 13, 2013 1:36:17 PM org.apache.catalina.core.StandardContext startInternal
2013-02-13T13:36:17+00:00 app[web.1]: SEVERE: Context [/] startup failed due to previous errors
2013-02-13T13:36:17+00:00 app[web.1]: SEVERE: Context [/] failed in [org.apache.catalina.core.StandardContext] lifecycle. Allowing Tomcat to shutdown.
2013-02-13T13:36:17+00:00 app[web.1]: Feb 13, 2013 1:36:17 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
2013-02-13T13:36:17+00:00 app[web.1]: SEVERE: The web application [/] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2013-02-13T13:36:17+00:00 app[web.1]: Feb 13, 2013 1:36:17 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
2013-02-13T13:36:17+00:00 app[web.1]: SEVERE: The web application [/] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
2013-02-13T13:36:17+00:00 app[web.1]: Feb 13, 2013 1:36:17 PM org.apache.coyote.AbstractProtocol start
2013-02-13T13:36:17+00:00 app[web.1]: INFO: Starting ProtocolHandler ["http-nio-57620"]
2013-02-13T13:36:19+00:00 heroku[web.1]: Process exited with status 0
2013-02-13T13:36:19+00:00 heroku[web.1]: State changed from up to crashed

Source: (StackOverflow)

Upgrade vRaptor to 3.5.3 java.lang.NoClassDefFoundError: br/com/caelum/vraptor/validator/Validator

I have trouble when update my pom.xml for upgrade some jars, like vraptor and hibernate... My environment is, Web project, maven, tomcat 7, vraptor , jpa, osx mavericks, before update jars, all work's fine, after the update i got this error on start tomcat:

SEVERE: Exception starting filter vraptor
java.lang.NoClassDefFoundError: br/com/caelum/vraptor/validator/Validator
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2483)
at java.lang.Class.getDeclaredConstructors(Class.java:1891)
at br.com.caelum.vraptor.ioc.guice.GuiceComponentRegistry.getConstructor(GuiceComponentRegistry.java:154)
at br.com.caelum.vraptor.ioc.guice.GuiceComponentRegistry.bindToConstructor(GuiceComponentRegistry.java:140)
at br.com.caelum.vraptor.ioc.guice.GuiceComponentRegistry.register(GuiceComponentRegistry.java:84)
at br.com.caelum.vraptor.ioc.guice.GuiceComponentRegistry.deepRegister(GuiceComponentRegistry.java:101)
at br.com.caelum.vraptor.scan.DynamicWebAppBootstrap.configure(DynamicWebAppBootstrap.java:46)
at br.com.caelum.vraptor.ioc.guice.GuiceProvider$2.configure(GuiceProvider.java:123)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.spi.Elements.getElements(Elements.java:101)
at com.google.inject.spi.Elements.getElements(Elements.java:92)
at com.google.inject.util.Modules$RealOverriddenModuleBuilder$1.configure(Modules.java:172)
at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.spi.Elements.getElements(Elements.java:101)
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.google.inject.Guice.createInjector(Guice.java:83)
at br.com.caelum.vraptor.ioc.guice.GuiceProvider.start(GuiceProvider.java:97)
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:119)
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:113)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4797)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5473)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.ClassNotFoundException: br.com.caelum.vraptor.validator.Validator
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
... 36 more

about the error I found this interface in other package: br.com.caelum.vraptor.Validator here is my pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.eco</groupId>
<artifactId>e-co</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.vraptor.version>3.5.3</project.vraptor.version>
</properties>

<build>
    <sourceDirectory>src</sourceDirectory>
    <finalName>${project.artifactId}-${project.version}</finalName>
    <resources>
        <resource>
            <directory>src</directory>
            <includes>
                <include>**/*.properties</include>
            </includes>
            <filtering>true</filtering>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1-beta-1</version>
            <configuration>
                <webappDirectory>${project.basedir}/WebContent</webappDirectory>
                <warSourceDirectory>${project.basedir}/WebContent</warSourceDirectory>
                <webXml>${project.basedir}/WebContent/WEB-INF/web.xml</webXml>
                <packagingIncludes>**/*.properties,**/*.jsp,**/*.jar,**/*.class,theme/**/*,images/**/*,**/*.xml,**/*.swf,**/*.tld,**/*.txt</packagingIncludes>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <phase>process-sources</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>WebContent/WEB-INF/lib/</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>br.com.caelum</groupId>
        <artifactId>vraptor</artifactId>
        <version>${project.vraptor.version}</version>
        <optional>true</optional>
        <scope>compile</scope>
        <exclusions>
            <exclusion>
                <groupId>javassist</groupId>
                <artifactId>javassist</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>br.com.caelum.vraptor</groupId>
        <artifactId>vraptor-environment</artifactId>
        <version>1.1.2</version>
    </dependency>

    <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.2.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.3.0.Final</version>
    </dependency>
    <dependency>
        <groupId>br.com.caelum.vraptor</groupId>
        <artifactId>vraptor-jpa</artifactId>
        <version>4.0.0</version> <!-- or the latest version -->
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-c3p0</artifactId>
        <version>4.3.0.Final</version>
    </dependency>
</dependencies>
</project>

I really can't find any reason for this, if someone have this trouble and can solved please help-me on this situation. Cheers


Source: (StackOverflow)

A field of type "String" does not appear in the result (json) serialization of the vraptor controller

A field of type "String" does not appear in the result of the serialization controller

result.use(Results.json()).indented().from(list).serialize();

Some fields appear, and another not appear when null, the field I want is to type "String" and implemented the "get" and "sets" and this always filled

PS: I am using vraptor framework


Source: (StackOverflow)

vraptor/weld project only works on mac

the very same codebase works with no errors on the same tomcat version, just java version remains as the main difference.

This stacktrace [ http://pastebin.com/cPCTJGw4 ] is all that i got when i tried to run the project on fedora with java 7 (openjdk-1.7 from fedora repository).

I've already tried to change vraptor version, but it was useless.

Since my production environment does not run mac os, i need it working on fedora linux as well.

Any guidance is welcome.


Source: (StackOverflow)