Spring MVC Errors

#1

I try to import the project from the tutorial but when doing so I get errors:

1. https://i.imgur.com/tbIsj.png

and then when I try to start it anyways I get things like thaat:
2. https://i.imgur.com/G7UVu.png

any ideas ?

I installed m2eclipse plugin and Maven Integration for WTP and then I import Maven project from disk and this is what I get ... ;(

#2

ok, it works but I still have the error from picture 1. It works, on server like it should but in eclipse I still have a error like this:

 

Description Resource Path Location Type Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:exec-maven-plugin:1.2:java (execution: enhance, phase: process-classes) pom.xml /Guestbook line 91 Maven Project Build Lifecycle Mapping Problem

 

strange ... what should I do ?

#3

Please make sure that you are using the last ObjectDB version with the sample project that is bundled with that version, because from another issue that you reported it seems that you are currently using an old ObjectDB version.

ObjectDB Support
#4

1.) ok I switched to both newest version of ObjectDB and Spring Framework, however I still get error in Eclipse that points to pom.xml part (execution line):

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.2</version>
    <executions>
     <execution>
      <id>enhance</id>
      <phase>process-classes</phase>
      <goals>
       <goal>java</goal>
      </goals>
      <configuration>
       <mainClass>com.objectdb.Enhancer</mainClass>
       <arguments>
        <argument>guest.Guest</argument>
       </arguments>
      </configuration>
     </execution>
    </executions>
   </plugin>

this is the error:
Description Resource Path Location Type
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:exec-maven-plugin:1.2:java (execution: enhance, phase: process-classes) pom.xml /mces line 88 Maven Project Build Lifecycle Mapping Problem

 

2.) What is more I often get an error that query is using a closed EntityManager although I use that @Autowired and @PersistenceContext automatic one like in the Spring MVC Tutorial GuestBook...

 

3.) I'm using Tomcat and I don't get the last part of the tutorial:
"To enable on the fly automatic enhancement (weaving) in Tomcat it has to be run with ObjectDB as a Java agent (javaagent:objectdb.jar). When using GlassFish - on the fly enhancement (weaving) is automatically enabled without specifying a Java agent."

P.S: I was using ObjectDB for some time but I used it the way that in Controllers I was initializating new class that I made DBconn():

public class DBconn {
    private static String dbName = "mces_database.odb";
   
    private EntityManager em;

    public DBconn() {
em = Persistence
.createEntityManagerFactory(dbName).createEntityManager();
    }

    protected void finalize() {
        em.close();
    }

    public EntityManager getEm() {
        return em;
    }

    ....

}

this is how I used to get em:

EntityManager em = (new DBconn()).getEm();

This worked somehow but sometimes on lists of my db objects I got 2 elements sometimes 7 elements and sometimes not full data when it should show 8 elements every time so I decided to search objectDB site to search for a solution and then I found that spring Tutorial which I've never seen before so I figured I should do it the way that it is in this Tutorial but now it is worse...

#5
  1. You may remove enhancement from Maven if it causes troubles and use alternative methods (or no enhancement if performance is not an issue).
  2. The reason for this is unclear. It could be checked if you provide a simple demo project that demonstrates it.
  3. Run the Tomcat JVM with javaagent:objectdb.jar (see this page).
ObjectDB Support

Reply