Servlet exception + class exception + Glassfish + Netbeans + JPA Entities + Vaadin exception

I get this error:

StandardWrapperValve [Vaadin Servlet]: PWC1406: Servlet.service () for the servlet. Vaadin Servlet throws a java.lang.ClassCastException exception: com.delhi.entities.Category cannot be attributed to com.delhi.entities.Category

when I try to run my webapps on Glassfish v2.

Category - JPA Entity Object

violation code according to server log:

for (Category c : categories) {
          mymethod();
   }
Categories

sourced from:

List<Category> categories = q.getResultList();

Any idea what went wrong?

+3
source share
5 answers

. , . , WAR . :

  • WAR.
  • WAR. .
  • EAR. , JAR, EAR MANIFEST.MF.
+1

, . , , , , .

:

  • undeploy deploy
  • ( )

IMO , , , .


, , .

0

Glassfish v2 Glassfish v3.

: - persistence ( , )?

bguiz, , . Glassfish .

FelixM, , , , ( 1 ). Glassfish 3 , WAR 2 "" Glassfish. () jpa. , , . , Glassfish v2 .

Spring (re) (re) deploy. , , - , jpa - . , , ( , , Glassfish v3, v2).

, , - , . ,

HashMap<Object, Object> properties = new HashMap<Object, Object>();
properties.put(PersistenceUnitProperties.CLASSLOADER, this.getClass().getClassLoader());
entityManagerFactory = Persistence.createEntityManagerFactory(jpaContext, properties);

, , .

, , , - jpa ( ).

0

, :

  • Glassfish v4
  • Netbeans
    • - ,
    • -

, [x] > . , , save. PermGen () EAR ( , , EAR - "" Netbeans ).

: Netbeans && & EAR, "" .

:

,

SEVERE:   The web application [/faces] created a ThreadLocal with key of type [org.glassfish.pfl.dynamic.codegen.impl.CurrentClassLoader$1] (value [org.glassfish.pfl.dynamic.codegen.impl.CurrentClassLoader$1@249ea63a]) and a value of type [org.glassfish.web.loader.WebappClassLoader] (value [WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
0

I had the same problem today. The solution closed EntityManagerFactory after use.
This answer helped me: fooobar.com/questions/1451599 / ...

0
source

Source: https://habr.com/ru/post/1724830/


All Articles