Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 26662 Details for
Bug 100677
Axis deploy problem with Geronimo server
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
axis.consumption.core patch
jst.ws.axis.consumption.core_patch.txt (text/plain), 13.09 KB, created by
Seng Phung Lu
on 2005-08-30 18:20:42 EDT
(
hide
)
Description:
axis.consumption.core patch
Filename:
MIME Type:
Creator:
Seng Phung Lu
Created:
2005-08-30 18:20:42 EDT
Size:
13.09 KB
patch
obsolete
>Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /home/webtools/jst/components/ws/plugins/org.eclipse.jst.ws.axis.consumption.core/META-INF/MANIFEST.MF,v >retrieving revision 1.4 >diff -u -r1.4 MANIFEST.MF >--- META-INF/MANIFEST.MF 26 Aug 2005 16:32:45 -0000 1.4 >+++ META-INF/MANIFEST.MF 30 Aug 2005 22:17:35 -0000 >@@ -16,4 +16,5 @@ > org.eclipse.jst.ws, > org.eclipse.jst.ws.consumption, > org.eclipse.jst.j2ee.web, >- org.apache.axis >+ org.apache.axis, >+ org.eclipse.wst.common.modulecore >Index: src/org/eclipse/jst/ws/internal/axis/consumption/core/command/AxisDeployCommand.java >=================================================================== >RCS file: /home/webtools/jst/components/ws/plugins/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/command/AxisDeployCommand.java,v >retrieving revision 1.3 >diff -u -r1.3 AxisDeployCommand.java >--- src/org/eclipse/jst/ws/internal/axis/consumption/core/command/AxisDeployCommand.java 17 Apr 2005 13:21:12 -0000 1.3 >+++ src/org/eclipse/jst/ws/internal/axis/consumption/core/command/AxisDeployCommand.java 30 Aug 2005 22:17:35 -0000 >@@ -12,7 +12,6 @@ > > > import java.io.File; >-import java.text.MessageFormat; > import java.util.ResourceBundle; > > import org.apache.axis.tools.ant.axis.AdminClientTask; >@@ -31,7 +30,7 @@ > > public class AxisDeployCommand extends SimpleCommand > { >- private static final String SERVICE_EXT = "/services/AdminService"; //$NON-NLS-1$ >+ protected static final String SERVICE_EXT = "/services/AdminService"; //$NON-NLS-1$ > > private JavaWSDLParameter javaWSDLParam; > private ResourceBundle resource = ResourceBundle.getBundle("org.eclipse.jst.ws.axis.consumption.core.consumption"); //$NON-NLS-1$ >@@ -149,12 +148,6 @@ > > } > >- private String getMessage(String messageId, String parm1) >- { >- String message = resource.getString(messageId); >- return MessageFormat.format(message, new String[] { parm1 }); >- } >- > /** > * Returns the message string identified by the given key from plugin.properties. > * >Index: src/org/eclipse/jst/ws/internal/axis/consumption/core/command/GeronimoAxisDeployCommand.java >=================================================================== >RCS file: src/org/eclipse/jst/ws/internal/axis/consumption/core/command/GeronimoAxisDeployCommand.java >diff -N src/org/eclipse/jst/ws/internal/axis/consumption/core/command/GeronimoAxisDeployCommand.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jst/ws/internal/axis/consumption/core/command/GeronimoAxisDeployCommand.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,298 @@ >+/******************************************************************************* >+ * Copyright (c) 2003, 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jst.ws.internal.axis.consumption.core.command; >+ >+ >+import java.io.File; >+import java.io.FileOutputStream; >+import java.io.InputStream; >+import java.util.ResourceBundle; >+ >+import org.apache.axis.AxisEngine; >+import org.apache.axis.server.AxisServer; >+import org.apache.axis.tools.ant.axis.AdminClientTask; >+import org.apache.axis.utils.ClassUtils; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Project; >+import org.apache.tools.ant.Target; >+import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IFolder; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParameter; >+import org.eclipse.jst.ws.internal.common.J2EEUtils; >+import org.eclipse.jst.ws.internal.common.ResourceUtils; >+import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; >+import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; >+import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus; >+import org.eclipse.wst.command.internal.provisional.env.core.common.Status; >+import org.eclipse.wst.common.componentcore.internal.StructureEdit; >+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; >+ >+/** >+ * Commands are executable, undoable, redoable objects. Every Command has a name and a description. >+ */ >+ >+public class GeronimoAxisDeployCommand extends SimpleCommand >+{ >+ >+ private JavaWSDLParameter javaWSDLParam; >+ private ResourceBundle resource = ResourceBundle.getBundle("org.eclipse.jst.ws.axis.consumption.core.consumption"); //$NON-NLS-1$ >+ >+ private String projectName_; >+ private String componentName_; >+ >+ private static final String AXIS_SERVER_CONFIG_FILE = "axis.ServerConfigFile"; >+ >+ IFolder outputRoot; >+ >+ /** >+ * Constructor for GeronimoAxisDeployCommand. >+ * @param String projectName >+ * @param String componentName >+ * >+ */ >+ public GeronimoAxisDeployCommand(String projectName, String componentName) >+ { >+ super("org.eclipse.jst.ws.internal.axis.consumption.core.command.GeronimoAxisDeployCommand", "org.eclipse.jst.ws.internal.axis.consumption.core.command.GeronimoAxisDeployCommand"); >+ this.projectName_ = projectName; >+ this.componentName_ = componentName; >+ } >+ >+ public Status execute(Environment environment) >+ { >+ >+ if (javaWSDLParam == null) >+ { >+ return new SimpleStatus("Java2WSDLCommand", //$NON-NLS-1$ >+ getMessage("MSG_ERROR_JAVA_WSDL_PARAM_NOT_SET"), Status.ERROR); >+ } >+ >+ if (javaWSDLParam.getProjectURL() == null || javaWSDLParam.getProjectURL().equals("")) >+ { //$NON-NLS-1$ >+ return new SimpleStatus("Java2WSDLCommand", //$NON-NLS-1$ >+ getMessage("MSG_ERROR_PROJECT_URL_PARAM_NOT_SET"), Status.ERROR); >+ } >+ >+ if (javaWSDLParam.getDeploymentFiles() == null || javaWSDLParam.getDeploymentFiles().length == 0) >+ { >+ return new SimpleStatus("Java2WSDLCommand", //$NON-NLS-1$ >+ getMessage("MSG_ERROR_DEPLOY_FILE_PARAM_NOT_SET"), Status.ERROR); >+ } >+ >+ environment.getProgressMonitor().report(getMessage("MSG_AXIS_DEPLOY")); >+ >+ Status status = executeAdminTask(); >+ if (status.getSeverity() == Status.ERROR) >+ { >+ environment.getStatusHandler().reportError(status); >+ } >+ >+ status = executeAntTask(); >+ if (status.getSeverity() == Status.ERROR) >+ { >+ environment.getStatusHandler().reportError(status); >+ } >+ return status; >+ } >+ >+ protected Status executeAntTask() >+ { >+ final class DeployTask extends AdminClientTask >+ { >+ public DeployTask() >+ { >+ project = new Project(); >+ project.init(); >+ taskType = "axis"; //$NON-NLS-1$ >+ taskName = "axis-admin"; //$NON-NLS-1$ >+ target = new Target(); >+ } >+ } >+ >+ DeployTask adminClient = new DeployTask(); >+ String url = javaWSDLParam.getProjectURL() + AxisDeployCommand.SERVICE_EXT; >+ adminClient.setUrl(url); >+ adminClient.setXmlFile(new File(javaWSDLParam.getDeploymentFiles()[0])); >+ >+ // Since the admin server may not be available right away we will try >+ // several times to execute it. >+ try >+ { >+ BuildException lastException = null; >+ >+ for( int index = 0; index < 20; index++ ) >+ { >+ try >+ { >+ lastException = null; >+ adminClient.execute(); >+ } >+ catch( BuildException exc ) >+ { >+ lastException = exc; >+ >+ try >+ { >+ Thread.sleep( 200 ); >+ } >+ catch( InterruptedException threadException ) >+ { >+ } >+ } >+ >+ // If no exception occured then we should break out of the loop. >+ if( lastException == null ) break; >+ } >+ >+ // If after many tries we still get an exception, then we will re throw it. >+ if( lastException != null ) throw lastException; >+ } >+ catch (BuildException e) >+ { >+ e.printStackTrace(); >+ String message = e.getMessage(); >+ if (e.getCause() != null) >+ { >+ message = e.getCause().toString(); >+ } >+ >+ Status[] childStatus = new Status[1]; >+ childStatus[0] = new SimpleStatus("AxisDeployCommand", message, Status.ERROR); >+ return new SimpleStatus("AxisDeployCommand", //$NON-NLS-1$ >+ getMessage("MSG_ERROR_AXIS_DEPLOY"), childStatus); >+ } >+ return new SimpleStatus("AxisDeployCommand", //$NON-NLS-1$ >+ getMessage("MSG_AXIS_DEPLOY_OK"), Status.OK); >+ >+ } >+ >+ protected Status executeAdminTask(){ >+ >+ Status status = new SimpleStatus(""); >+ // check if server-config.wsdd exists >+ IVirtualComponent component = J2EEUtils.getVirtualComponent( projectName_, componentName_ ); >+ outputRoot = StructureEdit.getOutputContainerRoot( component ); >+ IPath path = new Path( "WEB-INF" ).append( "server-config.wsdd" ); >+ IFile descriptorFile = outputRoot.getFile( path ); >+ >+ if (!descriptorFile.exists()){ >+ status = createServerConfigFile(); >+ if (status.getSeverity()==Status.ERROR) >+ return status; >+ } >+ >+ // check if deploy.wsdd exists >+ String deployWSDD = javaWSDLParam.getDeploymentFiles()[0]; >+ File deployFile = new File(deployWSDD); >+ if (deployFile==null || !deployFile.exists()){ >+ return status; >+ } >+ >+ try { >+ // get Classpath >+ String jarsCP = new String(); >+ // classes dir >+ IPath classesPath = new Path("WEB-INF").append("classes"); >+ IFile classesDir = outputRoot.getFile(classesPath); >+ jarsCP = "\""+classesDir.getRawLocation().toOSString()+"\""; >+ >+ // lib JARs >+ IPath libPath = new Path("WEB-INF").append("lib"); >+ IFile libEntry = outputRoot.getFile(libPath); >+ IFolder libFolder = (IFolder)ResourceUtils.findResource(libEntry.getFullPath()); >+ IResource[] JARfiles = libFolder.members(); >+ for (int i=0;i<JARfiles.length;i++){ >+ IResource res = JARfiles[i]; >+ if (res.getFileExtension().equals("jar")){ >+ jarsCP = jarsCP + ";\""+ res.getRawLocation().toOSString()+"\""; >+ } >+ } >+ >+ // form and run utils.Admin command >+ String adminCommand = new String("java -Daxis.ServerConfigFile="+ descriptorFile.getRawLocation().toOSString() >+ +" -cp "+jarsCP+" org.apache.axis.utils.Admin server "+deployFile.getCanonicalPath()); >+ Runtime.getRuntime().exec(adminCommand); >+ >+ } >+ catch(Exception e){ >+ System.setProperty(AXIS_SERVER_CONFIG_FILE,"server-conifg.wsdd"); >+ e.printStackTrace(); >+ String message = e.getMessage(); >+ if (e.getCause() != null) >+ { >+ message = e.getCause().toString(); >+ } >+ >+ Status[] childStatus = new Status[1]; >+ childStatus[0] = new SimpleStatus("AxisDeployCommand", message, Status.ERROR); >+ return new SimpleStatus("AxisDeployCommand", //$NON-NLS-1$ >+ getMessage("MSG_ERROR_AXIS_DEPLOY"), childStatus); >+ } >+ >+ return status; >+ } >+ >+ /**t >+ * Creates the initial server-config.wsdd file from a template in Axis >+ * @return >+ */ >+ private Status createServerConfigFile(){ >+ try{ >+ >+ // server-config.wsdd file >+ IPath path = new Path( "WEB-INF" ).append( "server-config.wsdd" ); >+ IFile descriptorFile = outputRoot.getFile( path ); >+ >+ // create the initial server-config.wsdd file >+ AxisEngine preEngine = new AxisServer(); >+ InputStream is = ClassUtils.getResourceAsStream(preEngine.getClass(), "server-config.wsdd"); >+ FileOutputStream fos = new FileOutputStream(descriptorFile.getRawLocation().toOSString()); >+ ResourceUtils.copyStream(is, fos); >+ fos.close(); >+ >+ return new SimpleStatus(""); >+ } >+ catch(Exception e){ >+ e.printStackTrace(); >+ String message = e.getMessage(); >+ if (e.getCause() != null) >+ { >+ message = e.getCause().toString(); >+ } >+ >+ Status[] childStatus = new Status[1]; >+ childStatus[0] = new SimpleStatus("AxisDeployCommand", message, Status.ERROR); >+ return new SimpleStatus("AxisDeployCommand", //$NON-NLS-1$ >+ getMessage("MSG_ERROR_AXIS_DEPLOY"), childStatus); >+ } >+ } >+ >+ /** >+ * Returns the message string identified by the given key from plugin.properties. >+ * >+ * @return The String message. >+ */ >+ public String getMessage(String key) >+ { >+ return resource.getString(key); >+ } >+ >+ /** >+ * @param javaWSDLParam The javaWSDLParam to set. >+ */ >+ public void setJavaWSDLParam(JavaWSDLParameter javaWSDLParam) >+ { >+ this.javaWSDLParam = javaWSDLParam; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 100677
:
24987
|
24988
|
24989
|
24990
| 26662 |
26663
|
26664
|
26665