[JBoss JIRA] (JGRP-2461) Clustering can fail when re-adding an existing node using TCP_NIO2
by Bela Ban (Jira)
[ https://issues.redhat.com/browse/JGRP-2461?page=com.atlassian.jira.plugin... ]
Bela Ban commented on JGRP-2461:
--------------------------------
I thought {{use_ip_addrs}} was a good idea at the time, bit I don't anymore: [1].
If you want to look into this, be my guest but I won't fix it, and this will be removed in 5.0.
Sorry,
> Clustering can fail when re-adding an existing node using TCP_NIO2
> ------------------------------------------------------------------
>
> Key: JGRP-2461
> URL: https://issues.redhat.com/browse/JGRP-2461
> Project: JGroups
> Issue Type: Bug
> Affects Versions: 4.1.8
> Reporter: Robert Mitchell
> Assignee: Bela Ban
> Priority: Major
>
> When a node leaves a cluster and then later attempts to re-enter, a race condition can occur where the clustering fails to occur. Here is the sequence of events that seems to allow this to occur:
> # The rejoining node must have a "higher" IP address than the current cluster coordinator.
> # On the rejoin attempt, the coordinator sends a message to the rejoining node before the rejoining node sends to the coordinator using its prior address. I have seen this happen for two reasons:
> ## UNICAST3 is resending messages (which often happens with the final LEAVE_RSP from the prior cluster membership because it apparently does not get acked before the connection closes)
> ## TCPPING is sending a ping request to the cached prior address.
> # The connection gets established. It will then be used by the rejoining node whenever communicating with the cluster coordinator.
> # However, the cluster coordinator has this as the connection for the prior address. So the following happens whenever it wants to send a message to the rejoining node:
> ## It will attempt to create a new connection.
> ## The rejoining node will reject the connection as a redundant connection with its current connection taking precedence since it is coming from the same logical address as the "bad" connection.
> Since the messages needed to find and join the cluster or merge the two clusters are all unicast messages, the rejoining node will never get them and not be able to join until something happens that causes the initial connection to get closed.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
4 years, 6 months
[JBoss JIRA] (JGRP-2465) Remove use_ip_addrs
by Bela Ban (Jira)
Bela Ban created JGRP-2465:
------------------------------
Summary: Remove use_ip_addrs
Key: JGRP-2465
URL: https://issues.redhat.com/browse/JGRP-2465
Project: JGroups
Issue Type: Task
Reporter: Bela Ban
Assignee: Bela Ban
Fix For: 5.0.0.Alpha4
Remove {{use_ip_addrs}}; nobody uses this and it complicates the code
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
4 years, 6 months
[JBoss JIRA] (JGRP-2461) Clustering can fail when re-adding an existing node using TCP_NIO2
by Robert Mitchell (Jira)
[ https://issues.redhat.com/browse/JGRP-2461?page=com.atlassian.jira.plugin... ]
Robert Mitchell commented on JGRP-2461:
---------------------------------------
While I would still prefer to see this fixed, I understand your reluctance to do so. I will leave it up to you to make that decision.
> Clustering can fail when re-adding an existing node using TCP_NIO2
> ------------------------------------------------------------------
>
> Key: JGRP-2461
> URL: https://issues.redhat.com/browse/JGRP-2461
> Project: JGroups
> Issue Type: Bug
> Affects Versions: 4.1.8
> Reporter: Robert Mitchell
> Assignee: Bela Ban
> Priority: Major
>
> When a node leaves a cluster and then later attempts to re-enter, a race condition can occur where the clustering fails to occur. Here is the sequence of events that seems to allow this to occur:
> # The rejoining node must have a "higher" IP address than the current cluster coordinator.
> # On the rejoin attempt, the coordinator sends a message to the rejoining node before the rejoining node sends to the coordinator using its prior address. I have seen this happen for two reasons:
> ## UNICAST3 is resending messages (which often happens with the final LEAVE_RSP from the prior cluster membership because it apparently does not get acked before the connection closes)
> ## TCPPING is sending a ping request to the cached prior address.
> # The connection gets established. It will then be used by the rejoining node whenever communicating with the cluster coordinator.
> # However, the cluster coordinator has this as the connection for the prior address. So the following happens whenever it wants to send a message to the rejoining node:
> ## It will attempt to create a new connection.
> ## The rejoining node will reject the connection as a redundant connection with its current connection taking precedence since it is coming from the same logical address as the "bad" connection.
> Since the messages needed to find and join the cluster or merge the two clusters are all unicast messages, the rejoining node will never get them and not be able to join until something happens that causes the initial connection to get closed.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
4 years, 6 months
[JBoss JIRA] (DROOLS-5225) Constraint grouping fails with executable model
by Mario Fusco (Jira)
[ https://issues.redhat.com/browse/DROOLS-5225?page=com.atlassian.jira.plug... ]
Mario Fusco commented on DROOLS-5225:
-------------------------------------
I reproduced the problem and I'm working on it. For now I let you notice that the additional level of parenthesis is not necessary and indeed if you write
{code}
$p : Pojo(departuretimedayofweek == 1 || == 2 || == 7 )
{code}
also the executable model works as expected.
> Constraint grouping fails with executable model
> -----------------------------------------------
>
> Key: DROOLS-5225
> URL: https://issues.redhat.com/browse/DROOLS-5225
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 7.35.0.Final
> Reporter: Matteo Casalino
> Assignee: Mario Fusco
> Priority: Major
> Attachments: constraints-grouping.zip
>
>
> Executable model rule compilation fails when trying to build a pattern using constraint grouping.
> Example of DRL that fails to compile:
> {noformat}
> rule "TestBusiness"
> when $p : Pojo(departuretimedayofweek (== 1 || == 2 || == 7) )
> then
> end
> {noformat}
> Error:
> {noformat}
> java.lang.StackOverflowError
> at java.base/java.util.LinkedList.unlink(LinkedList.java:215)
> at java.base/java.util.LinkedList.remove(LinkedList.java:530)
> at com.github.javaparser.ast.Node.setParentNode(Node.java:389)
> at com.github.javaparser.ast.Node.setAsParentNodeOf(Node.java:403)
> at com.github.javaparser.ast.expr.BinaryExpr.setLeft(BinaryExpr.java:174)
> at com.github.javaparser.ast.expr.BinaryExpr.<init>(BinaryExpr.java:131)
> at com.github.javaparser.ast.expr.BinaryExpr.<init>(BinaryExpr.java:122)
> at org.drools.modelcompiler.builder.generator.DrlxParseUtil.trasformHalfBinaryToBinary(DrlxParseUtil.java:347)
> at org.drools.modelcompiler.builder.generator.expressiontyper.ExpressionTyper.toTypedExpressionRec(ExpressionTyper.java:194)
> at org.drools.modelcompiler.builder.generator.expressiontyper.ExpressionTyper.toTypedExpressionRec(ExpressionTyper.java:185)
> at org.drools.modelcompiler.builder.generator.expressiontyper.ExpressionTyper.toTypedExpressionRec(ExpressionTyper.java:195)
> at org.drools.modelcompiler.builder.generator.expressiontyper.ExpressionTyper.toTypedExpressionRec(ExpressionTyper.java:185)
> ...
> {noformat}
> The example works fine when compiling without executable model.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
4 years, 6 months
[JBoss JIRA] (HIBERNATE-174) NullPointerException at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor - Hibernate 6.0.0.Alpha4
by Steve Ebersole (Jira)
[ https://issues.redhat.com/browse/HIBERNATE-174?page=com.atlassian.jira.pl... ]
Steve Ebersole closed HIBERNATE-174.
------------------------------------
Resolution: Explained
> NullPointerException at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor - Hibernate 6.0.0.Alpha4
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: HIBERNATE-174
> URL: https://issues.redhat.com/browse/HIBERNATE-174
> Project: Hibernate Integration
> Issue Type: Bug
> Reporter: Victor Williams Stafusa da Silva
> Assignee: Steve Ebersole
> Priority: Critical
>
> This code works fine in Hibernate 5.4.13.Final, but gives a NullPointerException at Hibernate 6.0.0.Alpha4:
> Test file:
> {code:title=Hbug.java|borderStyle=solid}
> package com.example;
> import java.util.HashMap;
> import java.util.Map;
> import java.util.Optional;
> import java.util.Set;
> import javax.persistence.spi.PersistenceProvider;
> import org.hibernate.SessionFactory;
> import org.hibernate.jpa.HibernatePersistenceProvider;
> /**
> * @author Victor Williams Stafusa da Silva
> */
> public class Hbug {
> public static void main(String[] args) throws Exception {
> Map<String, String> props = new HashMap<>();
> props.put("javax.persistence.jdbc.user", "sa");
> props.put("javax.persistence.jdbc.password", "");
> props.put("javax.persistence.jdbc.url", "jdbc:hsqldb:mem:test1");
> props.put("hibernate.hbm2ddl.import_files_sql_extractor", "org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor");
> props.put("javax.persistence.schema-generation.database.action", "drop-and-create");
> PersistenceProvider pp = new HibernatePersistenceProvider();
> var spui = new SimplePersistenceUnitInfo(
> Optional.empty(),
> HibernatePersistenceProvider.class,
> "test-1",
> Set.of(Fruit.class),
> props);
> var emf = pp.createContainerEntityManagerFactory(spui, props);
> if (!(emf instanceof SessionFactory)) throw new Exception("Bad EMF");
> }
> }
> {code}
> Utilitary class used by the above one:
> {code:title=SimplePersistenceUnitInfo.java|borderStyle=solid}
> package com.example;
> import java.io.IOException;
> import java.io.UncheckedIOException;
> import java.net.URL;
> import java.util.Collection;
> import java.util.Collections;
> import java.util.HashMap;
> import java.util.List;
> import java.util.Map;
> import java.util.Optional;
> import java.util.Properties;
> import java.util.stream.Collectors;
> import javax.persistence.SharedCacheMode;
> import javax.persistence.ValidationMode;
> import javax.persistence.spi.ClassTransformer;
> import javax.persistence.spi.PersistenceProvider;
> import javax.persistence.spi.PersistenceUnitInfo;
> import javax.persistence.spi.PersistenceUnitTransactionType;
> import javax.sql.DataSource;
> /**
> * @author Victor Williams Stafusa da Silva
> */
> public final class SimplePersistenceUnitInfo implements PersistenceUnitInfo {
> private final Optional<URL> url;
> private final Class<? extends PersistenceProvider> providerClass;
> private final String persistenceUnitName;
> private final List<String> classes;
> private final Map<String, String> properties;
> public SimplePersistenceUnitInfo(
> /*@NonNull*/ Optional<URL> url,
> /*@NonNull*/ Class<? extends PersistenceProvider> providerClass,
> /*@NonNull*/ String persistenceUnitName,
> /*@NonNull*/ Collection<Class<?>> classes,
> /*@NonNull*/ Map<String, String> properties)
> {
> this.url = url;
> this.providerClass = providerClass;
> this.persistenceUnitName = persistenceUnitName;
> this.classes = classes.stream().map(Class::getName).collect(Collectors.toList());
> this.properties = new HashMap<>();
> this.properties.putAll(properties);
> }
> @Override
> public String getPersistenceUnitName() {
> return persistenceUnitName;
> }
> @Override
> public String getPersistenceProviderClassName() {
> return providerClass.getName();
> }
> @Override
> public PersistenceUnitTransactionType getTransactionType() {
> return PersistenceUnitTransactionType.RESOURCE_LOCAL;
> }
> @Override
> //@Nullable
> public DataSource getJtaDataSource() {
> return null;
> }
> @Override
> //@Nullable
> public DataSource getNonJtaDataSource() {
> return null;
> }
> @Override
> public List<String> getMappingFileNames() {
> return Collections.emptyList();
> }
> @Override
> public List<URL> getJarFileUrls() {
> try {
> return Collections.list(this.getClass().getClassLoader().getResources(""));
> } catch (IOException e) {
> throw new UncheckedIOException(e);
> }
> }
> //@Nullable
> @Override
> public URL getPersistenceUnitRootUrl() {
> return url.orElse(null);
> }
> @Override
> public List<String> getManagedClassNames() {
> return Collections.unmodifiableList(classes);
> }
> @Override
> public boolean excludeUnlistedClasses() {
> return false;
> }
> @Override
> public SharedCacheMode getSharedCacheMode() {
> return SharedCacheMode.UNSPECIFIED;
> }
> @Override
> public ValidationMode getValidationMode() {
> return ValidationMode.AUTO;
> }
> @Override
> public Properties getProperties() {
> Properties p = new Properties();
> p.putAll(properties);
> return p;
> }
> @Override
> public String getPersistenceXMLSchemaVersion() {
> return "2.2";
> }
> @Override
> //@Nullable
> public ClassLoader getClassLoader() {
> return Thread.currentThread().getContextClassLoader();
> }
> @Override
> public void addTransformer(ClassTransformer transformer) {
> }
> @Override
> //@Nullable
> public ClassLoader getNewTempClassLoader() {
> return null;
> }
> }
> {code}
> Sample entity class:
> {code:title=Fruit.java|borderStyle=solid}
> package com.example;
> import java.io.Serializable;
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.GenerationType;
> import javax.persistence.Id;
> import javax.persistence.Table;
> /**
> * @author Victor Williams Stafusa da Silva
> */
> @Entity
> @Table(name = "fruits")
> public class Fruit implements Serializable {
> private static final long serialVersionUID = 1L;
> @Id
> @GeneratedValue(strategy = GenerationType.IDENTITY)
> private Integer id;
> private String name;
> private String color;
> public Fruit() {}
> public Fruit(String name, String color) {
> this.name = name;
> this.color = color;
> }
> public String getName() {
> return name;
> }
> public String getColor() {
> return color;
> }
> }
> {code}
> Gradle script to build that:
> {code:title=build.gradle|borderStyle=solid}
> apply plugin: 'java'
> apply plugin: 'application'
> group = 'com.example'
> mainClassName = 'com.example.Hbug'
> repositories {
> jcenter()
> }
> dependencies {
> implementation 'org.hsqldb:hsqldb:2.5.0'
> //implementation 'org.hibernate:hibernate-core:5.4.13.Final'
> implementation 'org.hibernate.orm:hibernate-core:6.0.0.Alpha4'
> }
> {code}
> Run the code above and a NullPointerException will be throw (with Hibernate 6.0.0.Alpha4). However, if the gradle file is changed to use Hibernate 5.4.13 (uncomment that line and comment the one for 6.0.0.Alpha4), then the code works as expected.
> Here is the output, including the stack trace:
> {code:title=output|borderStyle=solid}
> Apr 07, 2020 7:19:53 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
> INFO: HHH000204: Processing PersistenceUnitInfo [name: test-1]
> Apr 07, 2020 7:19:54 AM org.hibernate.Version logVersion
> INFO: HHH000412: Hibernate Core {6.0.0.Alpha4}
> Apr 07, 2020 7:19:54 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
> INFO: HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
> Exception in thread "main" java.lang.NullPointerException
> at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor(ClassFileArchiveEntryHandler.java:84)
> at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor(ClassFileArchiveEntryHandler.java:67)
> at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.handleEntry(ClassFileArchiveEntryHandler.java:53)
> at org.hibernate.boot.archive.internal.JarFileBasedArchiveDescriptor.visitArchive(JarFileBasedArchiveDescriptor.java:147)
> at org.hibernate.boot.archive.internal.JarProtocolArchiveDescriptor.visitArchive(JarProtocolArchiveDescriptor.java:59)
> at org.hibernate.boot.archive.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:40)
> at org.hibernate.boot.model.process.internal.ScanningCoordinator.coordinateScan(ScanningCoordinator.java:74)
> at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.prepare(MetadataBuildingProcess.java:97)
> at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:243)
> at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:169)
> at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:32)
> at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:89)
> at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:166)
> at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:141)
> at com.example.Hbug.main(Hbug.java:31)
> {code}
> P.S.: I'm running and compiling this using Java 13.0.2.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
4 years, 6 months
[JBoss JIRA] (HIBERNATE-174) NullPointerException at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor - Hibernate 6.0.0.Alpha4
by Steve Ebersole (Jira)
[ https://issues.redhat.com/browse/HIBERNATE-174?page=com.atlassian.jira.pl... ]
Steve Ebersole commented on HIBERNATE-174:
------------------------------------------
Again, wrong Jira.
For this one... 6.0 is in Alpha. Alpha == not everything works.
Feel free to move this one to the Hibernate Jira, although it will not really be critical for us. If you wanted to look into the problem and work on a PR, that will go a long way in getting it implemented faster.
Also, we do not yet fully support Java 13. As far as we know it *should* work, but we have not yet tried
> NullPointerException at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor - Hibernate 6.0.0.Alpha4
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: HIBERNATE-174
> URL: https://issues.redhat.com/browse/HIBERNATE-174
> Project: Hibernate Integration
> Issue Type: Bug
> Reporter: Victor Williams Stafusa da Silva
> Assignee: Steve Ebersole
> Priority: Critical
>
> This code works fine in Hibernate 5.4.13.Final, but gives a NullPointerException at Hibernate 6.0.0.Alpha4:
> Test file:
> {code:title=Hbug.java|borderStyle=solid}
> package com.example;
> import java.util.HashMap;
> import java.util.Map;
> import java.util.Optional;
> import java.util.Set;
> import javax.persistence.spi.PersistenceProvider;
> import org.hibernate.SessionFactory;
> import org.hibernate.jpa.HibernatePersistenceProvider;
> /**
> * @author Victor Williams Stafusa da Silva
> */
> public class Hbug {
> public static void main(String[] args) throws Exception {
> Map<String, String> props = new HashMap<>();
> props.put("javax.persistence.jdbc.user", "sa");
> props.put("javax.persistence.jdbc.password", "");
> props.put("javax.persistence.jdbc.url", "jdbc:hsqldb:mem:test1");
> props.put("hibernate.hbm2ddl.import_files_sql_extractor", "org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor");
> props.put("javax.persistence.schema-generation.database.action", "drop-and-create");
> PersistenceProvider pp = new HibernatePersistenceProvider();
> var spui = new SimplePersistenceUnitInfo(
> Optional.empty(),
> HibernatePersistenceProvider.class,
> "test-1",
> Set.of(Fruit.class),
> props);
> var emf = pp.createContainerEntityManagerFactory(spui, props);
> if (!(emf instanceof SessionFactory)) throw new Exception("Bad EMF");
> }
> }
> {code}
> Utilitary class used by the above one:
> {code:title=SimplePersistenceUnitInfo.java|borderStyle=solid}
> package com.example;
> import java.io.IOException;
> import java.io.UncheckedIOException;
> import java.net.URL;
> import java.util.Collection;
> import java.util.Collections;
> import java.util.HashMap;
> import java.util.List;
> import java.util.Map;
> import java.util.Optional;
> import java.util.Properties;
> import java.util.stream.Collectors;
> import javax.persistence.SharedCacheMode;
> import javax.persistence.ValidationMode;
> import javax.persistence.spi.ClassTransformer;
> import javax.persistence.spi.PersistenceProvider;
> import javax.persistence.spi.PersistenceUnitInfo;
> import javax.persistence.spi.PersistenceUnitTransactionType;
> import javax.sql.DataSource;
> /**
> * @author Victor Williams Stafusa da Silva
> */
> public final class SimplePersistenceUnitInfo implements PersistenceUnitInfo {
> private final Optional<URL> url;
> private final Class<? extends PersistenceProvider> providerClass;
> private final String persistenceUnitName;
> private final List<String> classes;
> private final Map<String, String> properties;
> public SimplePersistenceUnitInfo(
> /*@NonNull*/ Optional<URL> url,
> /*@NonNull*/ Class<? extends PersistenceProvider> providerClass,
> /*@NonNull*/ String persistenceUnitName,
> /*@NonNull*/ Collection<Class<?>> classes,
> /*@NonNull*/ Map<String, String> properties)
> {
> this.url = url;
> this.providerClass = providerClass;
> this.persistenceUnitName = persistenceUnitName;
> this.classes = classes.stream().map(Class::getName).collect(Collectors.toList());
> this.properties = new HashMap<>();
> this.properties.putAll(properties);
> }
> @Override
> public String getPersistenceUnitName() {
> return persistenceUnitName;
> }
> @Override
> public String getPersistenceProviderClassName() {
> return providerClass.getName();
> }
> @Override
> public PersistenceUnitTransactionType getTransactionType() {
> return PersistenceUnitTransactionType.RESOURCE_LOCAL;
> }
> @Override
> //@Nullable
> public DataSource getJtaDataSource() {
> return null;
> }
> @Override
> //@Nullable
> public DataSource getNonJtaDataSource() {
> return null;
> }
> @Override
> public List<String> getMappingFileNames() {
> return Collections.emptyList();
> }
> @Override
> public List<URL> getJarFileUrls() {
> try {
> return Collections.list(this.getClass().getClassLoader().getResources(""));
> } catch (IOException e) {
> throw new UncheckedIOException(e);
> }
> }
> //@Nullable
> @Override
> public URL getPersistenceUnitRootUrl() {
> return url.orElse(null);
> }
> @Override
> public List<String> getManagedClassNames() {
> return Collections.unmodifiableList(classes);
> }
> @Override
> public boolean excludeUnlistedClasses() {
> return false;
> }
> @Override
> public SharedCacheMode getSharedCacheMode() {
> return SharedCacheMode.UNSPECIFIED;
> }
> @Override
> public ValidationMode getValidationMode() {
> return ValidationMode.AUTO;
> }
> @Override
> public Properties getProperties() {
> Properties p = new Properties();
> p.putAll(properties);
> return p;
> }
> @Override
> public String getPersistenceXMLSchemaVersion() {
> return "2.2";
> }
> @Override
> //@Nullable
> public ClassLoader getClassLoader() {
> return Thread.currentThread().getContextClassLoader();
> }
> @Override
> public void addTransformer(ClassTransformer transformer) {
> }
> @Override
> //@Nullable
> public ClassLoader getNewTempClassLoader() {
> return null;
> }
> }
> {code}
> Sample entity class:
> {code:title=Fruit.java|borderStyle=solid}
> package com.example;
> import java.io.Serializable;
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.GenerationType;
> import javax.persistence.Id;
> import javax.persistence.Table;
> /**
> * @author Victor Williams Stafusa da Silva
> */
> @Entity
> @Table(name = "fruits")
> public class Fruit implements Serializable {
> private static final long serialVersionUID = 1L;
> @Id
> @GeneratedValue(strategy = GenerationType.IDENTITY)
> private Integer id;
> private String name;
> private String color;
> public Fruit() {}
> public Fruit(String name, String color) {
> this.name = name;
> this.color = color;
> }
> public String getName() {
> return name;
> }
> public String getColor() {
> return color;
> }
> }
> {code}
> Gradle script to build that:
> {code:title=build.gradle|borderStyle=solid}
> apply plugin: 'java'
> apply plugin: 'application'
> group = 'com.example'
> mainClassName = 'com.example.Hbug'
> repositories {
> jcenter()
> }
> dependencies {
> implementation 'org.hsqldb:hsqldb:2.5.0'
> //implementation 'org.hibernate:hibernate-core:5.4.13.Final'
> implementation 'org.hibernate.orm:hibernate-core:6.0.0.Alpha4'
> }
> {code}
> Run the code above and a NullPointerException will be throw (with Hibernate 6.0.0.Alpha4). However, if the gradle file is changed to use Hibernate 5.4.13 (uncomment that line and comment the one for 6.0.0.Alpha4), then the code works as expected.
> Here is the output, including the stack trace:
> {code:title=output|borderStyle=solid}
> Apr 07, 2020 7:19:53 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
> INFO: HHH000204: Processing PersistenceUnitInfo [name: test-1]
> Apr 07, 2020 7:19:54 AM org.hibernate.Version logVersion
> INFO: HHH000412: Hibernate Core {6.0.0.Alpha4}
> Apr 07, 2020 7:19:54 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
> INFO: HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
> Exception in thread "main" java.lang.NullPointerException
> at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor(ClassFileArchiveEntryHandler.java:84)
> at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor(ClassFileArchiveEntryHandler.java:67)
> at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.handleEntry(ClassFileArchiveEntryHandler.java:53)
> at org.hibernate.boot.archive.internal.JarFileBasedArchiveDescriptor.visitArchive(JarFileBasedArchiveDescriptor.java:147)
> at org.hibernate.boot.archive.internal.JarProtocolArchiveDescriptor.visitArchive(JarProtocolArchiveDescriptor.java:59)
> at org.hibernate.boot.archive.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:40)
> at org.hibernate.boot.model.process.internal.ScanningCoordinator.coordinateScan(ScanningCoordinator.java:74)
> at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.prepare(MetadataBuildingProcess.java:97)
> at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:243)
> at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:169)
> at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:32)
> at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:89)
> at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:166)
> at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:141)
> at com.example.Hbug.main(Hbug.java:31)
> {code}
> P.S.: I'm running and compiling this using Java 13.0.2.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
4 years, 6 months