通过Jython安装EAR文件时WebSphere应用服务器启动出现问题

0 投票
1 回答
669 浏览
提问于 2025-04-18 09:38

你好,我有一个逻辑,用来在WebSphere中安装war和ear文件,前提是我在war的路径下。运行这个脚本后,war和ear文件都成功安装了,但在服务器启动时,只有ear文件出现了错误。如果我直接在wsadmin上用相同的命令来安装ear文件,它就能正常工作,服务器也能顺利启动,没有错误。有没有人能分析一下脚本哪里出了问题?

错误信息:org.springframework.beans.factory.access.BootstrapException: 无法初始化组定义。组资源名称 [classpath*:beanRefContext.xml],工厂键 [netbanksrv.context];嵌套异常是 org.springframework.beans.factory.BeanCreationException: 创建名为 'netbanksrv.context' 的bean时出错,定义在URL [wsjar:file:/D:/IBM/WebSphere8/AppServer/Profiles/AppSrv12/installedApps/BLRVSWASBFT01Node10Cell/netbanksrv-ear.ear/lib/netbanksrv-core-5.4.3.jar!/beanRefContext.xml]:bean实例化失败;嵌套异常是 org.springframework.beans.BeanInstantiationException: 无法实例化bean类 [pegasus.framework.spring.context.MethodCachingClassPathXmlApplicationContext]:构造函数抛出异常;嵌套异常是 org.springframework.beans.factory.BeanCreationException: 创建名为 'genAccountServices.WSDLResource' 的bean时出错,定义在URL [wsjar:file:/D:/IBM/WebSphere8/AppServer/Profiles/AppSrv12/installedApps/BLRVSWASBFT01Node10Cell/netbanksrv-ear.ear/lib/integration-1.3.0.jar!/META-INF/spring/AccountServices-ws-springintegration.xml]:bean实例化失败;嵌套异常是 org.springframework.beans.BeanInstantiationException: 无法实例化bean类 [pegasus.integration.framework.HttpClientUrlResource]:构造函数抛出异常;嵌套异常是 java.net.MalformedURLException: 没有协议:null

我的逻辑:

for fname in os.listdir(warPath):
        if fname.endswith(".ear") or fname.endswith(".war"):
            file_list.append(fname)


    for i in range(len(file_list)):
        earFile=file_list[i]
        letter=earFile[0]

        if (letter == "a"):
            applicationName="admin-guiwar"
            installApp(cellName, nodeName, serverName, earFile, applicationName);
            classldr(applicationName)
        if (letter == "i"):
            applicationName="internetbank-guiwar"
            installApp(cellName, nodeName, serverName, earFile, applicationName);
            classldr(applicationName)
        if (letter == "m"):
            applicationName="mobilegateway"
            installApp(cellName, nodeName, serverName, earFile, applicationName);
            classldr(applicationName)
        if (letter == "n"):
            applicationName="netbanksrv-ear"
            installApp(cellName, nodeName, serverName, earFile, applicationName);
            classldr(applicationName)

def installApp (cellName, nodeName, serverName, warFileName, applicationName):
    fullPath = warPath+"/"+warFileName
    node = "-node "+nodeName
    cell = "-cell "+cellName
    svr = "-server "+serverName
    appName = "-appname "+applicationName
    AdminApp.install(fullPath, [node, cell, svr, appName])

1 个回答

0

你的部署脚本没问题。但是你在使用Spring的时候遇到了另一个问题:

 Could not instantiate bean class [pegasus.integration.framework.HttpClientUrlResource]: Constructor threw exception; nested exception is java.net.MalformedURLException: no protocol: null

我觉得你需要把类加载器的策略设置为 PARENT_LAST,这样你的应用程序才能正常工作。

WAS类加载器最佳实践

撰写回答