Cannot add a glassfish server in eclipse! - eclipse

After many efforts, i did installing of java_ee on my system.
I'm using eclipse Galileo. After i try to add a new server, I choose the location for glassfish, click next and it gives me:
home/banco/glassfishv3/glassfish/domains/domain1 is not writable
Since the glassfish is situated in Home folder, i can't understand the reason for this error

Because it is placed in your home directory, it doesn't give you automaticly write permission to files.
Have you checked the folder permissions with ls -l ?
ls -l home/banco/glassfishv3/glassfish/domains/domain1
Sometimes I decompress archives as the wrong user in my home directory and have similiar errors...

Related

Eclipse can't see /usr/local folder on mac

I am developing a web application in Java on my mac.
The web application will run on tomcat.
I have installed tomcat in /usr/local/apache-tomcat.
When I try to set the tomcat runtime in Server->Runtime Environments, I am not able to see the folder /usr/local. how do I get eclipse to see the /usr/local/apache-tomcat directory?
I am able to see /usr/local when using the Go to Folder option in Finder.
I had similar problem with loading external jar files in /usr/local/ for Eclipse on Mac
The way i resolved this was to create a soft-link using ln -s to the folder in /usr/local to a visible folder and then loaded the jars.
ln -s source visible_location/link
Works for me.
I just got a similar problem, and the workaround i found is to copy/paste the path of your tomcat base directory, and it works fine:
Go to your tomcat base directory
pwd to get the path and copy it
Go to eclipse -> preferences -> servers -> runtime environments -> add button -> select apache tomcat version -> then next
At this step, instead of browsing, you can simply paste the copied path in the Tomcat installation directory field!
et voilĂ 
My guess is that you have your finder settings that hide hidden folders. It is possible to show them by following the instructions in this article.
The easiest way to do this is to type the following in your terminal:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
If you type out the full name of the installation folder instead of using the finder, does it work?
You can easily control hidden files writing this in bash_profile
alias hideOn='defaults write com.apple.finder AppleShowAllFiles TRUE'
alias hideOff='defaults write com.apple.finder AppleShowAllFiles FALSE'
alias kFinder='killAll Finder'
alias hOn='hideOn && kFinder'
alias hOff='hideOff && kFinder'
Then, reopen your terminal and write hOn. At root folder you will see hidden /usr. Just put it in your finder sidebar. Then write hOff and you will stop seeing the hidden files, but /usr will be always there at finder.

How modify Eclipse locations to prevent write to user.home directory?

I have tried all different settings, and yes, I m aware of eclipse.ini and config.ini and also tried different command line arguments! Nothing solved my problem!
All attempts and still each time I run eclipse.exe it wants write to my userhome i.e. the .eclipse and .p2 folders.
I have tried with all settings bellow among others, in different combinations too:
-Dosgi.user.area=file:/c:/eclipse-conf/e46
-Dosgi.configuration.area=file:/c:/eclipse-conf/e46
-Dosgi.instance.area=file:/c:/eclipse-conf/e46
-Declipse.p2.data.area=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.configurationFolder=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.installFolder=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.cache=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.roaming=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.cache.shared=file:/c:/eclipse-conf/e46/p2
This did not help! Well it writes to /e46 and /e46/p2 folder but it also creates/writes to c:\users\mrsimplemind\.eclipse & .eclipseextension & .p2
Even if I manually create the folders before it will not help.
Now please anyone here had success to fully isolate eclipse configuration output?
The only way I achieved this was by changing the user.home but I don't like this workaround as there are stuff in the original "user.home" that will be needed in eclipse, e.g. .ssh , .git , .m2 maven etc. I don't want to keep duplicates of profile settings for each eclipse user.home
I just want to isolate eclipse, this should be configurable! I don't like the outputs to user.home .. It is not an option! I want to have control of what eclipse creates in what folders, for each eclipse installation.
(I can only tell from windows os, I don't know how if Eclipse on Mac works better with the settings above)
I dont use OOMPH installer, some comments below are misleading
The method I have tried to solve this problem has been nearly successful. Whether this is an answer for you will depend on your minimum acceptable level of quality.
If you are trying to prevent your Eclipse IDE from filling up your home drive, this technique will work (it has worked for me). It should not matter if Eclipse was installed by Oomph or from a plain zip, as nothing Oomph-related is modified in this solution.
If the requirement is that the user home p2 folder can be completely deleted and yet Eclipse still works without recreating that directory, no I have not been able to achieve that yet.
I am posting this as a partial solution, perhaps in the hope someone else can build upon it to figure out a better workaround. Obviously the perfect solution would be if eclipse had a configurable download location and the installer actually installed all software to only the location selected, but that requires the Eclipse developers to fix the "P2" component of the product. What follows is only a workaround.
Strategy
The premise is that the download pool folder always seems to be hardcoded into the config files to be under the home folder of the user that ran the eclipse installer. The essence of this workaround is to create a fake user home folder in the location of your choice, do a massive find-and-replace in the config files, and then force the Java system property to use that new folder as "user.home" which fools Eclipse into using it for its downloads.
Method
This was tested on Eclipse 4.7 Oxygen.3A on Mint Linux.
Extensive brain surgery of the Eclipse installation folder is needed.
Install Eclipse somewhere other than your user's home drive.
In this example the Oomph installer was given /media/LINAPPS/ubuntu-apps/eclipse-oxy as the install target, which then creates /media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse during the installation.
Start Eclipse at least once, then close it and make sure Eclipse is not running.
Create a new fake user home drive folder underneath the Eclipse folder.
In this example I created eclipse-oxy/eclipse/fakeHome
Copy the entire (hidden) p2 directory from your user home directory into the new fakeHome.
eg cp -R /home/$USER/.p2 /media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse/fakeHome/.p2
Go to the eclipse folder and edit the eclipse.ini in a text editor. Make these 2 changes:
set the line after --launcher.library to be the copy of the pool in the new location relative to the eclipse folder, eg : fakeHome/.p2/pool/...etc...
append a new system property setting to end of the file after all the other vm arguments, and set user.home to the new fake user home directory.
eg: -Duser.home=/media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse/fakeHome
Edit the file eclipse/configuration/org.eclipse.update/platform.xml. Find the first <site> entry and change the url attribute to be the new pool folder relative to the eclipse folder. eg: url="file:fakeHome/.p2/pool/"
Edit the file /media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info and again find and replace all references to you user home's p2 folder with the new p2 folder under the fakeUser. You could find over 1000 matches to replace here. It again seems to be possible to make these relative to the eclipse folder, so a path of "fakeHome/.p2/pool/....." will work.
Go to the new /eclipse/fakeHome/.p2 folder and edit both of the files there "pools.info" and "profiles.info". Again find any reference to your real user home and replace it with the path to the fakeUser folder. Use the full pathname (from root) for the pool location in both of these files.
Unpack, edit, and repack the latest profileRegistry. Find the folder
eclipse/fakeHome/.p2/org.eclipse.equinox.p2.engine/profileRegistry/_media_LINAPPS_ubuntu-apps_eclipse-oxy_eclipse.profile/. Now find the latest timestamped gz file in that folder. For example it might be called "1529736854441.profile.gz".
gunzip that .gz file. Edit the .profile file and again replace any mention of your real user home with the new fakeUser folder. For example in my installation one of the first property settings had to be changed to
<property name='org.eclipse.equinox.p2.cache' value='/media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse/fakeHome/.p2/pool'/>
Delete the old gz file, then gzip the profile into a gz, so it has replaced the old one.
I also edited the file /eclipse/fakeHome/.p2/org.eclipse.equinox.p2.core/cache/artifacts.xml and replaced the repository name with a reference to the new location inside fakeHome, but I am not sure this was necessary to get eclipse working.
Start eclipse.
Results
After doing the above, I tried to add Install New Software from the Help menu. After downloading lots of new plugins from Redhat and Spring, the new fakeHome pool occupies 900MB, but the original user home pool is still less than 400MB which is what it was as soon as eclipse had been installed. So it has been successful at moving the download cache of the updater and no files get updated in the old location, but two directories under .p2 still seem to have their timestamps touched.
If anyone finds this useful, or figures out how to improve it, please let me know.
This works on Windows 7, Eclipse Oxygen:
Install Eclipse, but DON'T launch it yet
Edit eclipse.ini and, underneath -vmargs, add an entry to change user home to be a shared folder:
e.g.
-vmargs
-Duser.home=C:\Development
Launch Eclipse. Should see ".eclipse", ".tooling", etc folders created in shared folder, and nothing created under your user folder.
As of Eclipse Java 2019-06 for Windows 10 64-bit
I added my eclipse.ini below:
-vmargs
-D"user.home=C:\your_path_here"
The 3 folders of .eclipse, .p2, & .tooling appeared after I started and then closed eclipse.
I am not sure when these are written into the new path, but it worked in my Windows 10.
Did you try adding the following line to eclipse.ini below -vmargs:
-Dosgi.configuration.area=#user.home/.someFolder
which will use .someFolder instead of .eclipse
or
-Dosgi.configuration.area=C:\path_to_desired_location\.eclipseJAVA

How to move Eclipse.app under /Applications on MacOS?

I used the fancy new installer to install Eclipse Mars on my OS X box and since it was asking for a folder and had a lot of fiddly config details to set, I wasn't sure what it was going to do to my system so I created a new folder ~/Applications/Eclipse/ to put it in.
Fortunately it created an app package, Eclipse.app, so I wanted to move it into /Applications (out of my account folder into the common apps for all users of the box). So I dragged it (it's what you're supposed to be able to do, y'know).
DOH! That did not work. It crashes and crashes and crashes. Moving it back makes it happy again.
What would I need to do to move Eclipse.app, other than delete and reinstall and then reinstall all the plugins and SDKs I added?
The likely problem here is that Eclipse anticipates the directory structure around it, and fails when the actual directory structure doesn't match its expectations. The simplest solution is to create an alias (like a PC shortcut) in the Applications folder that links back to the application in the folder where it is installed by default.
To do this on a Mac, right click the application, which should be in the user root like so:
~/eclipse/java-mars/Eclipse.app
You should see the dropdown below. Click the "Make Alias" option to create an alias for Eclipse in the same folder. Then just rename this alias "Eclipse," and drag and drop it in Applications, where it should work just fine.
Looks like the installer puts a lot of files, including the actual plugins, into folders under the .p2 folder in your home directory. This is true no matter where you install eclipse, with the installer. So either other users would need at least read access to some locations in your account, or you moved your .p2 folder to a central location and changed the eclipse.ini file (embedded in a folder under the eclipse.app folder) to point to the correct location. If you leave the .p2 folder in your account, you'd still need to alter the myeclipse.ini file, as it uses relative paths to files.
For your situation, you might be better off using the standard installation method (unzipping the distribution file), moving the installation to /Applications.

Tomcat 7 not setup properly in Eclipse Juno

I downloaded the 32-bit Windows zip from Apache's website.
Then I extracted the contents and placed it in my Program Files folder where Eclipse's extract is also present.
Then I fired up Eclipse, used the Servers tab to set up the server, started it.
I get this:
However when I try http://localhost:8080 in Chrome, I get the 404 error.
Where did I go wrong ?
Your setup does work. Tomcat does work. The 404 you see is given by tomcat.
Only problem, you didn't put any index file... your servlet container needs some content!
Even i m facing the same problem discussed above. I am unable to run any app including servlet application with index file.
I found the below mentioned information in some website..
"Eclipse forgets to copy the default apps (ROOT, examples, etc.) when it creates a Tomcat folder inside the Eclipse workspace. Go to C:\apache-tomcat-7.0.34\webapps, R-click on the ROOT folder and copy it. Then go to your Eclipse workspace, go to the .metadata folder, and search for "wtpwebapps". You should find something like your-eclipse-workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps (or .../tmp1/wtpwebapps if you already had another server registered in Eclipse). Go to the wtpwebapps folder, R-click, and paste ROOT (say "yes" if asked if you want to merge/replace folders/files). "
But the problem is the temp0 folder is empty and i m unable to find the the deploy path ie wtpwebapps. If anyone has come across the same problem and come out with a solution pls let me know..

Can't add server to a moved workspace

I have this workspace downloaded off the web and I try running it on a tomcat server from a fresh installation of Eclipse Ganymede. This particular project came with its own workspace.
When I select Tomcat v6.0 I get a message
Cannot create a server using the selected type
Older tomcat versions are available, though.
I guess I have to recreate some configuration setting. The question is which one? This seems to be some odd error as creating a new dynamic web project lets me configure tomcat for both of them
I had a similar problem, but my solution is a little simpler. The problem was causesd by renaming the original folder that was referenced by the server definition.
Go to Window/Preferences/Server/Runtime Environments, remove the broken reference. Then, click 'Add' to create a new reference, select the appropriate tomcat version, click next and you'll see the incorrect path reference. Fix it. Move on.
I had this same problem on Ubuntu 8.10 with Ganymede and Tomcat6. This appears to be some sort of bug with Eclipse. If you try and create a server, and it barfs, you can't create another tomcat6 server. To correct this problem, do the following:
close eclipse
go to the {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings directory and remove a file called org.eclipse.wst.server.core.prefs.
start eclipse
add your tomcat6 server in the server tab
kotfu
#id thanks for the solution but something is also hidden in org.eclipse.jst.server.tomcat.core.prefs
So in order to solve the problem
close eclipse
go to {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings
remove the files org.eclipse.wst.server.core.prefs and org.eclipse.jst.server.tomcat.core.prefs
Tomcat 5.5
I order to be able to use the tomcat5.5 server you need to have a writeable catalina.policy file as mentioned in
http://dev.eclipse.org/newslists/news.eclipse.webtools/msg16795.html (= add a READ and WRITE permissions to the files in directory "{$tomcat.home}/conf" (chmod -vR a+rw {$tomcat.home}/conf/*). To be more specific, on the file "catalina.policy". After that, the Tomcat server can be added in the Eclipse servers)
(dead link) http://webui.sourcelabs.com/eclipse/issues/239179
and to have the tomcat5.5 stopped before entering eclipse and started afterwards.
Tomcat 6
In order to be able to use the tomcat6 server the proper solution is to have a user instance of the tomcat6 server as described in
/usr/share/doc/tomcat6-common/RUNNING.txt.gz
RUNNING.txt (on the WEB)
My configuration is Debian/Sid, Eclipse 3.4.1. Ganymede
The error view really is key. There is a lot of detail in there -- if necessary, right-click on the entries and copy their contents into your favorite text editor. One problem that can come up, for instance, is that if you have a server configuration already in place, and one of the configuration XML files is unparseable, the server can't be added. This happened to me this evening -- my <Context> element had a linebreak in it, so it was <C(linebreak)ontext>. This prevented Eclipse from recreating the server configuration.
i finally got mine to work with the default Ubuntu 8.10 tomcat. (the debug command-line on eclipse is a wonderful thing) First i had to make a couple of symbolic links and then change the permissions to a file. (you might want to think twice about changing the permissions depending on your configuration, but if eclipse can't read the file it throws and exception and the gui won't let you continue)
sudo ln -s /etc/tomcat6 /usr/share/tomcat6/conf
sudo ln -s /etc/tomcat6/policy.d/03catalina.policy /usr/share/tomcat6/conf/catalina.policy
sudo chmod a+r /usr/share/tomcat6/conf/tomcat-users.xml
Hum it can tricky. Bring the "server" view. If your project has already been deployed, remove it from the server to clean the binding between your project and the server.
Or you can right-click on your project in the project explorer and choose debug on the server. If you don't done it already, Eclipse should ask you to create a server runtime and here you can specify Tomcat 6 and specify the location of your server installation.
You can also see the "problems" view to see any problm in the project imported like the JDK etc...
Look in the error view. If you tried to set one up once and failed, Eclipse seems to try and look there again later just before allowing you to create a new one. If you've deleted the folder or its not there any more, you need to replace it so that you can proceed.
The only way I found to use the Tomcat 6 is changing the ownership of the Tomcat directory to my user. It seems that is not enough to have r/w permissions.
BTW, removing org.eclipse.wst.server.core.prefs erases you workspace configuration.
I had had same problem until I went to tomcat6 configuration directory and added ownership to my user in addition to root:
cd /usr/share/tomcat6/conf
chown root:myusername ./*
chmod 777 ./*
You can choose some better chmod for security, 777 is just a quick brutal fix.
I have Eclipse 3.5 (Galileo) + Fedora 12 + Tomcat 6 extracted from tar(which is why Eclipse could not access it). Eclipse had been complaining "Cannot create a server using the selected type".
What version of Eclipse? Europa? Ganymede?
What do you mean by workspace? An Eclipse workspace is not something you deploy, it holds your projects.
You will need to generate a WAR file (or the folder of files that would comprise the WAR file), a project would typically include an ANT or Maven build script to do this, or if the project used Eclipse's Dynamic Web Project type there might be a 'generate WAR' option somewhere. Without further details I can't help any more.
Adding a new dynamic web project to the workspace seems to 'unlock' the feature.
Changing the ownership to my user worked for me.
In my case, it was the corrupted Tomcat configuration files. Eclipse log was saying:
org.eclipse.core.runtime.CoreException:
Could not load the Tomcat server configuration at
C:\Program Files\Apache Software Foundation\apache-tomcat-6.0.14\conf.
The configuration may be corrupt or incomplete.
Got a new Tomcat distribution, removed the old one and all good now.
Finally got this problem solved on my system.
1) got rid of the apt-gotten tomcats
2) installed a typical tomcat from bins at tomcat.apache.org
3) got rid of my openjdk
4) installed the sun jdk (apt-get)
5) removed my web projects in eclipse
6) noticed that when adding a web project you can set "Target Runtime" - I tried setting it to Tomcat 6 and it let me know there was a problem
Maybe none of the above mattered, but here's what might have mattered:
7) KICKER: Window -> Preferences -> Server - Runtime Environments. Removed any crappy runtime environments here, and added the path to my newly installed tomcat.
This Question is maybe old. But I just ran into this problem. My project was not recognized as a web project (no globe icon in Eclipse ).
Suppose you use maven plugin , it failed to convert to web project with command
mvn eclipse:eclipse -Dwtpversion=1.5
In package Explorer, right-click on the project / configure / Convert to Java Facets project/ Dynamic Web project in Eclipse
Et VoilĂ 
Check the .project file at the root before and after the convert.
You will see new natures.
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
Instead of deleting config settings files, just go to Preferences -> Server -> Runtime Environments and remove the "forgotten" environment....
Thanks a lot this answer working for me..
I had a similar problem, but my solution is a little simpler. The problem was causesd by renaming the original folder that was referenced by the server definition.
Go to Window/Preferences/Server/Runtime Environments, remove the broken reference. Then, click 'Add' to create a new reference, select the appropriate tomcat version, click next and you'll see the incorrect path reference. Fix it. Move on.