java.lang.IllegalArgumentException: Cannot determine java-type from given member [null]

Hibernate JIRA | Gary Hu | 3 years ago
  1. 0

    When a "properties" element is defined in the mapping file, for example: <properties name="refkey"> <property name="field1" type="java.lang.String" column="column3" not-null="true" length="20" /> <property name="field2" type="java.lang.String" column="column4" not-null="true" /> </properties> The system throws errors: 14:36:32,052 TRACE [org.hibernate.ejb.metamodel.AttributeFactory] (ServerService Thread Pool -- 48) Starting attribute metadata determination [refkey] 14:36:32,052 TRACE [org.hibernate.ejb.metamodel.AttributeFactory] (ServerService Thread Pool -- 48) Determined member [null] 14:36:32,052 TRACE [org.hibernate.ejb.metamodel.AttributeFactory] (ServerService Thread Pool -- 48) Determined type [name=component[field1,field2], class=org.hibernate.type.EmbeddedComponentType] 14:36:32,053 TRACE [org.hibernate.ejb.metamodel.MetadataContext] (ServerService Thread Pool -- 48) Completed entity [org.hibernate.issue.EntityClass1] 14:36:32,053 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 48) MSC000001: Failed to start service jboss.persistenceunit."hibernateissue-jar-0.0.1-SNAPSHOT.jar#myPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."hibernateissue-jar-0.0.1-SNAPSHOT.jar#myPU": java.lang.IllegalArgumentException: Cannot determine java-type from given member [null] at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103) [jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_37] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_37] at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_37] at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.0.Final-redhat-1.jar:2.1.0.Final-redhat-1] Caused by: java.lang.IllegalArgumentException: Cannot determine java-type from given member [null] at org.hibernate.ejb.metamodel.AttributeFactory$BaseAttributeMetadata.<init>(AttributeFactory.java:589) at org.hibernate.ejb.metamodel.AttributeFactory$SingularAttributeMetadataImpl.<init>(AttributeFactory.java:677) at org.hibernate.ejb.metamodel.AttributeFactory$SingularAttributeMetadataImpl.<init>(AttributeFactory.java:667) at org.hibernate.ejb.metamodel.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:531) at org.hibernate.ejb.metamodel.AttributeFactory.buildAttribute(AttributeFactory.java:98) at org.hibernate.ejb.metamodel.MetadataContext.wrapUp(MetadataContext.java:212) at org.hibernate.ejb.metamodel.MetamodelImpl.buildMetamodel(MetamodelImpl.java:88) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:104) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:920) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:92) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200) [jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10] at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57) [jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10] at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99) [jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10] ... 4 more This issue is very similar to https://hibernate.atlassian.net/browse/HHH-4870 But in this case it's really regarding to the <properties> element. The fix for HHH-4870 introduced a new method for Property. public boolean isSynthetic() { return false; } The SyntheticProperty, Backref and IndexBackref all implemented @Override public boolean isSynthetic() { return true; } The "properties" seems to not be interpreted as any of SyntheticProperty, Backref and IndexBackref. This is the code in org.hibernate.ejb.metamodel.AttributeFactory.java: @SuppressWarnings({ "unchecked" }) public <X, Y> AttributeImplementor<X, Y> buildAttribute(AbstractManagedType<X> ownerType, Property property) { if ( property.isSynthetic() ) { // hide synthetic/virtual properties (fabricated by Hibernate) from the JPA metamodel. LOG.tracef( "Skipping synthetic property %s(%s)", ownerType.getJavaType().getName(), property.getName() ); return null; } LOG.trace("Building attribute [" + ownerType.getJavaType().getName() + "." + property.getName() + "]"); final AttributeContext<X> attributeContext = wrap( ownerType, property ); final AttributeMetadata<X,Y> attributeMetadata = determineAttributeMetadata( attributeContext, NORMAL_MEMBER_RESOLVER ); ... Since "properties" is not synthetic, it continue to trigger the call determineAttributeMetadata. The following the code that throws the error in AttributeFactory.java: // we can support method or field members here. Is there really any other valid type? if ( Field.class.isInstance( member ) ) { declaredType = ( (Field) member ).getType(); } else if ( Method.class.isInstance( member ) ) { declaredType = ( (Method) member ).getReturnType(); } else { throw new IllegalArgumentException( "Cannot determine java-type from given member [" + member + "]" ); } Obviously, there's no any "type" associated with the "properties": <properties name="refkey"> I think the issue here is why the "properties" is not interpreted as synthetic so that it can escape the call determineAttributeMetadata. I'm attaching a simple maven project with deployment archive as well as the server.log for you reference.

    Hibernate JIRA | 3 years ago | Gary Hu
    java.lang.IllegalArgumentException: Cannot determine java-type from given member [null]
  2. 0

    When a "properties" element is defined in the mapping file, for example: <properties name="refkey"> <property name="field1" type="java.lang.String" column="column3" not-null="true" length="20" /> <property name="field2" type="java.lang.String" column="column4" not-null="true" /> </properties> The system throws errors: 14:36:32,052 TRACE [org.hibernate.ejb.metamodel.AttributeFactory] (ServerService Thread Pool -- 48) Starting attribute metadata determination [refkey] 14:36:32,052 TRACE [org.hibernate.ejb.metamodel.AttributeFactory] (ServerService Thread Pool -- 48) Determined member [null] 14:36:32,052 TRACE [org.hibernate.ejb.metamodel.AttributeFactory] (ServerService Thread Pool -- 48) Determined type [name=component[field1,field2], class=org.hibernate.type.EmbeddedComponentType] 14:36:32,053 TRACE [org.hibernate.ejb.metamodel.MetadataContext] (ServerService Thread Pool -- 48) Completed entity [org.hibernate.issue.EntityClass1] 14:36:32,053 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 48) MSC000001: Failed to start service jboss.persistenceunit."hibernateissue-jar-0.0.1-SNAPSHOT.jar#myPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."hibernateissue-jar-0.0.1-SNAPSHOT.jar#myPU": java.lang.IllegalArgumentException: Cannot determine java-type from given member [null] at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103) [jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_37] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_37] at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_37] at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.0.Final-redhat-1.jar:2.1.0.Final-redhat-1] Caused by: java.lang.IllegalArgumentException: Cannot determine java-type from given member [null] at org.hibernate.ejb.metamodel.AttributeFactory$BaseAttributeMetadata.<init>(AttributeFactory.java:589) at org.hibernate.ejb.metamodel.AttributeFactory$SingularAttributeMetadataImpl.<init>(AttributeFactory.java:677) at org.hibernate.ejb.metamodel.AttributeFactory$SingularAttributeMetadataImpl.<init>(AttributeFactory.java:667) at org.hibernate.ejb.metamodel.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:531) at org.hibernate.ejb.metamodel.AttributeFactory.buildAttribute(AttributeFactory.java:98) at org.hibernate.ejb.metamodel.MetadataContext.wrapUp(MetadataContext.java:212) at org.hibernate.ejb.metamodel.MetamodelImpl.buildMetamodel(MetamodelImpl.java:88) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:104) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:920) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:92) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200) [jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10] at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57) [jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10] at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99) [jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10] ... 4 more This issue is very similar to https://hibernate.atlassian.net/browse/HHH-4870 But in this case it's really regarding to the <properties> element. The fix for HHH-4870 introduced a new method for Property. public boolean isSynthetic() { return false; } The SyntheticProperty, Backref and IndexBackref all implemented @Override public boolean isSynthetic() { return true; } The "properties" seems to not be interpreted as any of SyntheticProperty, Backref and IndexBackref. This is the code in org.hibernate.ejb.metamodel.AttributeFactory.java: @SuppressWarnings({ "unchecked" }) public <X, Y> AttributeImplementor<X, Y> buildAttribute(AbstractManagedType<X> ownerType, Property property) { if ( property.isSynthetic() ) { // hide synthetic/virtual properties (fabricated by Hibernate) from the JPA metamodel. LOG.tracef( "Skipping synthetic property %s(%s)", ownerType.getJavaType().getName(), property.getName() ); return null; } LOG.trace("Building attribute [" + ownerType.getJavaType().getName() + "." + property.getName() + "]"); final AttributeContext<X> attributeContext = wrap( ownerType, property ); final AttributeMetadata<X,Y> attributeMetadata = determineAttributeMetadata( attributeContext, NORMAL_MEMBER_RESOLVER ); ... Since "properties" is not synthetic, it continue to trigger the call determineAttributeMetadata. The following the code that throws the error in AttributeFactory.java: // we can support method or field members here. Is there really any other valid type? if ( Field.class.isInstance( member ) ) { declaredType = ( (Field) member ).getType(); } else if ( Method.class.isInstance( member ) ) { declaredType = ( (Method) member ).getReturnType(); } else { throw new IllegalArgumentException( "Cannot determine java-type from given member [" + member + "]" ); } Obviously, there's no any "type" associated with the "properties": <properties name="refkey"> I think the issue here is why the "properties" is not interpreted as synthetic so that it can escape the call determineAttributeMetadata. I'm attaching a simple maven project with deployment archive as well as the server.log for you reference.

    Hibernate JIRA | 3 years ago | Gary Hu
    java.lang.IllegalArgumentException: Cannot determine java-type from given member [null]
  3. 0

    Error while running an application

    Oracle Community | 7 years ago | user10197718
    java.lang.IllegalArgumentException: Cannot determine action type for investigation
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Exceptions in console log when opening workspace as non-admin

    Eclipse Bugzilla | 7 years ago | arturod
    java.lang.IllegalArgumentException: Cannot access member 'id' in null
  6. 0

    Exceptions in console log when opening workspace as non-admin

    Eclipse Bugzilla | 7 years ago | arturod
    org.osgi.framework.BundleException: Exception in org.eclipse.equinox.internal.p2.reconciler.dropins.Activator.start() of bundle org.eclipse.equinox.p2.reconciler.dropins.

    1 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.IllegalArgumentException

      Cannot determine java-type from given member [null]

      at org.hibernate.ejb.metamodel.AttributeFactory$BaseAttributeMetadata.<init>()
    2. Hibernate EJB
      HibernatePersistence.createContainerEntityManagerFactory
      1. org.hibernate.ejb.metamodel.AttributeFactory$BaseAttributeMetadata.<init>(AttributeFactory.java:589)
      2. org.hibernate.ejb.metamodel.AttributeFactory$SingularAttributeMetadataImpl.<init>(AttributeFactory.java:677)
      3. org.hibernate.ejb.metamodel.AttributeFactory$SingularAttributeMetadataImpl.<init>(AttributeFactory.java:667)
      4. org.hibernate.ejb.metamodel.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:531)
      5. org.hibernate.ejb.metamodel.AttributeFactory.buildAttribute(AttributeFactory.java:98)
      6. org.hibernate.ejb.metamodel.MetadataContext.wrapUp(MetadataContext.java:212)
      7. org.hibernate.ejb.metamodel.MetamodelImpl.buildMetamodel(MetamodelImpl.java:88)
      8. org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:104)
      9. org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:920)
      10. org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
      11. org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:92)
      11 frames
    3. JPA
      PersistenceUnitServiceImpl$1.run
      1. org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200)[jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
      2. org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57)[jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
      3. org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)[jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
      3 frames
    4. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[rt.jar:1.6.0_37]
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[rt.jar:1.6.0_37]
      3. java.lang.Thread.run(Thread.java:662)[rt.jar:1.6.0_37]
      3 frames
    5. JBoss Threads
      JBossThread.run
      1. org.jboss.threads.JBossThread.run(JBossThread.java:122)[jboss-threads-2.1.0.Final-redhat-1.jar:2.1.0.Final-redhat-1]
      1 frame