java.lang.NullPointerException: null

Hibernate JIRA | thall | 10 months ago
  1. 0

    The setup: {code:java} @Entity @Table(name = "batch") @SequenceGenerator(name = "BatchGen", sequenceName = "seq_batch", allocationSize = 1) public class Batch implements Serializable { ... @ElementCollection @CollectionTable( name = "batch_node", //uniqueConstraints = @UniqueConstraint(columnNames = {"batch_id", "node_id"}), //foreignKey = @ForeignKey, joinColumns = @JoinColumn(name = "batch_id", nullable = false)) @MapKeyJoinColumn(name = "node_id") private Map<Node, BatchNodeMetadata> batchNodeMetadata = new HashMap<>(); ... } @Entity @Table(name= "node") @SequenceGenerator(name="NodeGen", sequenceName="seq_node", allocationSize=1) public class Node implements Serializable { ... } @Embeddable public class BatchNodeMetadata implements Serializable { @Column(nullable = false) @Enumerated(EnumType.STRING) private NodeMigration migrering = NodeMigration.TOTAL; public NodeMigration getMigrering() { return migrering; } public void setMigrering(NodeMigration migrering) { this.migrering = migrering; } } {code} Testcase {code:java} class Test { @Test public void testGetNodesInBatch() { Node n = new Node(); n.setName("Test"); nodeDAO.create(n); Batch b = new Batch(); b.setName("Test"); b.getBatchNodeMetadata().put(n, new BatchNodeMetadata()); batchDAO.create(b); Collection<String> actual = batchDAO.getNodesInBatch(b); Assert.assertEquals(1, actual.size()); } } class Dao { public Collection<Node> getNodesInBatch(Batch batch) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Node> query = cb.createQuery(Node.class); Root<Batch> root = query.from(Batch.class); MapJoin<Batch, Node, BatchNodeMetadata> nodes = root.join(Batch_.batchNodeMetadata); query.select(nodes.key()); query.where(cb.equal(root, batch)); return em.createQuery(query).getResultList(); } } {code} *Output* Everything from the setup seems to be correct {noformat} Hibernate: create table batch (id integer not null, current_activity varchar(255), name varchar(255) not null, pretty_current_activity varchar(255), visas_utanför_fabriken boolean, primary key (id)) Hibernate: create table batch_node (batch_id integer not null, migrering varchar(255) not null, node_id integer not null, primary key (batch_id, node_id)) Hibernate: create table node (id integer not null, edgar_complexity varchar(255), long_name varchar(255), municipal_area varchar(255), "name" varchar(255) not null, primary key (id)) Hibernate: alter table batch add constraint UK_ea6wjj8co7qtkcek0at693sh5 unique (name) Hibernate: alter table node add constraint UK_fwigxdmj6bsrpcmhcgpmlsirh unique ("name") Hibernate: alter table batch_node add constraint FK_hp7ye0ce3g9xb2h9newetnar5 foreign key (node_id) references node Hibernate: alter table batch_node add constraint FK_cdi1tq0y36ylqqm4dbvghaxk foreign key (batch_id) references batch Hibernate: call next value for seq_node Hibernate: insert into node (edgar_complexity, long_name, municipal_area, "name", id) values (?, ?, ?, ?, ?) Hibernate: call next value for seq_batch Hibernate: insert into batch (current_activity, name, pretty_current_activity, visas_utanför_fabriken, id) values (?, ?, ?, ?, ?) Hibernate: insert into batch_node (batch_id, node_id, migrering) values (?, ?, ?) {noformat} NPE when executing the criteria {code:java} java.lang.NullPointerException: null at org.hibernate.hql.internal.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:592) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.addrExpr(HqlSqlBaseWalker.java:4980) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1263) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4686) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.arithmeticExpr(HqlSqlBaseWalker.java:3215) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:2382) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:2194) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1476) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:573) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:249) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:278) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:206) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:568) at org.hibernate.jpa.criteria.CriteriaQueryImpl$1.buildCompiledQuery(CriteriaQueryImpl.java:336) at org.hibernate.jpa.criteria.compile.CriteriaCompiler.compile(CriteriaCompiler.java:147) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:736) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:262) at com.sun.proxy.$Proxy47.createQuery(Unknown Source) at com.dbmodel.dao.BatchDAO.getNodesInBatchStr(BatchDAO.java:132) at com.dbmodel.dao.BatchDAO$$FastClassBySpringCGLIB$$b9d5b01c.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644) at com.dbmodel.dao.BatchDAO$$EnhancerBySpringCGLIB$$4e2a04ba.getNodesInBatchStr(<generated>) at com.dbmodel.dao.BatchDAOIT.testGetNodesInBatch(BatchDAOIT.java:79) {code}

    Hibernate JIRA | 10 months ago | thall
    java.lang.NullPointerException: null
  2. 0

    The setup: {code:java} @Entity @Table(name = "batch") @SequenceGenerator(name = "BatchGen", sequenceName = "seq_batch", allocationSize = 1) public class Batch implements Serializable { ... @ElementCollection @CollectionTable( name = "batch_node", //uniqueConstraints = @UniqueConstraint(columnNames = {"batch_id", "node_id"}), //foreignKey = @ForeignKey, joinColumns = @JoinColumn(name = "batch_id", nullable = false)) @MapKeyJoinColumn(name = "node_id") private Map<Node, BatchNodeMetadata> batchNodeMetadata = new HashMap<>(); ... } @Entity @Table(name= "node") @SequenceGenerator(name="NodeGen", sequenceName="seq_node", allocationSize=1) public class Node implements Serializable { ... } @Embeddable public class BatchNodeMetadata implements Serializable { @Column(nullable = false) @Enumerated(EnumType.STRING) private NodeMigration migrering = NodeMigration.TOTAL; public NodeMigration getMigrering() { return migrering; } public void setMigrering(NodeMigration migrering) { this.migrering = migrering; } } {code} Testcase {code:java} class Test { @Test public void testGetNodesInBatch() { Node n = new Node(); n.setName("Test"); nodeDAO.create(n); Batch b = new Batch(); b.setName("Test"); b.getBatchNodeMetadata().put(n, new BatchNodeMetadata()); batchDAO.create(b); Collection<String> actual = batchDAO.getNodesInBatch(b); Assert.assertEquals(1, actual.size()); } } class Dao { public Collection<Node> getNodesInBatch(Batch batch) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Node> query = cb.createQuery(Node.class); Root<Batch> root = query.from(Batch.class); MapJoin<Batch, Node, BatchNodeMetadata> nodes = root.join(Batch_.batchNodeMetadata); query.select(nodes.key()); query.where(cb.equal(root, batch)); return em.createQuery(query).getResultList(); } } {code} *Output* Everything from the setup seems to be correct {noformat} Hibernate: create table batch (id integer not null, current_activity varchar(255), name varchar(255) not null, pretty_current_activity varchar(255), visas_utanför_fabriken boolean, primary key (id)) Hibernate: create table batch_node (batch_id integer not null, migrering varchar(255) not null, node_id integer not null, primary key (batch_id, node_id)) Hibernate: create table node (id integer not null, edgar_complexity varchar(255), long_name varchar(255), municipal_area varchar(255), "name" varchar(255) not null, primary key (id)) Hibernate: alter table batch add constraint UK_ea6wjj8co7qtkcek0at693sh5 unique (name) Hibernate: alter table node add constraint UK_fwigxdmj6bsrpcmhcgpmlsirh unique ("name") Hibernate: alter table batch_node add constraint FK_hp7ye0ce3g9xb2h9newetnar5 foreign key (node_id) references node Hibernate: alter table batch_node add constraint FK_cdi1tq0y36ylqqm4dbvghaxk foreign key (batch_id) references batch Hibernate: call next value for seq_node Hibernate: insert into node (edgar_complexity, long_name, municipal_area, "name", id) values (?, ?, ?, ?, ?) Hibernate: call next value for seq_batch Hibernate: insert into batch (current_activity, name, pretty_current_activity, visas_utanför_fabriken, id) values (?, ?, ?, ?, ?) Hibernate: insert into batch_node (batch_id, node_id, migrering) values (?, ?, ?) {noformat} NPE when executing the criteria {code:java} java.lang.NullPointerException: null at org.hibernate.hql.internal.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:592) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.addrExpr(HqlSqlBaseWalker.java:4980) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1263) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4686) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.arithmeticExpr(HqlSqlBaseWalker.java:3215) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:2382) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:2194) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1476) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:573) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:249) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:278) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:206) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:568) at org.hibernate.jpa.criteria.CriteriaQueryImpl$1.buildCompiledQuery(CriteriaQueryImpl.java:336) at org.hibernate.jpa.criteria.compile.CriteriaCompiler.compile(CriteriaCompiler.java:147) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:736) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:262) at com.sun.proxy.$Proxy47.createQuery(Unknown Source) at com.dbmodel.dao.BatchDAO.getNodesInBatchStr(BatchDAO.java:132) at com.dbmodel.dao.BatchDAO$$FastClassBySpringCGLIB$$b9d5b01c.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644) at com.dbmodel.dao.BatchDAO$$EnhancerBySpringCGLIB$$4e2a04ba.getNodesInBatchStr(<generated>) at com.dbmodel.dao.BatchDAOIT.testGetNodesInBatch(BatchDAOIT.java:79) {code}

    Hibernate JIRA | 10 months ago | thall
    java.lang.NullPointerException: null
  3. 0

    Entity: {code} public class Cart implements Serializable { @Id() @Type(type = "org.hibernate.type.PostgresUUIDType") private UUID id = null; @Type(type = "org.soluvas.jpa.PersistentStringSet") private Set<String> couponIds = new HashSet<String>(); } {code} with UserType: {code} public class PersistentStringSet implements UserType { @Override public int[] sqlTypes() { return new int[] { Types.ARRAY }; } @Override public Class returnedClass() { return TreeSet.class; } @Override public boolean equals(Object x, Object y) throws HibernateException { if (x == y) { return true; } else if (x == null || y == null) { return false; } else { return x.equals(y); } } @Override public int hashCode(Object x) throws HibernateException { return x.hashCode(); } @Override public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { final Array theArray = rs.getArray(names[0]); if (rs.wasNull()) { return null; } final Set<String> sets = new TreeSet<String>(); final Object array = theArray.getArray(); for (final String identifier : (String[]) array) { sets.add(identifier); } return sets; } @Override public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { st.setNull(index, Types.ARRAY); } else { final Set<String> castObject = (Set<String>) value; final Array array = session.connection().createArrayOf( "varchar", castObject.toArray(new String[] {})); st.setArray(index, array); } } @Override public Object deepCopy(Object value) throws HibernateException { if (value != null) return new TreeSet<>((Collection<String>) value); else return null; } @Override public boolean isMutable() { return true; } @Override public Serializable disassemble(Object value) throws HibernateException { // TODO Auto-generated method stub return null; } @Override public Object assemble(Serializable cached, Object owner) throws HibernateException { // TODO Auto-generated method stub return null; } @Override public Object replace(Object original, Object target, Object owner) throws HibernateException { return deepCopy(original); } } {code} This code: {code} final TypedQuery<UUID> query = em.createQuery("SELECT id FROM Cart " + "WHERE :couponId MEMBER OF couponIds", UUID.class); query.setParameter("couponId", couponId); return query.getSingleResult() != null; {code} results in the error below. Perhaps something's amiss with the UserType implementation, however in that case Hibernate should throw appropriate Exception with more information and context regarding the invalid state. {code} java.lang.NullPointerException at org.hibernate.hql.internal.ast.tree.MethodNode.handleElements(MethodNode.java:212) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.ast.tree.MethodNode.resolveCollectionProperty(MethodNode.java:163) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.ast.tree.CollectionFunction.resolve(CollectionFunction.java:44) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:1077) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.collectionFunction(HqlSqlBaseWalker.java:2999) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.collectionFunctionOrSubselect(HqlSqlBaseWalker.java:4897) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.inRhs(HqlSqlBaseWalker.java:4806) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:4473) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2104) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:796) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:597) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:249) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:278) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:206) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:342) ~[hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final] at sun.reflect.GeneratedMethodAccessor834.invoke(Unknown Source) ~[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_20] at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_20] at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:291) ~[spring-orm-4.1.2.RELEASE.jar:4.1.2.RELEASE] at com.sun.proxy.$Proxy141.createQuery(Unknown Source) ~[na:na] at id.co.bippo.cart.JpaCartRepositoryImpl.existsByCouponId(JpaCartRepositoryImpl.java:523) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_20] at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_20] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:267) ~[spring-tx-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) ~[spring-aop-4.1.2.RELEASE.jar:4.1.2.RELEASE] at com.sun.proxy.$Proxy160.existsByCouponId(Unknown Source) ~[na:na] at id.co.bippo.cart.JpaCartManagerImpl.lambda$2(JpaCartManagerImpl.java:1090) ~[classes/:na] at id.co.bippo.cart.JpaCartManagerImpl$$Lambda$7/550157690.doInTransaction(Unknown Source) ~[na:na] at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) ~[spring-tx-4.1.2.RELEASE.jar:4.1.2.RELEASE] at id.co.bippo.cart.JpaCartManagerImpl.addCoupon(JpaCartManagerImpl.java:1088) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_20] at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_20] at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:435) ~[wicket-ioc-6.18.0.jar:6.18.0] at com.sun.proxy.$Proxy208.addCoupon(Unknown Source) ~[na:na] at id.co.bippo.cart.web.pub.ProductCartModifierPanel$ProductCartModifierForm$38.onSubmit(ProductCartModifierPanel.java:1029) ~[classes/:na] at org.apache.wicket.ajax.markup.html.form.AjaxButton$1.onSubmit(AjaxButton.java:108) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit(AjaxFormSubmitBehavior.java:182) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1288) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.markup.html.form.Form.process(Form.java:952) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:784) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:159) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:124) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:633) [wicket-core-6.18.0.jar:6.18.0] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_20] at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_20] at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) [wicket-request-6.18.0.jar:6.18.0] at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282) [wicket-core-6.18.0.jar:6.18.0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.37] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.37] at org.soluvas.web.site.servlet.ShiroPrincipalsServletFilter.doFilter(ShiroPrincipalsServletFilter.java:59) [classes/:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.37] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.37] at org.soluvas.web.site.servlet.MoreMdcServletFilter.doFilter(MoreMdcServletFilter.java:62) [classes/:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.37] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.37] at ch.qos.logback.classic.helpers.MDCInsertingServletFilter.doFilter(MDCInsertingServletFilter.java:51) [logback-classic-1.0.13.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.37] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.37] at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-web-1.2.3.jar:1.2.3] at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-web-1.2.3.jar:1.2.3] at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-core-1.2.3.jar:1.2.3] at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-core-1.2.3.jar:1.2.3] at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) [shiro-core-1.2.3.jar:1.2.3] at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-web-1.2.3.jar:1.2.3] at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.2.3.jar:1.2.3] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) [spring-web-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) [spring-web-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.37] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.37] at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:104) [metrics-servlet-3.1.0.jar:3.1.0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.37] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.37] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) [catalina.jar:7.0.37] at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:123) [catalina.jar:7.0.37] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java) [catalina.jar:7.0.37] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [catalina.jar:7.0.37] at org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:171) [catalina.jar:7.0.37] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java) [catalina.jar:7.0.37] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) [catalina.jar:7.0.37] at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936) [catalina.jar:7.0.37] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [catalina.jar:7.0.37] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) [catalina.jar:7.0.37] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004) [tomcat-coyote.jar:7.0.37] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) [tomcat-coyote.jar:7.0.37] at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) [tomcat-coyote.jar:7.0.37] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_20] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_20] at java.lang.Thread.run(Thread.java:745) [na:na] {code} Tag [~ceefour]

    Hibernate JIRA | 2 years ago | Rudi Wijaya
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Entity: {code} public class Cart implements Serializable { @Id() @Type(type = "org.hibernate.type.PostgresUUIDType") private UUID id = null; @Type(type = "org.soluvas.jpa.PersistentStringSet") private Set<String> couponIds = new HashSet<String>(); } {code} with UserType: {code} public class PersistentStringSet implements UserType { @Override public int[] sqlTypes() { return new int[] { Types.ARRAY }; } @Override public Class returnedClass() { return TreeSet.class; } @Override public boolean equals(Object x, Object y) throws HibernateException { if (x == y) { return true; } else if (x == null || y == null) { return false; } else { return x.equals(y); } } @Override public int hashCode(Object x) throws HibernateException { return x.hashCode(); } @Override public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { final Array theArray = rs.getArray(names[0]); if (rs.wasNull()) { return null; } final Set<String> sets = new TreeSet<String>(); final Object array = theArray.getArray(); for (final String identifier : (String[]) array) { sets.add(identifier); } return sets; } @Override public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { st.setNull(index, Types.ARRAY); } else { final Set<String> castObject = (Set<String>) value; final Array array = session.connection().createArrayOf( "varchar", castObject.toArray(new String[] {})); st.setArray(index, array); } } @Override public Object deepCopy(Object value) throws HibernateException { if (value != null) return new TreeSet<>((Collection<String>) value); else return null; } @Override public boolean isMutable() { return true; } @Override public Serializable disassemble(Object value) throws HibernateException { // TODO Auto-generated method stub return null; } @Override public Object assemble(Serializable cached, Object owner) throws HibernateException { // TODO Auto-generated method stub return null; } @Override public Object replace(Object original, Object target, Object owner) throws HibernateException { return deepCopy(original); } } {code} This code: {code} final TypedQuery<UUID> query = em.createQuery("SELECT id FROM Cart " + "WHERE :couponId MEMBER OF couponIds", UUID.class); query.setParameter("couponId", couponId); return query.getSingleResult() != null; {code} results in the error below. Perhaps something's amiss with the UserType implementation, however in that case Hibernate should throw appropriate Exception with more information and context regarding the invalid state. {code} java.lang.NullPointerException at org.hibernate.hql.internal.ast.tree.MethodNode.handleElements(MethodNode.java:212) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.ast.tree.MethodNode.resolveCollectionProperty(MethodNode.java:163) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.ast.tree.CollectionFunction.resolve(CollectionFunction.java:44) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:1077) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.collectionFunction(HqlSqlBaseWalker.java:2999) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.collectionFunctionOrSubselect(HqlSqlBaseWalker.java:4897) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.inRhs(HqlSqlBaseWalker.java:4806) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:4473) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2104) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:796) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:597) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:249) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:278) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:206) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:342) ~[hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final] at sun.reflect.GeneratedMethodAccessor834.invoke(Unknown Source) ~[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_20] at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_20] at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:291) ~[spring-orm-4.1.2.RELEASE.jar:4.1.2.RELEASE] at com.sun.proxy.$Proxy141.createQuery(Unknown Source) ~[na:na] at id.co.bippo.cart.JpaCartRepositoryImpl.existsByCouponId(JpaCartRepositoryImpl.java:523) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_20] at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_20] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:267) ~[spring-tx-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) ~[spring-aop-4.1.2.RELEASE.jar:4.1.2.RELEASE] at com.sun.proxy.$Proxy160.existsByCouponId(Unknown Source) ~[na:na] at id.co.bippo.cart.JpaCartManagerImpl.lambda$2(JpaCartManagerImpl.java:1090) ~[classes/:na] at id.co.bippo.cart.JpaCartManagerImpl$$Lambda$7/550157690.doInTransaction(Unknown Source) ~[na:na] at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) ~[spring-tx-4.1.2.RELEASE.jar:4.1.2.RELEASE] at id.co.bippo.cart.JpaCartManagerImpl.addCoupon(JpaCartManagerImpl.java:1088) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_20] at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_20] at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:435) ~[wicket-ioc-6.18.0.jar:6.18.0] at com.sun.proxy.$Proxy208.addCoupon(Unknown Source) ~[na:na] at id.co.bippo.cart.web.pub.ProductCartModifierPanel$ProductCartModifierForm$38.onSubmit(ProductCartModifierPanel.java:1029) ~[classes/:na] at org.apache.wicket.ajax.markup.html.form.AjaxButton$1.onSubmit(AjaxButton.java:108) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit(AjaxFormSubmitBehavior.java:182) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1288) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.markup.html.form.Form.process(Form.java:952) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:784) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:159) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:124) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:633) [wicket-core-6.18.0.jar:6.18.0] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_20] at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_20] at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) [wicket-request-6.18.0.jar:6.18.0] at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201) [wicket-core-6.18.0.jar:6.18.0] at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282) [wicket-core-6.18.0.jar:6.18.0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.37] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.37] at org.soluvas.web.site.servlet.ShiroPrincipalsServletFilter.doFilter(ShiroPrincipalsServletFilter.java:59) [classes/:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.37] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.37] at org.soluvas.web.site.servlet.MoreMdcServletFilter.doFilter(MoreMdcServletFilter.java:62) [classes/:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.37] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.37] at ch.qos.logback.classic.helpers.MDCInsertingServletFilter.doFilter(MDCInsertingServletFilter.java:51) [logback-classic-1.0.13.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.37] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.37] at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-web-1.2.3.jar:1.2.3] at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-web-1.2.3.jar:1.2.3] at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-core-1.2.3.jar:1.2.3] at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-core-1.2.3.jar:1.2.3] at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) [shiro-core-1.2.3.jar:1.2.3] at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-web-1.2.3.jar:1.2.3] at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.2.3.jar:1.2.3] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) [spring-web-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) [spring-web-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.37] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.37] at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:104) [metrics-servlet-3.1.0.jar:3.1.0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.37] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.37] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) [catalina.jar:7.0.37] at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:123) [catalina.jar:7.0.37] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java) [catalina.jar:7.0.37] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [catalina.jar:7.0.37] at org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:171) [catalina.jar:7.0.37] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java) [catalina.jar:7.0.37] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) [catalina.jar:7.0.37] at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936) [catalina.jar:7.0.37] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [catalina.jar:7.0.37] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) [catalina.jar:7.0.37] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004) [tomcat-coyote.jar:7.0.37] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) [tomcat-coyote.jar:7.0.37] at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) [tomcat-coyote.jar:7.0.37] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_20] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_20] at java.lang.Thread.run(Thread.java:745) [na:na] {code} Tag [~ceefour]

    Hibernate JIRA | 2 years ago | Rudi Wijaya
    java.lang.NullPointerException
  6. 0

    Spring 4 - Config XML jpa:repositories throwing NoSuchMethodError BeanDefinitionParserDelegate.getEnvironment()

    Stack Overflow | 1 year ago | a.hrdie
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityContextFilter' defined in file [/var/lib/tomcat6/webapps/services/WEB-INF/classes/com/services/filter/SecurityContextFilter.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [com.services.user.UserRepository]: : Error creating bean with name 'userRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract com.services.user.domain.User com.services.user.UserRepository.findBySession(java.lang.String)!; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract com.services.user.domain.User com.services.user.UserRepository.findBySession(java.lang.String)!

    4 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      null

      at org.hibernate.hql.internal.ast.HqlSqlWalker.lookupProperty()
    2. Hibernate
      SessionImpl.createQuery
      1. org.hibernate.hql.internal.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:592)
      2. org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.addrExpr(HqlSqlBaseWalker.java:4980)
      3. org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1263)
      4. org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4686)
      5. org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.arithmeticExpr(HqlSqlBaseWalker.java:3215)
      6. org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:2382)
      7. org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:2194)
      8. org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1476)
      9. org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:573)
      10. org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
      11. org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:249)
      12. org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:278)
      13. org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:206)
      14. org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
      15. org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131)
      16. org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93)
      17. org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167)
      18. org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
      19. org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
      20. org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800)
      20 frames
    3. org.hibernate.jpa
      AbstractEntityManagerImpl.createQuery
      1. org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:568)
      2. org.hibernate.jpa.criteria.CriteriaQueryImpl$1.buildCompiledQuery(CriteriaQueryImpl.java:336)
      3. org.hibernate.jpa.criteria.compile.CriteriaCompiler.compile(CriteriaCompiler.java:147)
      4. org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:736)
      4 frames
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:497)
      4 frames
    5. Spring ORM
      SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke
      1. org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:262)
      1 frame
    6. com.sun.proxy
      $Proxy47.createQuery
      1. com.sun.proxy.$Proxy47.createQuery(Unknown Source)
      1 frame
    7. com.dbmodel.dao
      BatchDAO$$FastClassBySpringCGLIB$$b9d5b01c.invoke
      1. com.dbmodel.dao.BatchDAO.getNodesInBatchStr(BatchDAO.java:132)
      2. com.dbmodel.dao.BatchDAO$$FastClassBySpringCGLIB$$b9d5b01c.invoke(<generated>)
      2 frames
    8. Spring Core
      MethodProxy.invoke
      1. org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
      1 frame
    9. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      2 frames
    10. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
      2. org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
      3. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
      3 frames
    11. Spring AOP
      CglibAopProxy$DynamicAdvisedInterceptor.intercept
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      2. org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
      2 frames
    12. com.dbmodel.dao
      BatchDAOIT.testGetNodesInBatch
      1. com.dbmodel.dao.BatchDAO$$EnhancerBySpringCGLIB$$4e2a04ba.getNodesInBatchStr(<generated>)
      2. com.dbmodel.dao.BatchDAOIT.testGetNodesInBatch(BatchDAOIT.java:79)
      2 frames