问题标签 [openjpa-maven-plugin]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1966 浏览

jpa - 警告:注释处理器 'org.apache.openjpa.persistence.meta.AnnotationProcessor6' 小于 -source '1.8'

当用于处理 Java 8 的 Open JPA 元模型时,我从 maven-processor-plugin 收到下面列出的警告。我的项目实际上是构建的,但是对于 Java 8 是否有一个不生成此警告的版本?我没有看到 org.apache.openjpa.persistence.meta.AnnotationProcessor6 的 Java 8 版本。

警告:注释处理器'org.apache.openjpa.persistence.meta.AnnotationProcessor6'支持的源版本'RELEASE_6'低于-source'1.8'

0 投票
1 回答
32 浏览

openjpa - openJPA 配置不持久

我有一个非常小的测试,可以正确配置 openJPA、JTA、数据库连接、增强并且不发出异常,但是它不会与下面的简单代码一起存在。除了将记录实际写入数据库的简单语句之外,我还需要显示什么或需要什么?

持久性.xml

0 投票
0 回答
737 浏览

java - openjpa-maven-plugin 在构建时不增强实体类

我遇到了 OpenJPA 的另一个问题。即使我在我的 pom.xml 中插入了 openjpa-maven-plugin,我的实体似乎也没有得到增强。

这里是错误代码:

这是我的 pom.xml

我首先认为我可能在插件部分注册了我的实体类的错误路径,但我想出的替代方法没有奏效。

我是否需要在我的工作区文件夹或我的 tomcat 的目录结构中指定我的类文件的路径?

在 tomcat 中,路径是:
wtpwebapps/MyProject/WEB-INF/classes/al/das/MyProject/Entities

在我的工作区中:
MyProject/target/classes/al/das/MyProject/Entities

为了安全起见,我当前的 persistence.xml:

有谁知道我做错了什么?

0 投票
1 回答
191 浏览

centos - Apache Drill 的 JPAM 配置

我正在尝试基于 JPAM 1.1 配置 PLAIN 身份验证,并且因为在 x 次检查我的语法和设置后它不起作用,所以我发疯了。当我仅使用 cluster-id 和 zk-connect 开始钻取时,它可以工作,但是使用 PLAIN 身份验证的两个选项都会失败。因为我从 pam4j 开始,后来又尝试了 JPAM,所以我为这篇文章保留了 JPAM。一般来说,我没有任何偏好。我只是想完成它。我在 CentOS 上以嵌入式模式运行 Drill。

由于官方文档,我已经做了任何需要的事情:

  • 我下载了 JPAM 1.1,解压缩并将libjpam.so放入特定文件夹(/opt/pamfile/)

  • 我编辑了 Drill-env.sh: export DRILLBIT_JAVA_OPTS="-Djava.library.path=/opt/pamfile/"

  • 我编辑了Drill-override.conf

    drill.exec: { cluster-id: "drillbits1", zk.connect: "local", impersonation: { enabled: true, max_chained_user_hops: 3 }, security: { auth.mechanisms: ["PLAIN"], }, security.user.auth: { enabled: true, packages += "org.apache.drill.exec.rpc.user.security", impl: "pam", pam_profiles: [ "sudo", "login" ] } }

它引发后续错误:

Error: Failure in starting embedded Drillbit: org.apache.drill.exec.exception.DrillbitStartupException: Problem in finding the native library of JPAM (Pluggable Authenticator Module API). Make sure to set Drillbit JVM option 'java.library.path' to point to the directory where the native JPAM exists.:no jpam in java.library.path (state=,code=0)

我已经手动运行了 *.sh 文件以确保导出了必要的路径,因为我不知道 Drill 是否期望这样。libjpam 的路径应该是已知的。我已经用 sudo 等启动了 Sqlline。没有机会。文档没有帮助。我不明白为什么它如此糟糕而且 imo 不完整。遗憾的是,关于如何详细解决或配置基本用户身份验证的解释为 0。

还是我必须做一些没有被告知但预期的事情?有没有 Apache Drill 本身没有提到的关于 PLAIN 身份验证的先决条件?

0 投票
3 回答
541 浏览

java - How to enhance classes properly at build time using Maven? OpenJPA

I am trying to enhance (entities) classes so i will not get this Exception:

saying that my instance i am trying to persist is not enhanced.

I have followed this: https://openjpa.apache.org/enhancement-with-maven.html official openjpa page and added openjpa-maven-plugin to the section of my pom.xml:

, but i still get that exception. I am using Eclipse and built in command Run As -> Maven install. I also tried to run mvn install from command line. Then i just try to persist some entity using EntityManager.

Running mvn install with and without openjpa-maven-plugin does not change anything (same .jar generated with same .class files, same maven output to console)

As answer says, i needed to run openjpa:enhance goal when building with Maven. I was de facto not using openjpa-maven-plugin, so i fixed that. Maven output:

You can see i run enhancer on EntityPerson class, which is simple JPA entity i tested this on. However i still get that Exception. I noticed maven-compiler-plugin:3.8.1:compile running twice. Before and after openjpa-maven-plugin:3.1.2:enhance - might this be problem?

I think this is not my case: How to enhance a class from a separate jar at build time with openJPA?

Found there is workaround Attempt to cast instance to PersistenceCapable failed. Ensure that it's been enhanced by setting some attribute in configuration as accepted answer says, but i do not want to do it that way, as first comment says it is not recommended and points to the official openjpa page, where i found that example how to enhance classes during maven build time, but as i wrote, it does not work.

Testing main method:

EntityPerson class:

persistence.xml:

Project structure:

Project structure

Steps to reproduce:

  1. Crete Maven project in Eclipse
  2. Copy my pom.xml (or add dependencies to derby, openjpa and set up your openjpa-maven-plugin, names and paths)
  3. Copy my persistence.xml (or create your own with some persistence unit)
  4. Copy my EntityPerson class (or create simple JPA entity to test it on)
  5. Run mvn clean compile openjpa:enhance install (important part is openjpa:enhance)
  6. Try to persist entity as i did in my main method
0 投票
1 回答
68 浏览

java - Maven - 如何在使用 openjpa 插件时只运行一次编译目标

当我运行时,mvn clean compile openjpa:enhance install我注意到compile目标运行了两次——在它之前openjpa:enhance和之后一次(也与resources),这导致增强的类openjpa:enhance被丢弃,因为它们被再次编译并重写。

如何更改 pom.xml 或mvn命令参数,使其不会运行compile两次,但之前只运行一次openjpa:enhanceinstall最后是需要的。

pom.xml:

输出mvn clean compile openjpa:enhance install

0 投票
0 回答
38 浏览

java - 使用带有配置文件构建 openjpa-maven-plugin 的 Maven 进行编译不起作用

  • Maven 命令行

    mvn clean deploy -X -U -P aws -Dprofile=jboss -Pjboss -Dmaven.repo.local=./newrepo

  • 在 Maven 中配置的配置文件。

在此处输入图像描述

  • 将 Nexus 迁移到另一台服务器后,该错误开始发生。

  • 使用maven构建项目时会出现以下错误。

0 投票
1 回答
59 浏览

java - Openjpa maven插件错误:无法执行目标:增强

我正在进行迁移活动(JDK 1.8 到 JDK 11)

  • 我的pom.xml

它在 JDK 1.8 上运行良好,当我将 JDK 版本更改为 11 时,我在运行mvn install时遇到了这个问题。

下面是我得到的错误。

错误.

谁能帮我解决这个问题。