gpt4 book ai didi

java - 如何将 EJB 模块从 Netbeans 部署到 Glassfish

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:23:12 26 4
gpt4 key购买 nike

Netbeans 怎么样 @Stateless@Remote EJB 从 EJB module 部署到 Glassfish ?

Netbeans 能够做到这一点,但这是如何在 IDE 之外完成的?

服务器日志:

thufir@dur:~$ 
thufir@dur:~$ tail glassfish-4.1/glassfish/domains/domain1/logs/server.log -n 34
at java.lang.Thread.run(Thread.java:744)
]]

[2014-09-22T01:41:57.266-0700] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=42 _ThreadName=admin-listener(5)] [timeMillis: 1411375317266] [levelValue: 1000] [[
Exception while deploying the app [HelloEJB] : Invalid ejb jar [HelloEJB]: it contains zero ejb.
Note:
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean.
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.]]

[2014-09-22T03:52:08.027-0700] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=40 _ThreadName=admin-listener(3)] [timeMillis: 1411383128027] [levelValue: 800] [[
visiting unvisited references]]

[2014-09-22T03:52:08.067-0700] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=40 _ThreadName=admin-listener(3)] [timeMillis: 1411383128067] [levelValue: 800] [[
visiting unvisited references]]

[2014-09-22T03:52:08.511-0700] [glassfish 4.1] [INFO] [AS-EJB-00054] [javax.enterprise.ejb.container] [tid: _ThreadID=40 _ThreadName=admin-listener(3)] [timeMillis: 1411383128511] [levelValue: 800] [[
Portable JNDI names for EJB HelloBean: [java:global/HelloEJB/HelloBean, java:global/HelloEJB/HelloBean!hello.HelloBeanRemote]]]

[2014-09-22T03:52:08.513-0700] [glassfish 4.1] [INFO] [AS-EJB-00055] [javax.enterprise.ejb.container] [tid: _ThreadID=40 _ThreadName=admin-listener(3)] [timeMillis: 1411383128513] [levelValue: 800] [[
Glassfish-specific (Non-portable) JNDI names for EJB HelloBean: [hello.HelloBeanRemote#hello.HelloBeanRemote, hello.HelloBeanRemote]]]

[2014-09-22T03:52:09.142-0700] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=40 _ThreadName=admin-listener(3)] [timeMillis: 1411383129142] [levelValue: 900] [[
WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]

[2014-09-22T03:52:09.152-0700] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=40 _ThreadName=admin-listener(3)] [timeMillis: 1411383129152] [levelValue: 900] [[
WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]

[2014-09-22T03:52:09.157-0700] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=40 _ThreadName=admin-listener(3)] [timeMillis: 1411383129157] [levelValue: 900] [[
WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]

[2014-09-22T03:52:10.646-0700] [glassfish 4.1] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=40 _ThreadName=admin-listener(3)] [timeMillis: 1411383130646] [levelValue: 800] [[
HelloEJB was successfully deployed in 2,783 milliseconds.]]

thufir@dur:~$


package hello;

import javax.ejb.Stateless;

@Stateless
public class HelloBean implements HelloBeanRemote {

@Override
public String hi() {
return "hello world";
}

@Override
public String bye() {
return "goodbye";
}

}


package hello;

import javax.ejb.Remote;

@Remote
public interface HelloBeanRemote {

public String hi();

public String bye();
}

另见:

Deploying standalone EJB module does not work if EJB module depends on some other jar files - these jars files are ignored and not deployed to server which consequently will result in ClassNotFound exception from EJB module. Similar situation is in AppClient.

This has never ever worked and the problem exists since early 4.x NB versions.

The workaround is to deploy EJB module and its required JARs in EAR project or use command line, eg. "glassfishv3/bin/asadmin deploy --libraries projs/JavaLibrary1/dist/JavaLibrary1.jar projs/EJBModule2/dist/EJBModule2.jar" which deploys standalone EJB module EJBModule2.jar and its required library JavaLibrary1.jar.

https://netbeans.org/bugzilla/show_bug.cgi?id=186331

该错误是否会影响 HelloEJB 的部署? HelloEAR 的代码几乎完全相同,唯一的区别是它在 Netbeans 中创建为 Enterprise Application。用EJB moduleHelloEAR-ejb而不是 HelloEJB作为EJB module .

如果模块不能部署到 glassfish,它们有什么用?正在使用 EJB module一条死胡同,一条通往部署 @Stateless 的错误道路和 @Remote EJB?

最佳答案

尝试做同样的 EJB 模块,但通过企业应用程序创建它。选择新建项目 > Java EE > 企业应用程序。您可以取消选择“Web Application Module”选项,只选择“Create EJB Module”选项。在对您的 EJB 进行编码后,左键单击您的企业应用程序并选择“部署”。 This视频可以帮助您。

关于java - 如何将 EJB 模块从 Netbeans 部署到 Glassfish,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25972994/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com