问题标签 [glassfish-4]

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 投票
0 回答
791 浏览

servlets - GlassFish 4 中的 HttpServletRequest#getReader() 为空

我在 GlassFish 4 下遇到了一个奇怪的问题。我正在将 POST 请求中的原始数据(使用 jQuery)发送到 servlet。由于阅读器为空(立即返回-1),通过 request.getReader() 读取 doPost 中的数据失败。但是,如果我更改代码:

至:

是成功。请注意,使用 Tomcat 6,7 或 Jetty 时 request.getReader() 不为空。有谁知道 GlassFish 4 有什么问题?这是一个完整的简单片段来演示该问题:

0 投票
1 回答
1178 浏览

jsf-2.2 - Passing JSF URL parameters to CDI Bean

I am in the process of redesigning a project and I've come across what I think is a bug but Im confused as to where the bug is originating from.

Basically all I am trying to do is pass a URL parameter to the backing bean. Nothing magic and there are loads of different ways of achieving this. The following are the ones I use regularly;

  1. I can change the bean from @Named to @ManagedBean and then use the @ManagedProperty
  2. I can access the param using FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap() and then get the desired param from the Map
  3. Or I can use: <f:metadata><f:viewParam name="id" value="#{backingBean.id}"/></f:metadata>

When I'm using JSF 2.1 with Glassfish 3+ all three of these work perfectly. The problem is that my current project is using JSF 2.2 and Glassfish 4 and none of these work! No matter what I do the parameter is never set and always just ends up as null.

I'm not sure how to track this down further. The obvious changes from the last project are that I am using Glassfish 4 instead of 3, JavaEE 7 instead of 6, and JSF 2.2 instead of 2.1. I don't get any errors or exceptions that I can post.

Is there anything else I can test or any alternative solutions I can try. Failing that is anybody aware of any reported bugs or changes that might cause this. Lastly can anybody reproduce this error?

0 投票
1 回答
2137 浏览

java - EclipseLink Expecting to find object/array on stack

I am getting the belo error while deploying an EAR (example of chapter 8 - EJB 3 in Action ) in glassfish4. I didn't find anything much on this error. Please help me resolve this error.

Here is the BillingInfo class definition.

0 投票
0 回答
6961 浏览

maven - 解决 org.glassfish.deployment.common.DeploymentException:CDI 部署失败 - Cassandra Datastax Java 驱动程序、Maven、Glassfish 4

我只是将这个作为解决方案发布给那些在通过 Maven 部署在 Glassfish 4 上使用 Datastax 的 Java 驱动程序时遇到错误的人。

正如在 Datastax 的网站上所写,驱动程序的依赖项是:

不幸的是,如果你通过 Maven 将它部署到 Glassfish 4,它会抛出 org.glassfish.deployment.common.DeploymentException: CDI deployment failure... 就像下面这样:

因此,要解决这个问题,只需在部署到 Glassfish 4 时将 xml 部分更改为:

希望能帮助到你。

0 投票
2 回答
7535 浏览

jakarta-ee - 无法找到或提供资源

我正在 Glassfish 4 服务器上使用 Java EE 6 和 Primefaces 制作 Web 应用程序。我越来越频繁地遇到同样烦人的错误。我试图用谷歌搜索这个问题,但我还没有找到可行的解决方案。有时应用程序运行时完全没有问题,但突然之间,同样的错误会一遍又一遍地发生。这是我的堆栈跟踪:

同样的错误会发生多次,但随后无法提供资源,例如:jquery/jquery-plugins.js、layout/layout.js、jquery/jquery.js、primefaces.js。全部来自 Primefaces 库。

这个错误困扰了我很长一段时间,我们将不胜感激!

0 投票
1 回答
3594 浏览

glassfish-4 - CDI / Weld Unsatisfied 依赖问题

我有一个奇怪的 CDI / Weld 问题,我无法找到解决方案。

我刚刚安装了 GlassFish 4,打算将我们的主要产品移到它上面,但是当我尝试部署它时,我在日志文件中得到了下面显示的堆栈跟踪(并且它无法部署)。

这是一个成熟的应用程序,用于多个位置的 GlassFish 3.1.x 生产,所以我知道代码很好(至少在 JEE6 上)。

我什至不知道从哪里开始寻找这个,因为堆栈跟踪甚至没有靠近我的任何代码。我已经查找了ValidationInterceptor该类的源代码,显然Validator错误消息中提到的是类型javax.validation.Validator,但这无济于事,因为我没有在我的代码中实现该接口。

感谢您提供有关在哪里查看/如何解决此问题的任何指示。

0 投票
1 回答
1981 浏览

security - Why can't the login page for form-based authentication be written in JSF?

I'm just starting down the track of developing web apps and have started with JSF 2.2 on Java EE 7, GlassFish 4.

I thought I'd start with the very basics. I just want to protect the entire site, so every page you navigate to would first require you to authenticate yourself. So I read through the Java EE 7 Tutorial and tried the samples, modified them and then started to break them in ways I didn't think they would break. I tried all sorts of angles, but I'd generally end up in two situations:

  1. I'd try to access a page using a partial request, which would land me at /index.xhtml as defined by <welcome-file-list>, and be prompted to login; but on submitting the username/password I'd be instantly directed back to the login form.
  2. I added an action to the <h:commandButton> to point to index. This worked, but when I submitted the form on the index page which should take me to the response.xhtml page, I'd end up back at the login form instead of at the response page.

After many hours of trawling the net, it seemed that the reason I had broken the login procedure was because I had changed the plain HTML login form to use JSF tags like <h:form>, instead of <form>.

There is a discussion here that says you should not do this with login forms. To quote an interesting line from that page:

To make such a page login, make the actual login form be HTML and not JSF and code it according to the j2EE standards for login forms. Use the HTML form tag instead of the JSF form, and make sure you code an HTML SUBMIT button and not a JSF commandButton!

Once I changed it back to plain old HTML it worked. But I don't understand why. Can anyone enlighten me?! I think I am missing something fundamental which I need to understand if I'm going to start writing web apps in JSF.

Many thanks...

0 投票
2 回答
1353 浏览

mysql - EJB 未知的抽象模式,但它存在于数据库中

我在这个问题上被阻止了好几个小时,我不明白这个问题,因为它适用于我项目的另一个实体。我在 Eclipse IDE 中使用 Glassfish 4、JPA 2 和 EJB 3 创建了一个 Java EE 项目。我正在使用 mysql 数据库进行存储。

我创建了一个名为 Company 的实体 bean 和一个 DAO 来管理它。我做了所有需要的工作,而且效果很好。问题是我对另一个名为 Newsletter 的实体 bean 做了完全相同的事情,但是这个不起作用。Java 抛出一个 EJBException,告诉我抽象模式是未知的,但它存在于数据库中。表 company 和 newsletter 在同一个数据库中,所以我对它们都使用了相同的持久性单元。

我在 Google 或这里找到的一些问题通过将类添加到 persitence-unit 来解决,我做到了,但它仍然给我一个异常。

这是我的 NEWSLETTER 表:

我的豆子通讯:

这是我的persistence.xml:

和 DAO 类:

最后,这是我的异常的堆栈跟踪:

如果任何人有想法,那将非常有帮助!对不起,有些英语错误,这不是我的母语......

0 投票
2 回答
4491 浏览

netbeans - Java EE7/Glassfish 更新工具不显示

我正在尝试在我的 Windows 7 笔记本电脑上完成 Java EE 7 教程。

要使用本教程,您必须运行更新工具。您可以通过右键单击 NetBeans 的“服务”部分的“服务器”下的 Glassfish 4 来运行更新工具。或者您可以使用开始>所有程序>Java EE 7 SDK>开始更新工具来获得它。我已经尝试了两种方法,并且得到了相同的结果,即使在经历了告诉 NetBeans 安装更新工具的过程之后: 光标显示计算机正在思考,然后......什么也没有。什么都没有发生。

谁能帮我弄清楚为什么更新工具没有打开?

0 投票
0 回答
34 浏览

jsf - 玻璃鱼4在netbeans 7.3.1中启动失败

我已经使用 GlassFish Server 4 安装了 Netbeans 7.3.1,但是当我运行 web 应用程序(JSF-primcefaces + Hibernate)默认 jsp(index.xhtml)页面或任何其他页面时,我得到了错误: