How does ‘Servers’ view work underlying in Eclipse? - eclipse

‘Servers’ is built-in view in Eclipse. We could integrate Java EE server into Eclipse easily. It could start/stop server both in normal and debug modes. Moreover, we could even set timeout and deployment path, things like that. Various types of server tomcat, jboss, websphere are supported, no intrusive to server.
I am just curious about how these cool things happen behind the scene. The complete mechanism is large and complex, so I just want to know general mechanism about it, an article also could be fine for me. Thank you!

It's the server-specific plugin which does all the work. When integrating a Server in Eclipse you basically need to instruct the plugin where to find the installation root of the server in question. The plugin in turn knows precisely where to locate the default libraries, how to deploy webapps to the server in question and how to start/stop the server with eventually extra commandline arguments.
Since every server make/version needs a different approach (as different as when you need to do it "manually"), I'll only give a Tomcat 6.0 based example how it roughly works. Doubleclick the server entry in Servers view and check the Server Location section. The field Server Path denotes the root location of configuration files. It's by default in Eclipse metadata (when Use workspace metadata is selected). If you browse further in this folder, you'll find something like tmp0\conf\server.xml. It contains information about where the to-be-deployed webapps are located, which context name it should have and so on. The plugin basically gives this information to Tomcat and it will handle it further.

Basically, server adapters are Eclipse plugins and allow to extend the IDE by implementing a set of generic actions (start, debug, stop, deploy, undeploy) that are translated into server specific orders. They also expose server specific configuration parameters. The deployment is more or less intrusive depending on the server (it may be done outside the server folder tree or in a special eclipse folder).

Related

How do I change Netbeans's webserver port from 8383?

How do I change Netbeans's webserver port from 8383?
I know I could install and use a separate webserver, but I'd prefer to just use the embedded one.
Some of what I've read online makes me think it might not be possible to change the port. But, then bug https://netbeans.org/bugzilla/show_bug.cgi?id=222570 makes it sound like using other than 8383 is possible.
I can't find such a setting with the UI. I searched under the installation directory for 8383 and can't find anything.
So, how do I do this? I'm using Netbeans 8.0.1.
Thanks.
ADDITIONAL INFO:
I'm using the internal webserver that comes with Netbeans.
I don't think this is possible, definitely not via UI. Looking at the java class, port number seems to be hardcoded in the source. You would have to build the particular NetBeans module and then replace the one in NetBeans installation folder with yours module.
From what I can tell from the issue, it fixes cases when default port 8383 is occupied, IDE uses different one (increment by 1) and thanks to the fixed bug, this incremented port is also used in browser (prior the fix, even with incremented port, old 8383 was being used in browser).
You can file enhancement with request for it.
Under Window / Services / Servers you'll find every registered server. Right-click on your server, choose "Properties" and under the "Connection"-tab you can define your port.
(You haven't mentioned which server you are using, but that's the way where you usually define your port).
I can't find Servers option either and I'm using NetBeans v8.0.2. But you can use an external server [ex. IIS, Apache] as an workaround: right-click the project in Project Window > Properties > Run. Then change the Web Server to External and Project URL to your desired address.
If your project is not in an web accessible directory you must make it web accessible first by configuring your web server or adding it in an web accessible location.

Eclipse Kepler and JBoss Wildfly hot deployment

I am trying to use eclipse kepler for Java EE 7.I already installed JBoss Tools and added JBoss Wildfly successfully as a server. However my changes are not automatically deployed. Is there anyway the app can be deployed automatically just as when using glassfish?
Using Eclipse, click twice on your WildFly Server to edit the following properties:
Publishing: choose "Automatically publish after a build event". I like to change the publishing interval to 1 second too.
Application Reload Behavior: check the "Customize application reload ..." checkbox and edit the regex pattern to \.jar$|\.class$
That's it. Good luck!
Both #varantes and #Sean are essentially correct, but these answers are not full.
Unfortunately the only way in a Java server environment to have full, zero-downtime hot deployment is to use paid JRebel or free spring-loaded tool.
But for small project there are some ways to speed up work by partial hot-deployment. Essentially:
When enabled option Automatically publish when resource change
then changes inside *.html, *.xhtml files are immediately
reflected as soon as you refresh the browser.
To make hot deployment work for *.jsp files too, then you should
inside ${wildfly-home}/standalone/configuration/standalone.xml
make following change:
<jsp-config/>
replace with:
<jsp-config development="true"/>
restart the server and enjoy hot deployment of web files.
But when modifying *.java source files, then only partial hot deployment is possible. As #varantes stated in his answer, enabling Application Reload Behavior with regex pattern set to \.jar$|\.class$ is an option, but has serious downside: whole module is restarted, thus:
It takes some time (depending on how big is a module).
Whole application state is lost.
So personally, I discourage this solution. JVM supports (in debug mode) code-swapping for methods' bodies. So as long as you are modifying only bodies of existing methods, you are at home (zero downtime, changes are reflected immediately). But you have to disable automatic publishing inside server settings otherwise the application's state will still be destroyed by that republish.
But if you are heavily crafting Java code (adding classes, annotations, constructors) then unfortunately I can only recommend set publishing into Never publish automatically (or shutdown server) and when you finish your work in Java files, then restart by hand your module (or turn-on server). Up to you.
It works for small Java projects, but for bigger ones, JRebel is invaluable (or just spring-loaded), because all approaches described above are not sufficient. Also because of such problems, solutions like Rails/ Django /Play! Framework gained so huge popularity.
I am assuming you are using the latest version of Wildfly (8.0 Beta 1 as of writing).
In the standalone.xml config file, look for <jsp-config/>. Add the attribute development="true" and it should hot-deploy. The resulting config will look like this:
<jsp-config development="true"/>
Add attributes (development, check-interval, modification-test-interval, recompile-on-fail) in configuration file in xPath = //servlet-container/jsp-config/
<servlet-container name="default" default-buffer-cache="default" stack-trace-on-error="local-only">
<jsp-config development="true" check-interval="1" modification-test-interval="1" recompile-on-fail="true"/>
</servlet-container>
(It works in WildFly-8.0.0.Final)
Start server in debug mode and It will track chances inside methods. Other changes It will ask to restart the server.

Play!framework; Compile on server only instead on client

Is it possible to compile my Play!framework application only serverside?
Since I connect a samba share to my client from the server hosting Play!, the paths differ between client and server (modules, play, libs). So eclipsify gives me the server paths on my client, instead of using the client paths. Due to this the client gives me a build error.
Solution would be;
Change the eclipsify paths per client configuration.
Only compile my app on the server (preferred since there'll be no differences in env settings).
Can anyone tell me how one of these options would be possible?
Take a look at the play-maven plugin? Using maven for dependency management means all developers will have the same pom/config file, on running a maven build jars/libs will be downloaded from the repository server (you can use your own repo server too).
why don't you install paly framework in the client? this framework is for development tasks so you should install it in your development machine (client i presume). Play framework is freely downloadable and easy to install on your client.
I've found a temp "solution" to let each client define its own path (probably will be overwritten by play eclipsify? Can I change this?).
In Eclipse I've added a variable called PLAY_HOME under Window > Preferences > Java > Build path > Classpath Variables pointing to "D:\play-1.2.2" in this case.
In the .classpath I've replaced all absolute paths:
<classpathentry kind="lib" path="/usr/local/bin/play-1.2.2/framework/lib/...jar" />
to:
<classpathentry kind="var" path="PLAY_HOME/framework/lib/...jar"/>
Still no compilation on the server/continious integration etc. but it's a working solution for now, though it could be improved (the client - server diff dependencies still exists).
Would be nice to check if the version of play matches
Would be nice to make the PLAY_HOME variable optional by defaulting it to '..' (parent dir)
Perhaps an Ant script is what you need?
If I understand your question correctly, you want to develop with multiple developers on a single instance of an application hosted on some server???
It's maybe not the answer you're looking for, but my advice: don't do it this way.
Developing directly on a server, especially with multiple developers, is one of the great anti-patterns in development. Typically, only beginners and rather non-professional developers (no offense meant) do their development this way.
Restarting the server, debugging code, working in the same files... it only ends in tears when doing this 'shared' development.
Make sure you can run the application completely isolated on each workstation. Use version control to check in changes. If two developers have been working on the same code, you at least have a chance to rectify the situation (and a rather good chance if you use e.g. Mercurial or Git). If you still want to a global server to e.g. demo changes to non-developers, just periodically check-out a snapshot from version control and deploy that to this server.

Creating SVN repository server with XAMPP on windows

For last 3 days I am struggling in setting up my SVN server. I tried several ways and tools but I found always some issue and bug all the files.
I am planning to use the following tools for this project.
For Server and database - XAMPP (Comes with APACHE and MySql)
Version control server - subversion-1.6.16
Version control client - tortoiseSVN
IDE is Eclipse
Following are my queries
1. Is the above combination of tools and softwares is perfect for my project?
2. Is there any open-source software which provides all the above functionalities combined?
3. If anybody of you has already done such kind of project, could you please share with me which are the correct version of softwares I should use to get it worked error free.
If anybody can provide solution for below I can carry on with my current setup also.
My Error Message from server for current configuration : I tried to setup the svn-win32-1.6.16 with my XAMPP installation by copying the two moduels mod_dav_svn.so and mod_authz_svn.so to my apache modules directory and changed the httpd.conf file with Loadmodules of these the so files and set the location also for these. But when i start the server in error logs I get error message like this - "httpd.exe: Syntax error on line 136 of C:/xampp/apache/conf/httpd.conf: Cannot load C:/xampp/apache/modules/mod_dav_svn.so into server: The specified module could not be found."
Following are pre-conditions and configurations prior to this error
Location of SVN - C:/SVN/svn-win32-1.6.16
Location XAMPP - C:/xampp/
Changes in httpd.conf file
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
and for location
# Enter this location in your browser to access the repository
<Location /repos>
DAV svn
SVNPath c:/SVN/svn_repos
</Location>
I have created the repository here - C:/SVN/svn_repos
Is the above combination of tools and softwares is perfect for my
project?
That is impossible to answer, because:
a) we don't know what your project is
b) nothing is perfect
But it is definitely an ok combination of tools. If I were you I would not use XAMPP but Zend Server CE instead! You get a nice web GUI for most php configuration needs.
Is there any open-source software which provides all the above
functionalities combined?
No. These tools are maintained for various target audiences and the combination you're asking for wouldn't make much sense in a bundle.
But of course your IDE (Eclipse in this case) integrates nicely with these tools. 'Integrates' means it plays together, doesn't mean it comes bundled with these things.
If anybody of you has already done
such kind of project, could you please
share with me which are the correct
version of softwares I should use to
get it worked error free.
I used to have such a combination (now I'm on Zend Studio with Zend Server CE) and there is no problem with it. The problem is that you're trying to do something unnecessary and wrong.
If you're using XAMPP, you're on a Windows machine, using .so extensions wouldn't do any good at all, Windows needs .dll extensions.
Why do you want to load such extensions anyways? You don't need those in order to get it all working.
Where are your repositories? Only if you want to host your own repositories do you need to run your own server. If that is the case, look at VisualSVNServer. You just install it, no need for integration with anything.
If your repositories are on a location in the net (more likely) you don't need an SVN server, you just need the client. In that case you're ready to go, no need for php extensions. You can checkout repos, commit, export, branch, tag, etc. From within Eclipse or in your file system with TortoiseSVN.
Try it and get back here, if you still experience problems.

How do you deploy a website and database project using TFS 2010?

I've been trying to figure this out and so far haven't found a simple solution. Is it really that hard to deploy a database project (and a web site) using TFS 2010 as part of the build process?
I've found one example that involved lots of complicated checks and editing the workflow (which is a giant workflow btw).
I've even purchased the book "professional application lifecycle management with VS 2010", but apparently professionals don't deploy their applications since it isn't even mentioned in the book.
I know I'm retarded when it comes to TFS, but it seems like there should be any easy way to do this. Is there?
I can't speak for the database portion, but I just went through this on the web portion, the magic part is not very well documented component, namely the MSBuild Parameters.
In your build definition:
Process on the Left
Required > Items to Build > Configurations to Build
Edit, add a new one, for this example
Configuration: Dev (I cover how to create a configuration below)
Platform: Any CPU
Advanced > MSBuild Process
Use the following arguments (at least for me, your publish method may vary).
MsBuild Params:
/p:MSDeployServiceURL="http://myserver"
/p:MSDeployPublishMethod=RemoteAgent
/p:DeployOnBuild=True
/p:DeployTarget=MsDeployPublish
/p:CreatePackageOnPublish=True
/p:username=aduser
/p:password=adpassword
Requirements:
You need to install the MS Deploy Remote Agent Service on the destination web server, MSDeploy needs to be on the Build/Deployer server as well, but this should be the case by default.
The account you use in the params above needs admin access, at least to IIS...I'm not sure what the minimum permission requirements are.
You configure which WebSite/Virtual Directory the site goes to in the Web project you're deploying. Personally I have a build configuration for each environment, this makes the builds very easy to handle and organize. For example we have Release, Debug and Dev (there are more but for this example that's it). Only the Web project has a Dev configuration.
To do this, right click the solution, Configuration Manager..., On the web project click the configuration drop down, click New.... Give it a name, "Dev" for this example, copy settings from debug or release, whatever matches closest to what your deployment server environment should be. Make sure "Create new solution configurations" is checked, it is by default. After creating this, change the configuration dropdown on the solution to the new Dev one, and Any CPU...make sure your projects are all correct, I had some flipping to x86 and x64 randomly, not sure of the exact cause of that).
In your web project, right click, properties. On the left, click Package/Publish Web (you'll also want to mess with the other Package/Publish SQL tab, but I can't speak to that). In the options on the right click Create deployment package as a zip file. The default location is fine, the next textbox I didn't find documented anywhere. The format is this: WebSite/Virtual Directory, so if you have a site called "BuildSite" in IIS with no virtual directory (app == site root), you would have BuildSite only in this box. If it was in a virtual directory, you might have Default Web Site/BuildVirtualDirectory.
After you set all that, make sure to check-in the solution and web project so the build server has the configuration changes you made, then kick off a build :)
If you have more questions, I recommend you watch this video by Vishal Joshi, specifically around 22 and 59 minutes in, he covers the database portion as well...but I have no actual experience trying it since we're on top of a non MSSQL database.