com.objectdb.o.InternalException

#1

Hello, I have a problem that I have not been able to solve, perhaps it is mild, but for me it has lasted for a long time.
I am creating a test Maven project, with its dependencies, I am trying to write the log to the corresponding entity, and this error occurs.

He sent them the project, the bug list, and the configuration.

 

error list

estoy aqui....
Exception in Application start method
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
    at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: com.objectdb.o.InternalException
    at com.objectdb.o.VUT.i(VUT.java:229)
    at com.objectdb.o.VUT.i(VUT.java:150)
    at com.objectdb.o.UMR.w(UMR.java:462)
    at com.objectdb.o.UMR.f(UMR.java:405)
    at com.objectdb.o.UML.k(UML.java:495)
    at com.objectdb.o.MMM.j(MMM.java:870)
    at com.objectdb.o.OBM.aQ(OBM.java:433)
    at com.objectdb.o.OBM.aQ(OBM.java:292)
    at com.objectdb.jpa.EMImpl.persist(EMImpl.java:415)
    at com.jrpa.servicios.Servicios/com.jrpa.servicios.Servicios.App.pruebaDatos(App.java:46)
    at com.jrpa.servicios.Servicios/com.jrpa.servicios.Servicios.App.start(App.java:24)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    ... 1 more
Exception running application com.jrpa.servicios.Servicios.App

Test program

package com.jrpa.servicios.Servicios;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.io.IOException;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 * JavaFX App
 */
public class App extends Application {

    private static Scene scene;

    @Override
    public void start(Stage stage) throws IOException {
        pruebaDatos();
    }

    public static void main(String[] args) {
        launch();
    }

    public void pruebaDatos() {
        System.out.println("estoy aqui....");
        String ruta = "objectdb:BBDD/GestionDeServicios.odb;drop";
        EntityManagerFactory emf = Persistence.createEntityManagerFactory(ruta);
        EntityManager em = emf.createEntityManager();
        
        GS_TablaPaises mp = new GS_TablaPaises();
        mp.setCodigoIdPais(10010);
        mp.setNombrePais("Peru");
        mp.setCapitalPais("Lima");
        mp.setDominioInternetPais("PE");
        
        em.getTransaction().begin();
        em.persist(mp);                    //<--  this line causes the error
        em.getTransaction().commit();
        em.close();
        
        System.out.println("pais : "+mp.getNombrePais()+"  : "+mp.getCapitalPais());
    }
}

Pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.jrpa.servicios</groupId>
    <artifactId>Servicios</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>14</maven.compiler.source>
        <maven.compiler.target>14</maven.compiler.target>
    </properties>
  
  <repositories>
        <repository>
            <id>objectdb</id>
            <name>ObjectDB Repository</name>
            <url>https://m2.objectdb.com</url>
        </repository>
    </repositories>
    
  <dependencies>
      <dependency>
          <groupId>org.openjfx</groupId>
          <artifactId>javafx-controls</artifactId>
          <version>15-ea+2</version>
      </dependency>
 
          <!-- https://mvnrepository.com/artifact/org.openjfx/javafx-fxml -->
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>15-ea+2</version>
    </dependency>

      <!--      dependecnicas para persitir la base de datos    -->
      
            <dependency>
            <groupId>com.objectdb</groupId>
            <artifactId>objectdb</artifactId>
            <version>2.8.2</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>javax.persistence</artifactId>
            <version>2.1.0</version>
        </dependency>
        <dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>jta</artifactId>
            <version>1.1</version>
        </dependency>
        
  </dependencies>
  
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>14</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.4</version>
                <configuration>
                    <mainClass>com.jrpa.servicios.Servicios.App</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>

modulo-info.java

module com.jrpa.servicios.Servicios {
    requires javafx.controls;
    requires javafx.fxml;

    requires java.sql;
    requires javax.persistence;            <--   Name of automatic module 'javax.persistence' is unstable, 
                                                              it is derived from the module's file name.

    opens com.jrpa.servicios.Servicios;
    exports com.jrpa.servicios.Servicios;
}

#2

According to the stack trace, and after looking at your source code, the issue may be related to this line:

@Id
private SimpleStringProperty nombrePais

 

See this manual page, regarding what types are allowed for @Id fields.

Unfortunately, the error message that ObjectDB produces in this case is indeed not very helpful.

ObjectDB Support

Reply