天道酬勤,学无止境

glassfish-4.1

ClassCastException with Lucene

I´m working on a web application with Hibernate Search using Lucene. I updatetd this application to Hibernate 5.5.1 (former 4.3.5 (hibernate-core ) 4.3.10 (hibernate-entity-manager). I´ve created an lucene index (version 4.7) with the former application. And I think the problem is maybe the older index version. When I try to deploy my application I get the following stacktrace: Schwerwiegend: java.lang.ExceptionInInitializerError at org.apache.lucene.codecs.PostingsFormat.forName(PostingsFormat.java:112) at org.apache.lucene.codecs.lucene40.Lucene40Codec.<init>(Lucene40Codec.java:115) at sun

2022-01-17 03:15:39    分类:问答    hibernate   jpa   lucene   hibernate-search   glassfish-4.1

什么是“Java EE 7 API 库”和“Java EE Web 7 API 库”以及何时使用它们?(What are "Java EE 7 API Library" and "Java EE Web 7 API Library" and when to use them?)

问题 我有一个不使用 Apache Maven 在 GlassFish 4.1 / Java EE 7 (NetBeans 8.0.2) 上运行的成熟 Java EE 项目。 根据项目功能,必须将 CDI 依赖项添加到项目/模块,即 EE 模块和 Web 模块(以及类库,如果有的话)。 很长一段时间以来,看到有人建议将“Java EE 7 API 库”或“Java EE Web 7 API 库”作为 CDI 依赖项添加到编译时类路径中(这些库捆绑在 NetBeans 和开箱即用,使用 NetBeans 时)。 由于这些库包含一系列 API,可能是从 Servlet API 开始的整个 Java EE 堆栈,因此当 CDI 功能是在 Java EE 应用程序中需要。 当只有cdi-api.jar作为 CDI 依赖项就足够时,为什么多次建议特别是在 NetBeans 项目中添加这些库之一? 当 Java EE 应用程序需要 CDI 功能时,我在此站点或其他地方都没有找到关于在 NetBeans 项目中确切添加哪个库的规范答案。 顺便说一句,只添加cdi-api.jar就可以了。 回答1 所有javaee-api 、 javaee-web-api和 cdi cdi-api都只是 API 定义。 它们不包含功能,它们仅包含必要的接口,而不是使您的代码编译。 结果是javaee

2022-01-16 19:08:01    分类:技术分享    jakarta-ee   netbeans   glassfish   java-ee-7   glassfish-4.1

What are "Java EE 7 API Library" and "Java EE Web 7 API Library" and when to use them?

I have a full-fledged Java EE project running on GlassFish 4.1 / Java EE 7 (NetBeans 8.0.2) not using Apache Maven. Depending upon the project functionality, the CDI dependency has to be added to both the projects/modules namely the EE module and the Web module (and a class library, if any). I have been confusing for a long time seeing people recommending to add either "Java EE 7 API Library" or "Java EE Web 7 API Library" to the compile-time class-path as a CDI dependency (these libraries are bundled in NetBeans and readily available out of the box, when using NetBeans). Since these libraries

2022-01-16 17:50:04    分类:问答    jakarta-ee   netbeans   glassfish   java-ee-7   glassfish-4.1

com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector 未找到 --- 使用 Swagger 时(com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector not found --- while using Swagger)

问题 我在 SO 上的第一篇文章并期待好东西的回报:-) 我开发了一个小型 java 宁静服务应用程序并与 Swagger 集成。 我有 @Controller -> @Service -> @Repository 架构。 我已经部署在 Glassfish (4.1.1) 上,当我使用 Chrome 的“高级休息客户端”时,我能够完美地发送和接收休息调用(GET/POST 等),但是当我使用 Swagger 时,它会抛出以下异常“在控制器返回正确的响应之后'。 我一直在通过更改 maven 入口版本、更改 moxy jar、按照某些论坛中的建议删除 felix 等来解决这个问题,但似乎没有任何帮助。 这里有更多细节... 例外: StandardWrapperValve[com.xxx.config.ApplicationConfig]: Servlet.service() for servlet com.xxx.config.ApplicationConfig threw exception java.lang.ClassNotFoundException: com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector not found by com.fasterxml.jackson.jaxrs.jackson

2022-01-13 17:54:58    分类:技术分享    java   maven   swagger   glassfish-4.1

EclipseLink 反序列化远程 EJB 调用上的空实体对象(EclipseLink deserializes an empty entity object on remote EJB call)

问题 我正在使用当前版本的 GlassFish 4.1,其中包含 EclipseLink 版本 2.5.2。 在这个 GlassFish 中,我部署了一个企业应用程序和一个 Web 应用程序。 如果从 GlassFish 外部(如外部 JavaFX 应用程序)调用返回已加载实体的 EJB,则会正确返回实体。 但是,如果从 Web 应用程序调用相同的 EJB,由于此错误 GLASSFISH-17432,实体不会正确返回。 我已经在这里找到的解决方法 Calling Remote EJB in EJB 3.1 并不能真正解决这个问题,因为如果我在 EclipseLink 中禁用编织,以下操作将无法正常工作: @ManyToOne(fetch=FetchType.LAZY) public Foo getFoo() { return foo; } @ManyToOne(fetch=FetchType.EAGER) public Bar getBar() { return bar; } 回答1 您可以尝试静态编织作为另一种解决方法。 字节码编织是一种用于更改已编译 Java 类的字节码的技术。 您可以配置字节码编织以启用许多 EclipseLink JPA 性能优化,包括对一对一和多对一关系的延迟加载、属性级更改跟踪和获取组的支持。 编织可以在加载实体类时动态执行

2022-01-13 17:15:23    分类:技术分享    jpa   glassfish   eclipselink   jpa-2.1   glassfish-4.1

EclipseLink deserializes an empty entity object on remote EJB call

I am using the current release of GlassFish 4.1 with EclipseLink version 2.5.2 included. At this GlassFish, I have an enterprise application and a web application deployed. If an EJB that returns a loaded entity, is called from outside the GlassFish (like an external JavaFX application), the entity is returned properly. But if the same EJB is called from the web application, the entity is not returned properly due to this bug GLASSFISH-17432. The workaround I already found here Calling Remote EJB in EJB 3.1 is not really solving this problem, because if I disable the weaving in EclipseLink

2022-01-13 09:28:47    分类:问答    jpa   glassfish   eclipselink   jpa-2.1   glassfish-4.1

访问 JAX-WS 服务时 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:272) 处的 java.lang.NullPointerException(java.lang.NullPointerException at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:272) while accessing JAX-W

问题 在 Java EE 7 应用程序中实现 JAX-WS 服务时出现以下异常。 Warning: Internal Server error: /Test-war/Test.xhtml java.lang.NullPointerException at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:272) at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175) at org.glassfish.grizzly.http.server

2022-01-12 19:52:38    分类:技术分享    jakarta-ee   glassfish   jax-ws   java-ee-7   glassfish-4.1

java.lang.NullPointerException at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:272) while accessing JAX-WS services

I'm getting the following exception while implementing JAX-WS services in a Java EE 7 application. Warning: Internal Server error: /Test-war/Test.xhtml java.lang.NullPointerException at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:272) at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201) at org.glassfish.grizzly.http.server.HttpHandler.doHandle

2022-01-09 18:39:44    分类:问答    jakarta-ee   glassfish   jax-ws   java-ee-7   glassfish-4.1

com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector not found --- while using Swagger

my first post on SO and expecting good stuff in return :-) I have developed a small java restful services app and integrated with Swagger. I have @Controller -> @Service -> @Repository architecture. I have deployed on Glassfish (4.1.1), when I use Chrome's 'Advanced Rest Client', I am able to perfectly send and receive rest calls (GET/POST etc), but when I use Swagger, it throws the following exception 'after Controller returns the correct response'. I have been struggling with this by changing the maven entry versions, changing the moxy jar, delting felix as suggested in some forums etc, none

2022-01-08 18:03:58    分类:问答    java   maven   swagger   glassfish-4.1

用于集成和单元测试的 Java EE 7 便携式解决方案(Java EE 7 Portable solution for Integration and Unit testing)

问题 我正在尝试寻找一种可移植的解决方案来测试我的 Java EE 7 应用程序。 测试 EJB 及其注入时尤其棘手。 例如: @org.junit.Test public void testIsValidCredentials() throws Exception { System.out.println("isValidCredentials"); String username = ""; String password = ""; Map properties = new HashMap(); properties.put(EJBContainer.MODULES, new File[] {new File("target/classes")}); EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer(); AuthenticatorLocal instance = (AuthenticatorLocal) container.getContext().lookup("java:global/classes/Authenticator"); boolean expResult = false; boolean result = instance

2021-12-12 13:05:36    分类:技术分享    jakarta-ee   junit   wildfly   java-ee-7   glassfish-4.1