facebook

Define Target Server

  1. Secure Delivery Center
  2.  > 
  3. Getting Help
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #453210 Reply

    piougy
    Participant

    Hello,

    How i can define and install target server like tomcat ?

    Thanks

    #453262 Reply

    piougy
    Participant

    Hello,

    I package tomcat install into third-party libraries,

    Tomcat binaries was deploy on directory

    $eclipse_home\binary.contents.3818-hwf-8825.winlinuxmac_7.0.64

    I have define a Servers project with tomcat configuration (SVN checkout at startup)

    But i can’t understand how i can configure epf file to define Tomcat as server

    Thanks a lot

    #453386 Reply

    ignaciom
    Moderator

    piougy,

    The Development team helped me investigating what is required to set a “Target Server”, and it seems you do need to set a preference with a content like:

    eclipse.preferences.version=1
    module-start-timeout=300000
    runtimes=<?xml version\=”1.0″ encoding\=”UTF-8″ standalone\=”no”?>\r\n<runtimes>\r\n <runtime id\=”Apache Tomcat v7.0″ location\=”D\:/Servers/Tomcat/apache-tomcat-7.0.56″ name\=”Apache Tomcat v7.0″ runtime-type-id\=”org.eclipse.jst.server.tomcat.runtime.70″ timestamp\=”0″/>\r\n</runtimes>\r\n

    Also inside the ${workspace}\.metadata\.plugins\org.eclipse.wst.server.core we need a servers.xml file I will attach a sample file on this post. You can drop this file with the help of “Arbitrary Workspace Task” (https://www.genuitec.com/products/sdc/learning-center/advanced-uses/advanced-workspace-tasks/#workspace)

    Although for the preference one it seems you’ll need to use an Advanced Workspace Tasks that automates the creation the required xml data and after that set the “runtime” preference for the node “org.eclipse.wst.server.core”. A custom workspace task will be required because the location on each install will be different for each user, look at the location attribute of the xml data. For more information about Advanced Workspace Tasks task look at: (https://www.genuitec.com/products/sdc/learning-center/advanced-uses/advanced-workspace-tasks/)

    I hope this help you to go on the right direction if you have any other question, please do not hesitate to contact us again.

    Best Regards
    Ignacio
    SDC Support

    #453387 Reply

    ignaciom
    Moderator

    Missing files from last post.

    Ignacio

    Attachments:
    You must be logged in to view attached files.
    #453783 Reply

    piougy
    Participant

    I create a simple class :

    package com.genuitec.pulse.tools.delivery.examples.mechanic.moti;
    
    import org.eclipse.core.runtime.CoreException;
    import org.eclipse.core.runtime.IProgressMonitor;
    import org.eclipse.core.runtime.IStatus;
    import org.eclipse.core.runtime.NullProgressMonitor;
    import org.eclipse.core.runtime.Status;
    import org.eclipse.jdt.core.JavaCore;
    import org.eclipse.wst.server.core.IRuntimeType;
    import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
    import org.eclipse.wst.server.core.IServerType;
    import org.eclipse.wst.server.core.IServerWorkingCopy;
    import org.eclipse.wst.server.core.ServerCore;
    
    import com.google.eclipse.mechanic.Evaluator;
    import com.google.eclipse.mechanic.IResourceTaskReference;
    import com.google.eclipse.mechanic.RepairAction;
    import com.google.eclipse.mechanic.Task;
    
    public class AddServer implements Task, RepairAction, Evaluator {
    
    	private IResourceTaskReference reference;
    
    	public String getId() {
    		return "test.project.addServer";
    	}
    
    	public String getTitle() {
    		return "test";
    	}
    
    	public String getDescription() {
    		return "test";
    	}
    
    	/**
    	 * The evaluate() method determines if this task's conditions have already
    	 * been met.
    	 */
    
    	public boolean evaluate() {
    		return ServerCore.getServers() != null
    				&& ServerCore.getServers().length > 1;
    
    	}
    
    	/**
    	 * The repair() method performs the task.
    	 */
    
    	public IStatus repair(IProgressMonitor monitor) {
    		IRuntimeType runtimeType = ServerCore
    				.findRuntimeType("org.eclipse.jst.server.tomcat.runtime.70");
    		IServerType serverType = ServerCore
    				.findServerType("org.eclipse.jst.server.tomcat.70");
    		try {
    			NullProgressMonitor progressMonitor = new NullProgressMonitor();
    			IRuntimeWorkingCopy runtime = runtimeType.createRuntime(
    					"tomcat_runtime", progressMonitor);
    			runtime.setName("Tomcat Runtime");
    			runtime.setLocation(JavaCore
    					.getClasspathVariable("ECLIPSE_HOME")
    					.append("/binary/binary.contents.3818-hwf-8825.winlinuxmac_7.0.64/apache-tomcat-7.0.64/"));
    			IServerWorkingCopy server = serverType.createServer(
    					"tomcat_server", null, runtime, progressMonitor);
    			server.setName("Tomcat Server");
    			server.saveAll(false, progressMonitor);
    		} catch (CoreException e) {
    			e.printStackTrace();
    		}
    		return Status.OK_STATUS;
    	}
    
    	public Evaluator getEvaluator() {
    		return this;
    	}
    
    	public RepairAction getRepairAction() {
    		return this;
    	}
    
    	public IResourceTaskReference getReference() {
    		return reference;
    	}
    
    	public void setReference(IResourceTaskReference reference) {
    		this.reference = reference;
    	}
    
    	public int getRepairCost() {
    		return 1;
    	}
    
    }

    but there is a dependency problem :

    GRAVE: Unexpected error on the Display thread
    java.lang.NoClassDefFoundError: org/eclipse/wst/server/core/IRuntime

    #453787 Reply

    ignaciom
    Moderator

    piougy,

    We have good news for you 🙂 We have just released an SDC Package Managed by one of our Delivery Hubs that will configure your workspace with the examples provided with the Delivery Hub, this package will configure your target platform to get ready to work on your own Workspace task, you can download it at http://gosecure.genuitec.com/SDC-Extended-Examples/

    Best Regards
    Ignacio
    SDC Support

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Define Target Server

You must be logged in to post in the forum log in