很好的一天!
我正在从glassfish迁移到JBoss 7.1.3。我有。无法创建远程连接的ear应用程序。我猜我的EJB有问题。
下面是我部署的EJB(来自服务器日志)
*10:10:56,226 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named GGICache in deployment unit subdeployment "GGI-ejb.jar" of deployment "GGI.ear" are as follows:
java:global/GGI/GGI-ejb/GGICache!ge.nbsm.weGGI.ejb.cache.GGICacheHome
java:app/GGI-ejb/GGICache!ge.nbsm.weGGI.ejb.cache.GGICacheHome
java:module/GGICache!ge.nbsm.weGGI.ejb.cache.GGICacheHome
java:jboss/exported/GGI/GGI-ejb/GGICache!ge.nbsm.weGGI.ejb.cache.GGICacheHome
java:global/GGI/GGI-ejb/GGICache!ge.nbsm.weGGI.ejb.cache.GGICacheRemote
java:app/GGI-ejb/GGICache!ge.nbsm.weGGI.ejb.cache.GGICacheRemote
java:module/GGICache!ge.nbsm.weGGI.ejb.cache.GGICacheRemote
java:jboss/exported/GGI/GGI-ejb/GGICache!ge.nbsm.weGGI.ejb.cache.GGICacheRemote
10:10:56,268 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named GGIDBOperation in deployment unit subdeployment "GGI-ejb.jar" of deployment "GGI.ear" are as follows:
java:global/GGI/GGI-ejb/GGIDBOperation!ge.nbsm.weGGI.ejb.DBOperation.GGIDBOperationHome
java:app/GGI-ejb/GGIDBOperation!ge.nbsm.weGGI.ejb.DBOperation.GGIDBOperationHome
java:module/GGIDBOperation!ge.nbsm.weGGI.ejb.DBOperation.GGIDBOperationHome
java:jboss/exported/GGI/GGI-ejb/GGIDBOperation!ge.nbsm.weGGI.ejb.DBOperation.GGIDBOperationHome
java:global/GGI/GGI-ejb/GGIDBOperation!ge.nbsm.weGGI.ejb.DBOperation.GGIDBOperationRemote
java:app/GGI-ejb/GGIDBOperation!ge.nbsm.weGGI.ejb.DBOperation.GGIDBOperationRemote
java:module/GGIDBOperation!ge.nbsm.weGGI.ejb.DBOperation.GGIDBOperationRemote
java:jboss/exported/GGI/GGI-ejb/GGIDBOperation!ge.nbsm.weGGI.ejb.DBOperation.GGIDBOperationRemote*
下面是我在资源调配器中的上下文查找。java代码
*Properties jndiProps = new Properties();
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProps.put(Context.SECURITY_PRINCIPAL, "admin");
jndiProps.put(Context.SECURITY_CREDENTIALS, "adminadmin");
jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
jndiProps.put(Context.PROVIDER_URL, "remote://localhost:4447");
jndiProps.put("jboss.naming.client.ejb.context", true);
try{
ctx = new InitialContext(jndiProps);
String strDSName = "java:jboss/datasources/Functional_GGI_CONNECTION_POOL";
ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup(strDSName);
System.out.println("Context Look Up success>>" + ds.getClass());
return ds;
} catch (NamingException namingException) {
log.error(namingException.getMessage(), namingException);
}*
下面我已经粘贴了我的服务器。日志和我的应用程序日志供您参考。我遇到错误,比如无法创建远程连接。我在加载包含上述属性的初始上下文时遇到问题。。。ctx=新的初始上下文(jndiProps);
10:11:07,998 ERROR [stderr] (MSC service thread 1-2) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
10:11:08,004 ERROR [stderr] (MSC service thread 1-2) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
10:11:08,010 ERROR [stderr] (MSC service thread 1-2) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
10:11:08,015 ERROR [stderr] (MSC service thread 1-2) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
10:11:08,020 ERROR [stderr] (MSC service thread 1-2) at java.lang.Thread.run(Thread.java:722)
10:11:08,066 ERROR [stderr] (MSC service thread 1-2) Caused by: java.lang.RuntimeException: Failed to setup EJB remote context
10:11:08,071 ERROR [stderr] (MSC service thread 1-2) at org.jboss.naming.remote.client.InitialContextFactory.setupEjbContext(InitialContextFactory.java:468)
10:11:08,077 ERROR [stderr] (MSC service thread 1-2) at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:145)
10:11:08,086 ERROR [stderr] (MSC service thread 1-2) ... 17 more
10:11:08,089 ERROR [stderr] (MSC service thread 1-2) Caused by: java.lang.reflect.InvocationTargetException
10:11:08,095 ERROR [stderr] (MSC service thread 1-2) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:11:08,100 ERROR [stderr] (MSC service thread 1-2) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
10:11:08,106 ERROR [stderr] (MSC service thread 1-2) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:11:08,112 ERROR [stderr] (MSC service thread 1-2) at java.lang.reflect.Method.invoke(Method.java:601)
10:11:08,118 ERROR [stderr] (MSC service thread 1-2) at org.jboss.naming.remote.client.InitialContextFactory.setupEjbContext(InitialContextFactory.java:448)
10:11:08,124 ERROR [stderr] (MSC service thread 1-2) ... 18 more
10:11:08,128 ERROR [stderr] (MSC service thread 1-2) Caused by: java.lang.SecurityException: EJBCLIENT000021: EJB client context selector may not be changed
10:11:08,134 ERROR [stderr] (MSC service thread 1-2) at org.jboss.ejb.client.EJBClientContext.setSelector(EJBClientContext.java:186)
10:11:08,139 ERROR [stderr] (MSC service thread 1-2) at org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector.setupSelector(RemoteNamingEjbClientContextSelector.java:28)
10:11:08,148 ERROR [stderr] (MSC service thread 1-2) ... 23 more
10:11:08,191 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/GGI]] (MSC service thread 1-2) Exception sending context initialized event to listener instance of class ge.ifm.common.utility.IFMCacheListener: ge.ifm.common.exception.GenericInterfaceException: Throwable-->Occured while loading Interface Configuration information. Exception Message is -->null
at ge.ifm.common.utility.IFMCacheListener.contextInitialized(IFMCacheListener.java:110) [classes:]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.17.Final-redhat-1.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.17.Final-redhat-1.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:89) [jboss-as-web-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
Caused by: java.lang.NullPointerException
at ge.nbsm.weGGI.DAO.GGIDAO.getDBConnection(GGIDAO.java:62) [GGI-ejb.jar:]
at ge.ifm.dao.GenericInterfaceDAO.initialize(GenericInterfaceDAO.java:33) [classes:]
at ge.ifm.dao.InterfaceDao.initialize(InterfaceDao.java:239) [classes:]
at ge.ifm.common.utility.IFMCacheListener.contextInitialized(IFMCacheListener.java:75) [classes:]
... 8 more
10:11:08,291 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-2) Error listenerStart
10:11:08,297 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-2) Context [/GGI] startup failed due to previous errors
10:11:08,304 ERROR [stderr] (MSC service thread 1-2) log4j:WARN No appenders could be found for logger (ge.nbsm.weGGI.common.utility.GGILifeCycleListener).
10:11:08,318 ERROR [stderr] (MSC service thread 1-2) log4j:WARN Please initialize the log4j system properly.
10:11:08,324 ERROR [stderr] (MSC service thread 1-2) log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
10:11:08,331 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.web.deployment.default-host./GGI: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./GGI: JBAS018040: Failed to start context
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:94)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA-redhat-2.jar:1.0.2.GA-redhat-2]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA-redhat-2.jar:1.0.2.GA-redhat-2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
10:11:08,579 INFO [org.jboss.as.server] (HttpManagementService-threads - 6) JBAS015870: Deploy of deployment "GGI.ear" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./GGI" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./GGI: JBAS018040: Failed to start context"},"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.deployment.subunit.\"GGI.ear\".\"GGI-ejb.jar\".jndiDependencyService Missing[JBAS014861: <one or more transitive dependencies>]","jboss.deployment.subunit.\"GGI.ear\".\"GGI-war.war\".jboss.security.jacc Missing[JBAS014861: <one or more transitive dependencies>]","jboss.naming.context.java.comp.GGI.GGI-ejb.GGIDBOperation.env.Functional_GGI_CONNECTION_POOL Missing[jboss.naming.context.java.jboss.resources.Functional_GGI_CONNECTION_POOL]","jboss.naming.context.java.comp.GGI.GGI-ejb.GGICache.env.Functional_GGI_CONNECTION_POOL Missing[jboss.naming.context.java.jboss.resources.Functional_GGI_CONNECTION_POOL]","jboss.deployment.subunit.\"GGI.ear\".\"GGI-ejb.jar\".component.GGICache.START Missing[JBAS014861: <one or more transitive dependencies>]","jboss.deployment.subunit.\"GGI.ear\".\"GGI-ejb.jar\".component.GGIDBOperation.START Missing[JBAS014861: <one or more transitive dependencies>]"]}
10:11:08,581 INFO [org.jboss.as.osgi] (MSC service thread 1-1) JBAS011908: Unregister module: Module "deployment.GGI.ear.GGI-war.war:main" from Service Module Loader
Below is my application log
2013-04-25 10:11:02,503 DEBUG ge.nbsm.weGGI.common.utility.GGILifeCycleListener - Path for FunctionalLog4j ---- jar:file:/C:/jboss-eap-6.0/modules/com/company/test/main/test.jar!/FunctionalLog4j.xml
2013-04-25 10:11:02,512 DEBUG ge.nbsm.weGGI.common.utility.GGILifeCycleListener - in log testing propertiesnull
2013-04-25 10:11:02,512 INFO ge.nbsm.weGGI.common.utility.GGILifeCycleListener - LOG4J Configuration [OK]..
2013-04-25 10:11:02,532 DEBUG ge.nbsm.weGGI.common.utility.StartupCacher - At the Start of loadCache
2013-04-25 10:11:02,544 DEBUG ge.nbsm.weGGI.common.utility.StartupCacher - At the End of loadCache 2
2013-04-25 10:11:02,552 DEBUG ge.nbsm.weGGI.common.utility.StartupCacher - At the End of loadCache 3
2013-04-25 10:11:02,552 DEBUG ge.nbsm.weGGI.Delegate.CacherDelegate - getCacheValues:1
2013-04-25 10:11:02,553 DEBUG ge.nbsm.weGGI.Delegate.CacherDelegate - getGGICacheManagerRemote:1
2013-04-25 10:11:02,560 DEBUG ge.nbsm.weGGI.common.utility.GGIReader - String Value from Properties file:Start of Value||End of Value
2013-04-25 10:11:02,560 DEBUG ge.nbsm.weGGI.common.utility.GGIReader - Numeric Value from Properties file:Start of Value|-1|End of Value
2013-04-25 10:11:02,570 DEBUG ge.nbsm.weGGI.common.utility.GGIReader - Date Value from Properties file:Start of Value|99991231|End of Value
2013-04-25 10:11:02,570 DEBUG ge.nbsm.weGGI.Delegate.CacherDelegate - GGIConstants.STR_GGICACHEHOME >>> ejb:app/GGI/GGI-ejb/GGICache!ge.nbsm.weGGI.ejb.cache.GGICacheHome
2013-04-25 10:11:02,574 DEBUG ge.nbsm.weGGI.Delegate.CacherDelegate - getGGICacheManagerRemote:1a
2013-04-25 10:11:02,574 DEBUG ge.nbsm.weGGI.Delegate.CacherDelegate - getGGICacheManagerRemote:2
2013-04-25 10:11:07,710 INFO ge.ifm.common.utility.IFMCacheListener - IFM initialize() started
2013-04-25 10:11:08,152 ERROR ge.nbsm.weGGI.common.utility.ResourceLocator - Failed to create remoting connection
javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Failed to setup EJB remote context]
at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:51)
at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:151)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
at javax.naming.InitialContext.init(InitialContext.java:242)
at javax.naming.InitialContext.<init>(InitialContext.java:216)
at ge.nbsm.weGGI.common.utility.ResourceLocator.lookUP(ResourceLocator.java:68)
at ge.nbsm.weGGI.DAO.GGIDAO.getDBConnection(GGIDAO.java:56)
at ge.ifm.dao.GenericInterfaceDAO.initialize(GenericInterfaceDAO.java:33)
at ge.ifm.dao.InterfaceDao.initialize(InterfaceDao.java:239)
at ge.ifm.common.utility.IFMCacheListener.contextInitialized(IFMCacheListener.java:75)
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850)
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:89)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: Failed to setup EJB remote context
at org.jboss.naming.remote.client.InitialContextFactory.setupEjbContext(InitialContextFactory.java:468)
at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:145)
... 17 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.naming.remote.client.InitialContextFactory.setupEjbContext(InitialContextFactory.java:448)
... 18 more
Caused by: java.lang.SecurityException: EJBCLIENT000021: EJB client context selector may not be changed
at org.jboss.ejb.client.EJBClientContext.setSelector(EJBClientContext.java:186)
at org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector.setupSelector(RemoteNamingEjbClientContextSelector.java:28)
... 23 more
2013-04-25 10:11:08,191 ERROR ge.ifm.common.exception.GenericInterfaceException - GenericInterfaceException: Throwable-->Occured while loading Interface Configuration information. Exception Message is -->null
2013-04-25 10:11:08,191 DEBUG ge.ifm.dao.GenericInterfaceDAO - closeConnection method called
2013-04-25 10:11:08,191 DEBUG ge.ifm.dao.GenericInterfaceDAO - closeConnection cConn=null
2013-04-25 10:11:08,191 DEBUG ge.ifm.dao.GenericInterfaceDAO - out of if loop
2013-04-25 10:11:08,303 INFO ge.ifm.common.utility.IFMCacheListener - Enterted into contextDestroyed() method
2013-04-25 10:11:08,304 DEBUG ge.ifm.common.utility.IFMCacheListener - contextDestroyed ()--> Context Destroyed Method Called Successfully
2013-04-25 10:11:08,304 INFO ge.ifm.common.utility.IFMCacheListener - Enterted into release() method
2013-04-25 10:11:08,304 DEBUG ge.ifm.common.utility.IFMCacheListener - release()--> Releasing Thread Pool
2013-04-25 10:11:08,304 DEBUG ge.ifm.common.utility.IFMCacheListener - release()--> Closed the Thread Pool [OK]
2013-04-25 10:11:08,304 DEBUG ge.ifm.common.utility.IFMCacheListener - Http Client Connection Pool Releasing
2013-04-25 10:11:08,304 DEBUG ge.ifm.common.utility.IFMCacheListener - Closed the Http Client Connection Pool [OK]
2013-04-25 10:11:08,304 INFO ge.ifm.common.utility.IFMCacheListener - Exit from release() method
2013-04-25 10:11:08,304 INFO ge.ifm.common.utility.IFMCacheListener - Exit from contextDestroyed() method
我通过在执行数据源查找时删除初始化上下文中的属性,解决了这个问题。在执行EJB缓存远程查找时添加的属性。我在我的EJB会话bean和EJB Remote中添加了一个选项,并且由于JBoss javax中的类强制转换异常而更改了上述代码。rmi。PortableRemoteObject。
非常感谢大家。。
下面是我的数据源查找
try {
ctx = new InitialContext();
String strDSName = "java:jboss/datasources/Functional_GGI_CONNECTION_POOL";
ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup(strDSName);
return ds;
}catch (NamingException e){
}
下面是我的EJB远程上下文查找
Properties prop =new Properties();
prop.put("java.naming.factory.url.pkgs", "org.jboss.ejb.client.naming");
Context ctx = new InitialContext(prop);
String cacheHome="ejb:GGI/GGI-ejb/GGICacheBean!ge.nbsm.weGGI.ejb.cache.GGICacheRemote";
ggiManager = (GGICacheRemote)ctx.lookup( cacheHome);
下面是我的CacheBean.java(包括注解)
@Stateless
@Remote(GGICacheRemote.class)
@TransactionManagement(TransactionManagementType.BEAN)
public class GGICacheBean implements GGICacheRemote, SessionBean {
下面是我的CacheRemote.java(包括注解)
@Remote
public interface GGICacheRemote extends EJBObject {
public GGICacheVO getCacheValues() throws Exception, RemoteException;
}
我已经删除了jboss-ejb3。xml和ejb jar。xml。
我的申请工作正常...
我试图使用远程SSH扩展来编辑Debian服务器上的文件。SSH连接已正确建立,但随后我收到一条错误消息: 和日志: 我在其他几个服务器上使用远程ssh连接,从来没有出现过这个错误。我已经测试了从网络上收集的一些东西,但到目前为止没有任何效果。 有人能告诉我问题的原因或可能的解决方案吗?谢谢
我试图连接到我的mongo数据库在我的远程服务器: 但我有一个错误: MongoDB外壳版本:2.6.10连接到:xxx。xxx。xxx。xx:27017/测试2016-11-07T05:18:39.140 0000警告:无法连接到xxx。xxx。xxx。xx:27017,原因:错误号:111连接被拒绝2016-11-07T05:18:39.142 0000错误:无法连接到服务器xxx。xxx。x
问题内容: 我正在尝试打开与远程计算机上运行的Java应用程序的JMX连接。 应用程序JVM配置有以下选项: com.sun.management.jmxremote com.sun.management.jmxremote.port = 1088 com.sun.management.jmxremote.authenticate = false com.sun.management.jmxrem
问题内容: 我一直在localhost上建立一个网络,当我尝试在主机上移动它时,它显示了很多错误。似乎无法连接到我的本地数据库。这是代码: 这是输出: 感谢帮助 问题答案: 这是mysql用户权限问题。例如,使用phpmyadmin创建一个新用户,如果从localhost连接,则将其主机设置为localhost;如果从外部连接,则将其主机设置为%。
我在连接到公共托管的静态IP mysql服务器时遇到了一个奇怪的问题。 我能够使用MySQL Workbench成功连接到服务器,也可以通过SSH连接到本地远程服务器。但是从jdbc连接器连接到mysql服务器的尝试(通过NetBeans和本地部署的代码都失败)。在查看日志时,代码正在尝试与远程服务器连接,考虑到用户凭据是本地用户而不是远程用户的。因此用户存在于远程,但java在尝试连接时会考虑u