facebook

java.lang.NoClassDefFoundError – for MyBlogJSFJPAExample

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #290075 Reply

    prponnal
    Member

    I’m trying to modify the sample to use TABLE generation strategy for Id field by adding the following code to the Entity bean Post.

    // Property accessors
    @Id
    @TableGenerator(
    name=”id_gen”,
    table=”POST_SEQ_GEN”,
    schema=”MYBLOG”,
    pkColumnName=”ID”,
    valueColumnName=”NEXT_SEQ_NUM”,
    pkColumnValue=”101″,
    allocationSize=1)
    @GeneratedValue(generator=”id_gen”)
    @Column(name = “ID”, unique = true, nullable = false, insertable = true, updatable = true)
    public Integer getId() {
    return this.id;
    }

    I define a table called POST_SEQ_GEN as follows:

    create table “MYBLOG”.”POST_SEQ_GEN”(
    “ID” INTEGER not null,
    “NEXT_SEQ_NUM” INTEGER not null,
    constraint “SQL070512055014131” primary key (“ID”)
    );
    create unique index “SQL081019020022990” on “MYBLOG”.”POST_SEQ_GEN”(“ID”);

    I inserted values 101,1020 into the table POST_SEQ_GEN.

    When I run the sample, I see the following exception which I am not sure what it is about.

    exception

    javax.servlet.ServletException
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)

    root cause

    java.lang.NoClassDefFoundError
    com.myeclipseide.examples.myblog.jsf.PostController.saveCurrentPost(PostController.java:113)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.apache.el.parser.AstValue.invoke(AstValue.java:131)
    org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
    org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
    javax.faces.component.UICommand.broadcast(UICommand.java:383)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java

    I generated entity for the new table as well, that did not help.
    Any ideas as to what could be wrong?

    thanks

    #290128 Reply

    Loyal Water
    Member

    Moving to Off Topic >> Software Development.

    #290129 Reply

    Loyal Water
    Member

    You need to have 1 entity per table, and it looks like you created a POST_SEQ_GEN table that you most likely need to rev-gen, hence the ClassNotFoundException.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: java.lang.NoClassDefFoundError – for MyBlogJSFJPAExample

You must be logged in to post in the forum log in