Hello,

I am a rookie in this framework.
Apache Maven 2.2.0 (r788681; 2009-06-26 15:04:01+0200)
AppFuse 2.0.2
Red Hat linux 5

I have created mvn archetype:create
-DarchetypeGroupId=org.appfuse.archetypes
-DarchetypeArtifactId=appfuse-basic-spring
-DremoteRepositories=http://static.appfuse.org/releases
-DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.admin
-DartifactId=myprojectadmin

After adding a new class LabPerson.java:

package com.mycompany.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Column;
import org.appfuse.model.BaseObject;

@Entity
@Table(name="lab_personnel", schema="public")
public class LabPerson extends BaseObject {
        private static final long serialVersionUID = -7866798599637987071L;
        private Long usr_id;
    private Long usr_login;
    private Long usr_role;
    private Long usr_tutor;
    private String first_name;
    private String last_name;
    private String usr_email;
    
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator =
"lab_personnel_usr_id_seq")
    @SequenceGenerator(name = "lab_personnel_usr_id_seq", sequenceName =
"lab_personnel_usr_id_seq")
    @Column(name = "usr_id", nullable = false)

    public Long getUsr_id() {
                return usr_id;
        }
        public void setUsr_id(Long usrId) {
                usr_id = usrId;
        }
        public Long getUsr_login() {
                return usr_login;
        }
        public void setUsr_login(Long usrLogin) {
                usr_login = usrLogin;
        }
        public Long getUsr_role() {
                return usr_role;
        }
        public void setUsr_role(Long usrRole) {
                usr_role = usrRole;
        }
        public Long getUsr_tutor() {
                return usr_tutor;
        }
        public void setUsr_tutor(Long usrTutor) {
                usr_tutor = usrTutor;
        }
        public String getFirst_name() {
                return first_name;
        }
        public void setFirst_name(String firstName) {
                first_name = firstName;
        }
        public String getLast_name() {
                return last_name;
        }
        public void setLast_name(String lastName) {
                last_name = lastName;
        }
        public String getUsr_email() {
                return usr_email;
        }
        public void setUsr_email(String usrEmail) {
                usr_email = usrEmail;
        }
        @Override
        public boolean equals(Object o) {
                // TODO Auto-generated method stub
                return false;
        }
        @Override
        public int hashCode() {
                // TODO Auto-generated method stub
                return 0;
        }
        @Override
        public String toString() {
                // TODO Auto-generated method stub
                return null;
        }

    /*
     Generate your getters and setters using your favorite IDE: 
     In Eclipse:
     Right-click -> Source -> Generate Getters and Setters
    */
}


, and running mvn appfuse:gen and :install -- (all of the i18n and menu and
UI tests were added now, see my previous post on modular-archetype
failures); -- the generated code fails during mvn install:
0. mvn install (or jetty:run-war) fail here:
...
[INFO] Configuration Properties file loaded:
/home/sledge/dev/myprojectadmin/target/classes/jdbc.properties
[INFO]
------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO]
------------------------------------------------------------------------
[INFO] could not instantiate id generator
Dialect does not support sequences
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.hibernate.MappingException: could not instantiate id generator
        at
org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:98)
        at
org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
        at
org.hibernate.cfg.Configuration.iterateGenerators(Configuration.java:710)
...

changing from GenerationType.SEQUENCE to IDENTITY helps, but postgresql
(mine is 8.3.1) requires SEQUENCE
(https://forums.hibernate.org/viewtopic.php?p=2273394&sid=bcaa6f716b71753c7ebae9be5e514469#p2273394),
and I have CREATEd all the required SEQUENCEs already, and my previous
manually built project
(http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html) works
with the same LabPerson.java as I used here but GenerationType.SEQUENCE in
it.

but, anyhow, after changing the line from
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator =
"lab_personnel_usr_id_seq")
into
    @GeneratedValue(strategy=GenerationType.IDENTITY, generator =
"lab_personnel_usr_id_seq")
this error does not appear anymore, and the following errors unwind:

1. mvn install starts correctly: runs through db tests (connects to existing
postgresql, which is contrary what jetty does afterwards), but fires an
error as a cause from the recently generated LabPerson entity:
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.mycompany.webapp.controller.LabPersonFormControllerTest
[myprojectadmin] INFO [main]
LabPersonFormControllerTest.loadContextLocations(57) | Loading additional
configuration from:
classpath:/applicationContext-resources.xml,classpath:/applicationContext-dao.xml,classpath:/applicationContext-service.xml,classpath*:/applicationContext.xml,/WEB-INF/applicationContext*.xml,/WEB-INF/dispatcher-servlet.xml
[myprojectadmin] ERROR [main] Digester.error(1538) | Parse Error at line 32
column 16: The content of element type "form" is incomplete, it must match
"(field)+".
org.xml.sax.SAXParseException: The content of element type "form" is
incomplete, it must match "(field)+".
        at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
        at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
        at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
        at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
...
...
SearchLabPersons:
[INFO] [talledLocalContainer] [myprojectadmin] WARN [http-8081-13]
PageNotFound.noHandlerFound(1068) | No mapping found for HTTP request with
URI [/myprojectadmin-1.0-SNAPSHOT/labPersons.html] in DispatcherServlet with
name 'dispatcher'
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error executing ant tasks

Embedded error: The following error occurred while executing this line:
/home/sledge/dev/myprojectadmin/src/test/resources/web-tests.xml:238: HTTP
error 404
404 Not Found for
http://localhost:8081/myprojectadmin-1.0-SNAPSHOT/labPersons.html
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1 minute 14 seconds
[INFO] Finished at: Fri Jul 17 19:12:40 CEST 2009
[INFO] Final Memory: 57M/63M
[INFO]
------------------------------------------------------------------------


2. jetty:run-war starts connecting to mysql database, even though
<activeByDefault>true</activeByDefault> sits in pom.xml under postgresql
from the very beginning:

java.net.ConnectException
MESSAGE: Connection refused

STACKTRACE:

java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
        at java.net.Socket.connect(Socket.java:519)
        at java.net.Socket.connect(Socket.java:469)
        at java.net.Socket.<init>(Socket.java:366)
        at java.net.Socket.<init>(Socket.java:209)
        at
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:173)
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:267)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:2739)
        at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
        at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
....

I have all of the configuration files (pom.xml etc) modified minimally --
that's why there is little sense pasting them here, since 99% are
auto-generated.
Tell me if you need more info;

With hope you can help me out in here!..

--&nbsp;
sledge
-- 
View this message in context: 
http://www.nabble.com/mvn-appfuse%3Agen-generates-failing-code-in-appfuse-basic-spring-archetype-tp24538818s2369p24538818.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to