首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用WLST远程上传

使用WLST远程上传
EN

Stack Overflow用户
提问于 2012-07-06 04:02:12
回答 3查看 7.4K关注 0票数 3

我正在尝试通过WLST执行远程上传和部署。我成功地部署了WebLogic服务器路径中已经存在的应用程序。但现在,我想部署一个远程可用的。

在部署WLST之前,是否有可能通过WLST将WAR/EAR上传到WebLogic服务器上?

我在运行weblogic 12C。

我试过:

代码语言:javascript
复制
java -cp wlserver/server/lib/weblogic.jar weblogic.Deployer -adminurl t3://WeblogicServer:7001 -user weblogic -password weblogic -deploy /tmp/HelloWorld.war -remote -upload

请给我作为退货:

代码语言:javascript
复制
weblogic.Deployer invoked with options:  -adminurl t3://WeblogicServer:7001 -user weblogic -deploy /tmp/HelloWorld.war -remote -upload
<6 juil. 2012 17 h 58 CEST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, HelloWorld [archive: /tmp/HelloWorld.war], to configured targets.> 
[J2EE Deployment SPI:260080]Unable to define the application install directory at "/tmp/helloworld.war". Directory could not be created or is a file.

当我检查服务器时,没有部署任何东西。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2012-07-09 15:20:23

我找到了解决方案:我们不能使用/tmp目录作为源,因为weblogic.Deployer使用这个目录。

所以命令是:

代码语言:javascript
复制
java -cp wlserver/server/lib/weblogic.jar weblogic.Deployer -adminurl
 t3://WeblogicServer:7001 -user weblogic -password weblogic -deploy 
/home/admin/HelloWorld.war -remote -upload
票数 4
EN

Stack Overflow用户

发布于 2012-07-06 11:08:58

是的,有。看看 command reference (这个链接用于10gR3版本)。

您可以使用remoteupload选项指定true,因为它们的默认值为false。

PS 1:remote选项在WebLogic 9.0和更旧版本上是不可用的(但是您总是可以得到一个更新的weblogic.jar并尝试。

PS 2:您需要远程访问管理接口(通常是端口7001和/或7002)。这意味着打开防火墙等。

PS 3:请提供您的WebLogic服务器的版本,因为这可能有助于我们帮助您。

票数 2
EN

Stack Overflow用户

发布于 2013-11-07 12:40:16

自己写的,可以做取消部署+部署。部署项目是:

部署(项目、存档、应用目标、“阶段”、计划、远程=“真”、上传=“真”、archiveVersion=archiveversion、planVersion=planversion )

  • 在部署中使用版本号的缺点是,使用计划重新部署不起作用。

完整的脚本:(你自己的下一行代码,我必须添加一些空格将它放在这里)

代码语言:javascript
复制
from java.io import FileReader
from datetime import datetime


def deployApp( project, archive, archiveversion, plan, planversion, apptargets ):

#### UNDEPLOY app          
try:

    domainConfig()
    cd('/')
    found = false
    for app in cmo.getAppDeployments():
        name=app.getName()

        try:                 
            cd('/AppDeployments/' + name ) 
            applicationName=get('ApplicationName')

            if applicationName==project:
                print '\n__ FOUND aplication: ', name
                found = true

                version=get('VersionIdentifier')
                sourcePath=get('SourcePath')
                planPath=get('PlanPath')

                targets=''
                for target in cmo.getTargets():

                    targetName=target.getName()
                    if targets=='':
                        targets=targetName
                    else:
                        targets=targets + ', ' + targetName

                print '   applicationName:\t', applicationName
                print '   version:\t\t', version
                print '   sourcePath:\t', sourcePath
                print '   planPath:\t', planPath
                print '   targets:\t\t', targets

                if version==archiveversion + '#' + planversion: 
                    print '\nCorrect Application version found.  No installation needed\n'
                    return
                else:
                    print '\n__ REMOVING application: ',applicationName, '     version:', version 
                    undeploy(project)

        except:     
            print "IGNORE ERROR: (deployed applicaties gegevens ophalen) ", sys.exc_info()[0]

    if found==false:
        print "Application " + project + "not found."

except:     
    print "Failure in application remove part: ", sys.exc_info()[0]
    raise   


# get deploy targets
try:   
    if apptargets==None:
        serverConfig()
        cd('/')
        targetList = []              
        for cluster in cmo.getClusters():
            targetList.append( cluster.getName() )
        apptargets = ",".join(targetList)

        print 'USING default app target:', apptargets, "   (apptargets not found in environmentfile)" 
except:
    print "Failure while creating default target", sys.exc_info()[0]
    raise 


#### DEPLOY app
try:         
    print '\n__ DEPLOYING application: ', project, archiveversion + '#' + planversion  + '    target:' + apptargets

    deploy( project, archive
    , apptargets, 'stage', plan
    , remote='true', upload='true', archiveVersion=archiveversion, planVersion=planversion )
except:     
    print "Failure in deployment part: ", sys.exc_info()[0]
    raise


# connect to domein
# 1) in plain passsword
# 1)  using encrypted domain credential in separate files
# 2)  using encrypted domain credential in home directory user
def Connect( domainproperties ):
plainUser = domainproperties.getProperty("user")
plainPassword = domainproperties.getProperty("password")
if not (plainUser is None) and not (plainPassword is None):
    print "Connecting with user & password"
    connect( plainUser, plainPassword, domainproperties.getProperty("url"))
    return        

encryptedUserConfigFile = domainproperties.getProperty("encryptedCredentialsFile")
encryptionKeyFile = domainproperties.getProperty("encryptionKeyFile")    
if not (encryptedUserConfigFile is None) and not (encryptionKeyFile is None):
    print "Connecting with encryptedCredentialsFile: ", encryptedUserConfigFile, "  and encryptionKeyFile: ", encryptionKeyFile 
    connect(userConfigFile=encryptedUserConfigFile, userKeyFile=encryptionKeyFile, url=domainproperties.getProperty("url"))
    return

print "Connecting with encryptedCredentialsFile in home directory"
connect( url=domainproperties.getProperty("url") )
return    



try:
print "____ running app_deploy.py at   " + str(datetime.now())

project = sys.argv[1]
archive = sys.argv[3]
archiveversion = sys.argv[4]
plan = sys.argv[5]
planversion = sys.argv[6]    
environmentfile = sys.argv[2]

propertyfilereader=FileReader(environmentfile)
domainproperties=Properties()
domainproperties.load(propertyfilereader)

print "  environment: ", environmentfile 
print "  Ear:   ", archive, "  version:", archiveversion
print "  plan:  ", plan, "  version:", planversion

## Connect
#connect( domainproperties.getProperty("user"), domainproperties.getProperty("password"), domainproperties.getProperty("url") )
Connect( domainproperties )

try: 

    ## Deploy
    deployApp( project, archive, archiveversion, plan, planversion, domainproperties.getProperty("apptargets") )

finally:
    # niet dat het uitmaakt, maar wel zo netjes
    disconnect()

except:
print "ABORT APP DEPLOY: ", #  sys.exc_info()[0], "_", sys.exc_info()[1]
raise

玩得开心点。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11355642

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档