javax.servlet.ServletException: выполнение фильтра вызвало исключение при весенней загрузке - PullRequest
0 голосов
/ 23 октября 2018

Когда я реализую метод hashCode () в классах Entity, я получаю следующую ошибку.Что это?

javax.servlet.ServletException: выполнение фильтра вызвало исключение в org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:200) в org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) в org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (CharacterEncodingFilter.java:197) в org.springfrailder.FidWFF) в org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193) в org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) в org.spr.wef.ErrorPageFilter.Ява: 105) в org.springframework.web.filter.OncePerRequestFilter..java: 193) по адресу org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) по адресу org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:1ap.cat.cat.cat.at.cat.at). orgcore.StandardContextValve.invoke (StandardContextValve.java:96) в org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java:478) в org.apache.catalina.core.StandardHostValvehvalve1в org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:81) в org.apache.catalina.valves.AbstractAccessLogValve.invoke (AbstractAccessLogValve.java:650) в org.apache.catalinainveve.core(StandardEngineValve.java:87) в org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:342) в org.apache.coyote.http11.Http11Processor.service (Http11Processor.java:803) в org.apache.coyote.AbstractProcessorLight.process (AbstractProcessorLight.javaapache в или.coyote.AbstractProtocol $ ConnectionHandler.process (AbstractProtocol.java:868) в org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun (NioEndpoint.java:1459) в org.apache.tomcat.util.net.SocketProcessorBase.run (SocketProcessorBase.java:49) в java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149) в java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:6g: 6tomcat.util.threads.TaskThread $ WrappingRunnable.run (TaskThread.java:61) в java.lang.Thread.run (Thread.java:748) Вызывается: java.lang.StackOverflowError в org.apache.tomcat.jdbc.pool.StatementFacade $ StatementProxy.invoke (StatementFacade.java:116) в com.sun.proxy. $ Proxy2212.executeQuery (Неизвестный источник) в org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.AbstractLoadPlanBasedLoader.java:186) в org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad (AbstractLoadPlanBasedLoader.java:121) в org.hibernate.loader.plan.exe.inaderLadLoLoader86) вorg.hibernate.loader.collection.plan.AbstractLoadPlanBasedCollectionInitializer.initialize (AbstractLoadPlanBasedCollectionInitializer.java:88) в org.hibernate.persister.collection.AbstractCollectionPersister.initial..onInitializeCollection (DefaultInitializeCollectionEventListener.java:75) в org.hibernate.internal.SessionImpl.initializeCollection (SessionImpl.java:1991) в org.hibernate.collection.internal.AbstractPersistentCollection $ 4.doavahh5.коллекция135) в org.hibernate.collection.internal.PersistentSet.hashCode (PersistentSet.java:430) в java.util.Arrays.hashCode (Arrays.java:4146) в java.util.Objects.hash (Objects.java:128) в net.fis.fava.model.Group..hashCode (Group.java:115) в java.util.HashMap.hash (HashMap.java:339) в java.util.HashMap.put (HashMap.java:612) в java.util.HashSet.add (HashSet.Java: 220) в java.util.AbstractCollection.addAll (AbstractCollection.java:344) в org.hibernate.collection.internal.PersistentSet.endRead (PersistentSet.java:327) в org.hibernate.engine.loading.internal.CollectionLoadContext.endLoadingCollection (CollectionLoadContext.java:234) в org.hibernate.engine.loading.internal.CollectionLoadContext.endLoadingCollections (CollectionLoadContext.java:221) в org.hibernate.engine.load..olo.LoLoLoLoO) в org.hibernate.loader.plan.exec.process.internal.CollectionReferenceInitializerImpl.endLoading (CollectionReferenceInitializerImpl.java:154) в org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.finishLoadingCollections (AbstractRowReader.java:249) в org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.finishUp (AbstractRowReader.java:212) в org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl.extractResults (ResultSetProcessorImpl.java:133) в org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad (AbstractLoadPlanBasedLoader.jternalg.plan.exe) или 12)AbstractLoadPlanBasedLoader.executeLoad (AbstractLoadPlanBasedLoader.java:86) в org.hibernate.loader.collection.plan.AbstractLoadPlanBasedCollectionInitializer.initialize (AbstractLoadPlanBasedCollection.itial.jersersolol.PollectionAitв org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection (DefaultInitializeCollectionEventListener.java:75) в org.hibernate.internal.SessionImpl.initializeCollection (SessionImpl.java:1991) в org.hibernate.collection.internal.AbstractPersistentCollection $ 4.doWork (AbstractPersistentCollection.java:570) в org.hibernate.collection.internal.AbstractPersistentCollection.withTegotiSolg.hibernate.collection.internal.AbstractPersistentCollection.initialize (AbstractPersistentCollection.java:566) в org.hibernate.collection.internal.AbstractPersistentCollection.read (AbstractPersistentCollection.java:135) в org.hibernate.collection.internal.Het.java: 430) в java.util.Arrays.hashCode (Arrays.java:4146) в java.util.Objects.hash (Objects.java:128) в net.fis.model.Activity.hashCode (Activity.java:146) в java.util.HashMap.hash (HashMap.java:339) вjava.util.HashMap.put (HashMap.java:612) в java.util.HashSet.add (HashSet.java:220).,,,.

1 Ответ

0 голосов
/ 24 октября 2018

Это также экземпляр класса Entity:

@Entity
@Table(name = "TBL_ACTIVITY", uniqueConstraints = { @UniqueConstraint(columnNames = "ROLE", name = "ROLE_UN") })
public class Activity implements Serializable, Comparable<Activity> {

    private static final long serialVersionUID = 2312346871583335007L;

    private Long activityId;

    private String role;
    private String description;

    private Activity parent;

    private Set<Group> groups = new HashSet<>(0);
    private Set<Activity> children = new HashSet<>(0);

    public Activity() {}

    public Activity(String role, String description) {
        this.role = role;
        this.description = description;
    }

    public Activity(String role, String description, Activity parent) {
        this.role = role;
        this.description = description;

        this.parent = parent;
    }

    public Activity(String role, String description, Activity parent, Set<Group> groups, Set<Activity> children) {
        this.role = role;
        this.description = description;

        this.parent = parent;

        this.groups = groups;
        this.children = children;
    }

    @Id
    @SequenceGenerator(name = "FIS_SEQ", sequenceName = "FIS_SEQ")
    @GeneratedValue(generator = "FIS_SEQ")
    @Column(name = "ACTIVITY_ID", nullable = false, unique = true, precision = 19)
    public Long getActivityId() {
        return activityId;
    }

    public void setActivityId(Long activityId) {
        this.activityId = activityId;
    }

    @Column(name = "ROLE", nullable = false, length = 100)
    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    @Column(name = "DESCRIPTION", length = 100)
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PARENT_ID")
    public Activity getParent() {
        return parent;
    }

    public void setParent(Activity parent) {
        this.parent = parent;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parent")
    public Set<Activity> getChildren() {
        return children;
    }

    public void setChildren(Set<Activity> children) {
        this.children = children;
    }

    @ManyToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH} ,fetch = FetchType.LAZY, mappedBy = "activities")
    public Set<Group> getGroups() {
        return groups;
    }

    public void setGroups(Set<Group> groups) {
        this.groups = groups;
    }

    @Override
    public int compareTo(Activity o) {
        return Integer.compare(Integer.valueOf(String.valueOf(this.activityId)), Integer.valueOf(String.valueOf(o.getActivityId())));
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Activity activity = (Activity) o;
        return Objects.equals(activityId, activity.activityId) &&
                Objects.equals(role, activity.role) &&
                Objects.equals(description, activity.description) &&
                Objects.equals(parent, activity.parent) &&
                Objects.equals(groups, activity.groups) &&
                Objects.equals(children, activity.children);
    }

    @Override
    public int hashCode() {
        return Objects.hash(activityId, role, description, parent, groups, children);
    }

    @Override
    public String toString() {
        return "Activity { " +
                "activityId = " + activityId +
                ", role = '" + role + '\'' +
                ", description = '" + description + '\'' +
                ", parent = " + parent +
                ", groups = " + groups +
                ", children = " + children +
                " }";
    }

}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...