Skip to main content

RE: com.sdl.sts.MySTSService cannot be cast to javax.servlet.Servlet

5 replies [Last post]
Anonymous

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Gina Choi

Gina Choi

Glen Mazza

Hi Gina, after checking this past weekend and looking at it a bit
yesterday, I *was* able to debug the Metro WSP (and WSC and presumably
STS if I wanted) using Eclipse using JDK 7 and Tomcat 7 as well as JDK 6
and Tomcat 6. No changes from my blog entry is necessary but there's a
couple of points I will clarify: (1) the
"failed to connect to remote vm. connection refused. connection refused"
error will occur if you're already debugging Tomcat in Eclipse and not
realizing it (you'll need to terminate the debugging process to
reconnect again) and (2) Tomcat debugging is not tied to any Eclipse
project, you can right click Debug --> Debug Configuration... on any
Eclipse project, so you as you put the right Tomcat debugging port
Tomcat will stop on any breakpoints you set in the IDE.

Regards,
Glen

On 04/20/2012 03:40 PM, Gina Choi wrote:
>
> Hi Glen,
>
> When I try server debugging today and I am getting same error message
> what you have. I tried many things the other day, so I am not sure
> which one worked since I didn’t close my dos window. Anyway, I
> referenced this link.
> https://forums.oracle.com/forums/thread.jspa?threadID=1175498. I
> thought that had this link in previous emails.
>
> Anyway, based on that link, after spend 30 min, it looks like that I
> got server debugging working.
>
> In the startup.bat(in your case startup.sh), at end of the file, we
> have this line.
>
> call "%EXECUTABLE%" start %CMD_LINE_ARGS%
>
> I commented this line out as bellow.
>
> rem call "%EXECUTABLE%" start %CMD_LINE_ARGS%
>
> and added this line.
>
> call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
>
> Restart tomcat. At the first line, it shows this.
>
> Listening for transport dt_socket at address: 8000
>
> I didn’t set CATALINA_OPTS. Even though someone suggested as
> follow(see the above link). I couldn’t start Tomcat if I set
> CATALINA_OPTS(CATALINA_OPTS="-Xdebug
> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000”). I
> don’t think that jpda_address=8000 matters. There are two lines(if not
> "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
>
> set JPDA_ADDRESS=8000) in catalina.bat.
>
> Edit *Catalina.bat*
> change
> *set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx512m*
> to
> *set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx512m -Xdebug -Xnoagent
> -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y*
>
> When you start tomcat in console, you can see this message.
> *Listening for transport dt_socket at address: 8000*
>
> Tomcat *won't* start running further and load web application
> deployed, until you debug application in eclipse.
>
> Now, you can remotely debug.
>
> Note:
> If you use *suspend=n*, then you *can't* remotely debug
> If you use *suspend=y*, then you *can* remotely debug
>
> *Remote Debugging with Eclipse and Jetty
>
> Thanks.
>
> Gina
>
> *From:*Glen Mazza [mailto:gmazza@talend.com]
> *Sent:* Friday, April 20, 2012 1:33 PM
> *To:* users@metro.java.net
> *Subject:* Re: com.sdl.sts.MySTSService cannot be cast to
> javax.servlet.Servlet
>
> Just FYI, I ran into the same "failed to connect to remote vm.
> connection refused. connection refused" error yesterday following my
> Eclipse debugging blog instructions on Tomcat 7.x and JDK 7 with other
> work I've been doing. I didn't have that problem earlier with Tomcat
> 6 and JDK 6, so I'm unsure where the issue is. I hope to update my
> blog entry soon with workable instructions--did you ever get debugging
> working for the WSP or STS--was there any change other than the below
> that you needed to make?
>
> I'm unsure whether the address-->jpda-address change you made below is
> actually needed (the JPDA_OPTS string here doesn't have it:
> http://svn.apache.org/repos/asf/tomcat/trunk/bin/catalina.sh but if
> you use the environment value standalone you apparently do need the
> JPDA_ prefix). Without "JPDA_" while running Tomcat I still see a
> comment in the tomcat log that debugging has been activated, even
> though it's not working within Eclipse.
>
> Regards,
> Glen
>
> On 04/18/2012 03:36 PM, Gina Choi wrote:
>
> >"First I tried debugging the client, but that didn't work, so I tried
> debugging the WSP" doesn't seem to make sense though. First determine
> precisely what you need to debug (where is your problem) -- >else
> you're probably going to waste a lot of time and effort.
>
> I don’t have problem with the code, just want to make debugging
> environment working for next step. What I mostly want to see through
> debugging is calls between client and STS.
>
> >For your client, did you properly import it into your Eclipse IDE
> using mvn eclipse:eclipse (see my WSDL-first tutorial for that --
> bottom of Step #5:
> >http://www.jroller.com/gmazza/entry/web_service_tutorial#WFstep5,
> with the config info in the pom.xml changed to make sure you get the
> dependency source code) -- that's needed to make sure the >libraries
> are properly configured when you run the client.
>
> I read your web service tutorial and I ported project correctly in
> Eclipse. Otherwise, I wouldn’t able to run client through Eclipse.
>
> > Are you running Tomcat 6 or 7? The CATALINA_OPTS are for the former,
> I haven't looked into the latter yet (may be the same, maybe not).
>
> I installed standalone Tomcat7.0.27.
>
> *From:*Glen Mazza [mailto:gmazza@talend.com]
> *Sent:* Wednesday, April 18, 2012 3:14 PM
> *To:* users@metro.java.net
> *Subject:* Re: com.sdl.sts.MySTSService cannot be cast to
> javax.servlet.Servlet
>
> "First I tried debugging the client, but that didn't work, so I tried
> debugging the WSP" doesn't seem to make sense though. First determine
> precisely what you need to debug (where is your problem) -- else
> you're probably going to waste a lot of time and effort.
>
> Are you running Tomcat 6 or 7? The CATALINA_OPTS are for the former,
> I haven't looked into the latter yet (may be the same, maybe not).
>
> For your client, did you properly import it into your Eclipse IDE
> using mvn eclipse:eclipse (see my WSDL-first tutorial for that --
> bottom of Step #5:
> http://www.jroller.com/gmazza/entry/web_service_tutorial#WFstep5, with
> the config info in the pom.xml changed to make sure you get the
> dependency source code) -- that's needed to make sure the libraries
> are properly configured when you run the client.
>
> Also, for debugging, I'd recommend running Tomcat as a standalone
> application (not as a Windows service if you're doing that).
>
> Glen
>
> On 04/18/2012 03:03 PM, Gina Choi wrote:
>
> First I did “Debug the client”, but somehow I always receive
> URLClassLoader$1.run() line: 202 [local variables unavailable].
>
> So, I tried Debug the WSP.
>
> In your link
> http://www.jroller.com/gmazza/entry/eclipse_debug_web_services, it
> seems to need to make following changes in step3, sub-step1.
>
> From:
>
> export CATALINA_OPTS="-Xdebug
> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000”
>
> To:
>
> export CATALINA_OPTS="-Xdebug
> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,jpda_address=8000"
>
> After that, when I go through step3:sub-step3, I was getting “failed
> to connect to remote vm. connection refused. connection refused
> connect”. So did following. Of course
>
> I am in Windows environment.
>
>
>
> 1)Open startup.bat(inside the bin folder of tomcat) and search for
> call "%EXECUTABLE%" start %CMD_LINE_ARGS%. It’s at the end of the
> file. Replace this with call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
> (mind the spaces, better copy and paste).
>
> 2)Save the changes and start the tomcat server using its startup.bat
> file. The first line appearing on the server window should be
> "Listening for transport dt_socket at address: 8000. This indicates
> that all is well.
>
> I verified “Listening for transport dt_socket at address: 8000” and
> executed Client to debug the WSP, but I still get following message
> when debug. What local variables does it try to read?
>
> URLClassLoader$1.run() line: 202 [local variables unavailable]
>
> Gina
>
> *From:*Glen Mazza [mailto:gmazza@talend.com]
> *Sent:* Wednesday, April 18, 2012 12:59 PM
> *To:* users@metro.java.net
> *Subject:* Re: com.sdl.sts.MySTSService cannot be cast to
> javax.servlet.Servlet
>
> Be sure you know what you want to debug first -- the WSC, WSP, or STS

Gina Choi

Gina Choi