Google App Engine Eclipse Launch Local Host Multiple App Conflict? - eclipse

I have two GAE projects created through pydev in eclipse 4.2 (windows 7) and the first one I had no issues running the localhost:8080 but when I created a second project, I duplicated the Run Configuration for local run adn just changed the project name to the new one.
However- when I run that config the inital HelloWorld project shows up[ in my browser, I tried completely removing the first project, but then it just ocmplains it cant fint app.yaml in the old directory (because the old directory isnt where it was).
So clearly I'm missing some setting in the launch procedure where it sets the root path.
The run config is a PyDeb Google App Run, main module points to
C:\program files (x86)\google\google_appengine\dev_appserver.py
And the arguments are
${project_loc}\src
Everything else is on the default settings.
Any help would be greatly appreciated as pushing to Google (which works fine for both) for every little debug iteration is driving me a bit crazy.
Thanks!
*EDIT: Forgot to mention I have already tried to delete all runconfigs and remake.

Have you tried Run as : PyDev Google App Engine Run, to create a new runconfig?

Turns out I'm just a bit silly. In eclipse, I wasn't properly turning off (not sure on the correct term there) the LocalHost for the first project before starting the second. To fix, I needed to go Into eclipses console window, and select "display selected console" and choose the project I wanted to stop and hit the stop all button. Then it runs fine.
Hope this helps someone in the future, that is as determined as me that "It can't be my fault".
Cheers.

Related

Could not find or load main class in both Tomcat and Workspace

I have been tasked with adding some new features in a project I worked on a while back. It's been given some new features since I last worked on it, and the development environment has changed. I'm having a lot of troubles bringing my environment up to date with all the dependencies and external folders.
After solving a host of problems, when running the Tomcat 7 Server in Eclipse I was coming across a message:
Error: Could not find or load main class Path\To\Workspace\.metadata\plugins\cont
I tried deleted the Tomcat Server and then recreating it with the same settings, as well as deleting my .metadata folder from the workspace. Now I can't even get Tomcat to configure right:
Error: Could not find or load main class Files\ApacheSoftwareFoundation\apache-tomcat-7.0.26.
Why isn't this working? It worked before I added a couple of needed subdirectories but I'm stumped now.
Just was searching for the same problem in Eclipse("Could not find or load main class").
It turned out in my case that there was an extra space in launch configuration arguments tab. (In Java EE perspective go to Servers, click on Tomcat server, in Overview window select 'Open launch configuration' and then go to Arguments tab). Arguments are listed as
-Dx.y.z=1 -Da.b.c=2 ...
and so on, but as the dialog itself is small and arguments go across multiple lines it's not always clear where there is a space and where there is a new line. In my case it was
-Dx.y.z =1 -Da.b.c=2 ...
(there is a space before =1) which confused Tomcat and I got "Could not find or load main class" error.
It's not necessarily your case but somebody else can come across this and find it to be the answer.
In the .metadata folder eclipse saves it's internal configuration, so you should not affect it manually. The errors give you the clue to get that resource it's looking is not accessible what ever it exists or not. Try to find it manually to check if it exists, then try to make it accessible, fix the path, change permissions, etc. May be you have classpath issue, who knows.
In Eclipse I added a Tomcat Server and it was working fine. I stopped the server to alter the settings. Specifically, I checked the 'Enable security' box. When I tried to start, I got this error. So I unchecked the box and tried to restart the server - same error. This thread led me to check the launch configuration VM arguments. Sure enough, Eclipse had not handled the checkbox (and unchecking it) correctly. The VM arguments had two places where it repeated strings without quotes. Check there to see if it has been malformed.

Need help setting up a (Tomcat) web app in Eclipse for debugging

I've been using both eclipse and tomcat for years but have always deployed my web apps externally and never had a problem. Now I'd like to use eclipse to debug my web app and I can't figure out how to make it work. I started by trying to get my existing web app to deploy through eclipse but after hours of trying different things I decided to start fresh. Unfortunately, I didn't get much further. I'm hoping if I can figure out how things work with a fresh webapp I can get things to work on my existing. Sorry, this will be long, but here are the steps I tried on the latest eclipse (Juno):
Installed new version of tomcat 7.0.34 at /usr/java.
In eclipse, used "servers" view to add server, pointing to the new install (I didn't add any resources because there weren't any available yet). Starting the server worked and got a 404 as expected at http://localhost:8080/ ... then I stopped it.
Created a new "dynamic web project", named it TomcatDebug, set the location to ~/tomcat-debug, chose the server just created above (the only one), chose default config, tomcat-debug is empty so chose defaults for build paths, defaults for module settings and had it generate web.xml.
In the "tomcat-debug" folder it creates WebContent, build, and src. I throw a sample "hello, world" index.html into WebContent.
Now the project TomcatDebug is created so I try to run it, tell it to "run on server", and it goes to http://localhost:8080/TomcatDebug/ but gives a 404. I even try to add index.html but it still gives a 404.
This is about as basic as it can possibly get so what did I do wrong?
Continuing to try and figure this out I stop the server, change the server setting to "use tomcat installation", but still get a 404 in the same way when I restart. I tried changing my module context path and still 404.
I'm completely stumped. I believe I followed all the wizards as basically as possible. Where did I go wrong?
Thanks for taking a look.
I haven't run tomcat through eclipse in a while, so can't answer that aspect of the question. But, to get at the heart of what you're trying to do (debug a webapp in eclipse through tomcat), you shouldn't necessarily need to. This may serve you instead:
EDIT: Eh, look here for instructions ("Debugging" section). The below is how I did it (JUNO and TC 7) and has an annoying quirk in point #1.
edit the startup.sh (assuming *NIX/OS X) - the last line will probably be
exec "$PRGDIR"/"$EXECUTABLE" start "$#"
change this to
exec "$PRGDIR"/"$EXECUTABLE" jpda start "$#"
to activate debugging. (there are other ways to do this that may be better - i think tomcat/the VM may pause for listeners before proceeding, so when you aren't debugging this is not ideal)
Create a Debug Configuration in eclipse, under the "Remote Java Application" set. Default port should be fine, and presumably host. Choose your project.
Add sources of relevance to your debugging in the Source tab.
Start server and run your new debug configuration. App should stop at breakpoints you've set.
Right Click your index.html Run As -> Run On Server you will see Tomcat will automatically run the page.

"selection cannot be launched and there are no recent launches" when using pydev/eclipse

I am getting the above error when launching a python file that worked in the past. I think I know how this happened but not sure how to fix it. I have 2 computers dual booting different os and use dropbox to stay synced between them all. In the past I synced my eclipse workspace with my mac and windows computers this way and everything worked fine(except I would have to change the location of the python interpreter depending on what system I was using).
I started getting the above message after I added a linux(fedora) to share dropbox files. But my problem is now when I try to update my python interpreter(in windows) it doesn't save my setting. I can hit autoconfig and it'll find the python path and all the files and I hit apply/okay, but when I go back its all blank. I'm pretty sure the linux machine messaged my settings up, but I need to develop on all 3 boxes so I need them to be kind of synced.
Wondering how to fix this and if there's another way to do this so I don't have this problem in the future?
update: this def. has something to do with my workspace. When I change the default workspace to a new folder and set the python interpreter it works. Still not sure how to permanently fix this(don't want to have to copy code back and forth to new workspaces.
I think an answer of how to share workspace among other enviroments is still very helpful but if anyone is having a simlair problem and just needs to fix it to work quickly here's the solution:
go to File, switch workspaces and figure out where your workspace is located
Go to that folder and rename the .metadata folder and relaunch eclipse
In eclipse everything will be missing, so go to file-->import and import the folder with all your projects(do the root folder of all the projects so you don't have to import each one individually).
setup any customizations you had before
This is not the best solution but it works. Hopefully someone else has a way of preventing this problem from happening in multiple environments.
It seems the preferred way is through F9: http://pydev.org/manual_adv_launch.html
eclipse run as same as what it run last time.
then first time run in this way.
in package explorer (left).
doubleclick res then menu.
then rightclick main menu (name.xml).
frmo menu select run then run as application.
and you can run as default in next time(from menu or shortcut).
This problem can often be solved by exiting out of eclipse and restarting (if that happens to be convenient for you). Changing workspaces midstream can often confuse Eclipse even if PyDev is correctly configured.

Xcode 4.2. gets stuck "Attaching to myapp" when running

In xcode 4.2, sometimes when you're going to run your ios proj on simulator, the status windows says "Attaching to myapp", and just gets stuck there... until you cancel.
Now, this has been asked before:
XCode 4 hangs at "Attaching to (app name)"
and surprisingly, besides the accepted answer on that thread, there are at least 10 other possible solutions others have been adding, all for the same issue, people says one of them worked while the others didn't...
please note, this is not a sequence of steps. each one is a possible solution:
1- restart xcode and/or restart simulator (reset content and settings) and/or restart computer.
2- click on project name in project navigator. in build settings tab, go to packaging and make sure that "Product Name" is the same that the one xcode says simulator is attaching to when running. if they are different, it will fail.
3- go to your projectname.xcodeproj folder. inside there delete anything named with your userid. when you reopen xcode those files will be recreated and it should work…
4- Manually delete the build directory for your project.
5- Go to organizer window. select Projects, select your app in the left hand side and then delete over "Derived Data"
6- Check Launch option is set to "Automatically" in Product->Edit Scheme, "Run" scheme.
7- In Project->"Edit Schemes"->Run. Change the Debugger from GDB to None (this doesn't make sense to me..).
8- Kill the process gdb-i386-apple-darwin from Activity Monitor. this is assuming gdb is not responding.
9- In "Product"->Edit Scheme. in Run, click yourappname.app, choose other, navigate to your .app in your project. now run.
10- Check that you don't have two different Info.plist in your project. if you do, remove the bad one.
In my case, none of them do the job. My project builds succesfully, everything seems fine, .plist, bundle identifier, name, etc.. and still can't pass the "attaching" part. i don't understand the reason of this, so any suggestions to fix it and possibly understand the problem i'll really appreciate it.
New projects were failing to launch in the simulator, getting stuck on the attach step.
This seems to be after Xcode 4.3 was installed, but I can't recall the last new project I created.
This is what worked for me, the clue coming from this thread...
Project->"Edit Schemes"->Run. Change the Debugger from LLDB to GDB
Another computer with the same version of Xcode works fine. Maybe my LLDB is corrupt?
Did you recently upgrade to OSX 10.7.2? I started having the same problem after I upgraded. I noticed that the Simulator always get stuck if I'm connected to a Wi-Fi network that forces Captive Portal authentication. This happens with other apps as well (Chrome, Safari). I'm not really sure why this happens, but I did read that 10.7.2 has issues with Captive Portal authentication.
Anyway, in my case, I repaired disk permission from Disk Utility and rebooted my machine. This seems to resolve the issue.
Just rebooting the computer worked for me.
Tried all the solutions but none applied to my case. XCode 4.2, OS X 10.6.8
Found that the Info.plist bundle identifier had been accidentally deleted when adding a custom app icon. Adding that back fixed the problem.
Anyway that's my fix, hope it helps someone.
Also before figuring out that, found I could start the simulator from another app and then use the app icon on the simulator for the app that would not attach, and start it up that way.
seems like there seem to be a lot of things causing this, but one thing that worked for me was simply cleaning out the build folder by pressing Cmd+Option+Shift+K or alternately if you select the Product dropdown in the toolbar and hold the Option button you should see the "Clean Build Folder" option appear
I also tried all solutions in that topic but all failed. But finally it was found out that what was went wrong.
What made this issue occurred is that some settings in Target->Build Settings was got modified by me for including C headers. And after I added all C headers and make it built. This issue occurred.
It might be only works on the situation I described before.
I just created an empty project and check all items in Target->Build Settings between the attaching-stuck app and the empty one. It was found that some items in the attaching-stuck one was different from the empty one.
So I deleted it and make it attached successfully.
It seems different in my case and also solved in a different way. If you got stuck every time after drop some files or folders into your project with the 'Create folder references for any added folders' way, this will be the solution.
Click the project node(the root node) on Xcode's project navigator and select target node. It's under the 'TARGETS'. Then click the 'Build Phases' tab. There are 4 sections of some list and you can click the triangle to expand the list.
You need to concentrate on the 'Compile Sources' and 'Copy Bundle Resources' section. Code files like .m must be placed on the 'Compile Sources' section and are compiled automatically. Resource files like .jpg must be placed on the 'Copy Bundle Resources' section and are copied into the project's package.
So, if the dropped files and folders are not in the 'Copy Bundle Resources' list, just drag it form the project navigator and drop onto the list. That will solve the problem.
If it doesn't work, delete all the referenced files and folders, click '+' button on the resource (or compile) section and click 'Add other...' button. Then you can include files and folders as the 'Create folder references for any added folders' way. I think the 'drag and drop' works well after the '+ button' way is done once.
In addition, 'Resource' may not allowed for folder name.
I experienced the 'stuck' problem every time when I attach files and folders as reference on Xcode 4.2 ~ 4.3.3. Reinstalling mac was a useless effort for me.
I have noted in Lion that when the iOS sim locks up or hangs the app,
that if I go to a shell, and do ps -ef |grep SDK, I will
see many, many processes running associated with the simulator.
I tried to kill off these processes but they rapidly respawn
and the only solution then is to reboot. Also, in the ps output,
you will also see instances of your app running as well.
So the Simulator issue is caused by previously running processes
that appear to block the correct running of the latest one.
I guess Apple will have a fix for this eventually, as it is quite onerous.
Rebooting works for me, too, but this shouldn't be necessary. I'd recommend filing a bug at bugreport.apple.com. You can duplicate the one I created - the more it's duplicated, the more likely Apple is to fix the problem.
I tried all of the solutions above but without luck ...
When I search for simular problem here :
Xcode error: failed to launch [directory] -- invalid host string: 'localhost'
I found it fixed my problem!
Hope this helps those who are still searching for a clue .
Upgrading to XCode 4.6.2 resolved this issue for me
Even if the app is not attaching after cleaning the project, changing the app name, restart the by resetting the simulator, and if you are using LLDB compiler, it is because the LLDB compiler is not able to connect to the local debug server in order to solve this, take a look at this
Why does the LLDB Debugger constantly fail to attach?
This really solves your problem!

Eclipse 3.5 Cache Problem

I am using eclipse 3.5 with google app engine + spring framework to develop application. My problem is when I change the code and build the project, the new code doesn't come in to effect. I even deleted the old file but at runtime, the old version gets display in the browser. Why?
Your description is not explicit, so following are my assumptions:
You are changing jsp/js or view related files
You have Google app engine plugin for eclipse to deploy the code
Following might be one of the reasons:
Your view files are cached in the browser, so try deleting the browser cache
Google app engine might have cached your files, so try deleting the temp folder
Eclipse IDE wouldn't have deployed your changed code, so check the timestamp, if it still shows the old timestamp, then find out how to configure eclipse to detect your changes.
I found 3 workarounds for similar issue (changes to a servlet (.java file) were not taking effect).
Before editing the .java file, stop the application. It seems that if you edit it while running, the issue occurs, even if you edit it, stop then re-start.
Delete items in Temp folder e.g, (C:\Users\username\AppData\Local\Temp), then stop and re-start the app.
I think the culprit folder in the Temp folder is this:Jetty_127_0_0_1_8888_war__.g0qk00
Right click in in the console area and select 'Remove All Terminated'. Sometimes that reveals there are other instances running, which need to be stopped by clicking the terminate button.
I got the similar issue and the problem was due to not stopping the running server.
What i was doing was running the server, editing the java file, saving and again running the server. This created two instances of the server running and when checking into the browsers the old code was executed from the first instances.
So, the solution is terminate and relaunch the server, and your new changes will be in effect.