1

Unfortunately I am quite new to Spring development so cannot explain in great detail the problem but this is what I am having trouble with. I have an existing Spring application, it compiles and it works when deployed to tomcat 6 ether from Spring Tool Suite or via Maven goal. The problem is that I cannot start it on tcServer that comes with Spring Tool Suite in order to use Spring Insight (I would like to profile this application because there are some bottlenecks). I managed to add the server instance and start it but then when I tried to run the application on it I get this error:

Error: Could not find or load main class Spring

I don't have a clue what is happening and couldn't find anything about this error via google and I searched for hours. How could I remove this error and make it work?

Additional info: I am on Windows 64 bit and using 64 bit JDK 7 JRE 7 Suggested by comment : sts-3.5.0.RELEASE, vfabric-tc-server-developer-2.9.5.SR1 New findings: I have tested this same setup on Linux machine with same project and don't get that annoying exception. Would still like to know why it happens on windows although the answer about the work around with starting server outside Sts helped greatly.

Brian Clozel
  • 56,583
  • 15
  • 167
  • 176
Igor Čordaš
  • 5,785
  • 4
  • 42
  • 54
  • I added versions info to the question. – Igor Čordaš Apr 24 '14 at 12:48
  • How did you "add the server instance and start it". From within STS? Describe the steps. – Andrei Stefan Apr 24 '14 at 13:08
  • I basically just followed this tutorial http://sosiouxme.wordpress.com/2012/04/06/the-missing-guide-to-creating-and-modifying-tc-server-instances-for-sts/ It did start when I tested it before deploying my application. Should I change something under the classpath for server options maybe? – Igor Čordaš Apr 24 '14 at 13:12
  • I changed only the instalation directory to C:\Program Files\Eclipse Spring Tools\vfabric-tc-server-developer-2.9.5.SR1 shown on second image – Igor Čordaš Apr 24 '14 at 13:19
  • That blog looks ok, but it's difficult to investigate your scenario since it's STS and it is mostly only visual interaction. But, if you deployed your project from within STS into Tomcat and worked, using the same technique of deployment should work just fine with tc Server. – Andrei Stefan Apr 24 '14 at 13:23
  • It turns out that I can start tcServer with Insight (it seems it works just like any other web app) but when I deploy my app (from sts or by coping war by hand) then it gives me the Spring class error. Does this info help? – Igor Čordaš Apr 24 '14 at 14:00
  • Where did you get that error from? Logs, STS? If logs, do you have a complete log file that you can share? – Andrei Stefan Apr 24 '14 at 14:09
  • It appears in Console tab as output when I try to start the server with my app deployed. When there is no app deployed the server is started and it shows its status. Unfortunately that message is the only thing I get as output log so I don't know what to look for. – Igor Čordaš Apr 24 '14 at 14:12
  • @PSIXO run maven clean and force update once and re check. – Abhishek Nayak Apr 24 '14 at 15:19

1 Answers1

1

Try this outside STS.

  1. Get the .war file just like the one you tested in Tomcat

  2. Open a new Command Prompt window but open it with "Run as administrator"

  3. Change directory to vfabric-tc-server-developer-2.9.5.SR1 folder

  4. Run vfabric-tc-server-developer-2.9.5.SR1>tcruntime-instance.bat create -t insight test_spring_insight. This creates a tc Server instance with the "insight" template.

  5. Copy your .war file to vfabric-tc-server-developer-2.9.5.SR1\test_spring_insight\webapps

  6. Run vfabric-tc-server-developer-2.9.5.SR1>tcruntime-ctl.bat test_spring_insight install. This installs the tc Server instance as a service.

  7. Run vfabric-tc-server-developer-2.9.5.SR1>tcruntime-ctl.bat test_spring_insight start. This starts the tc Server instance.

Now you should be able to access the insight app at http://localhost:8080/insight.

Andrei Stefan
  • 51,654
  • 6
  • 98
  • 89
  • Thank you for detailed suggestion. I tried this but when I target localhost on that port its not responding. I did something similar to this but with already existing instance and the insight was working but my app was not found on server. I do get started message in the console, is there something I might have missed? – Igor Čordaš Apr 25 '14 at 08:38
  • It appears it was something to do with the server because after around five minutes it did respond and I can see the Insight app. I still get not found when trying to access my app url. Do I maybe need to explode the war somewhere ? – Igor Čordaš Apr 25 '14 at 08:41
  • It takes a bit more time to start the tc Server instance with Insight app in it. Check the logs and see if there's anything that might indicate an issue with the deployment. – Andrei Stefan Apr 25 '14 at 09:08
  • After few restarts and bunch of waiting it seems to work perfectly. I think the time taken is the Spring auto-wiring mechanisms which takes around two minutes but it doesn't matter it works in the end. To my surprise today I can even start the server from SpringTools and see both manager and insight app but not my app although it is listed as deployed. I can access my app when starting tcServer from the console like you explained so this seems to be the correct solution but would still like to find out how to start it from SpringTools. – Igor Čordaš Apr 25 '14 at 10:26
  • It shouldn't be rocket science to use it from STS, it's just like the Tomcat servers. But I learned with time that some things in STS/Eclipse very rarely break but fairly easy: Maven projects, classpaths, Eclipse specific config files etc and for me it's quicker to just start over again with a fresh install than to try and clean, refresh, restart the environment or the project. – Andrei Stefan Apr 25 '14 at 10:31