• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to restart ColdFusion 10 programatically

Enthusiast ,
Sep 01, 2013 Sep 01, 2013

Copy link to clipboard

Copied

Hi,

Does anyone have the code (CFSCRIPT/CFML) to restart a CF10 instance?

The code that worked for us in CF 7 and 8 no longer works on v10.

Regards,

Mark

Views

3.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 01, 2013 Sep 01, 2013

Copy link to clipboard

Copied

Hello Mark,

Thank you for your post.

Can you share the code, that previously worked.

Regards,

Anit Kumar

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 01, 2013 Sep 01, 2013

Copy link to clipboard

Copied

Sure, it was:

  <cfscript>

    oJRun = CreateObject("java", "jrunx.kernel.JRun");

    oJRun.restart(oJRun.getServerName());

  </cfscript>

CF10 now says the class jrun.kernel does not exist - is there an equivalent please?

Thanks,

Mark

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 01, 2013 Sep 01, 2013

Copy link to clipboard

Copied

It shouldn't come as a surprise that that JRun-specific code doesn't work on Tomcat 😉

I dunno the answer to your question, but googling "restart tomcat programmatically" sure comes up with a lot of results. I imagine one or more of those will point you in the right direction.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 01, 2013 Sep 01, 2013

Copy link to clipboard

Copied

No surprise that it does not work, I just wondered if there was an equivalent.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 01, 2013 Sep 01, 2013

Copy link to clipboard

Copied

As I kinda suggested: wonder-not; just google instead.

It took me about 1min to find what seemed to be a reasonable answer. However I'm not in a position to test it for you, so I shan't post it saying "this should work" as I can't be sure it will. I'm sure if you look at some of those search results though, and test 'em, you'll come up with a solution quick smart. Probably quicker than waiting around here for a useful answer (and I concede mine are mostly not, other than the guidance to use Google is fairly sound).

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 01, 2013 Sep 01, 2013

Copy link to clipboard

Copied

Already looked on Google and did not find a CF way of doing it. That's what I'm after.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 01, 2013 Sep 01, 2013

Copy link to clipboard

Copied

There won't be a "CF way", because CF is an app, and completely unaware of what servlet container it is being run by. However each given servlet container is going to have a completely different API, so you need to find the API-specific way of restarting the servlet container.

The JRun code you cite about isn't a "CF way", it's a Java way, and it's specifically a JRun way of doing it. If you were running your CF instances on Tomcat or Websphere or whatever other servlet containers were supported on <= CF9, then that code would not help you. Bear in mind that even on CF9 and before, JRun was simply the default servlet container (well: it's a J2EE server, but it's the servlet container that it includes that's significant here), and one was not compelled to run CF on JRun.  Similarly, one is not compelled to run CF10 on Tomcat, so there simply will not be a "CF way", as the notion doesn't make sense. What you're asking for is akin to asking for a MS-Word way of restarting Windows. There won't be one.

So you need to look at the Tomcat API and see if there's a way of restarting a Tomcat instance. And that is well-trod ground on google.

Another question that is begged here... why are you wanting to restart your Tomcat instance from within your CF app?

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 01, 2013 Sep 01, 2013

Copy link to clipboard

Copied

When I say CF way, I mean any way using a CFM template. The older Jrun method that I cited is a "CF way", since the Java method is called from within a CFSCRIPT tag. I know the underlying code is Java, but the restart is still achieved by running a CFM template.

Btw, you certainly can restart Windows from within MS-Word. You just write a little VB macro to access the command shell.

In fact, your MS-Word analogy was helpful; I now have a CFM template that restarts the CF application server (or Tomcat instance, if you want to call it that) using a similar method. Not the best nor the most elegant method, but it works quickly and robustly. Meanwhile, I'll wait for <cfrestartmyserver>...

That's two solutions I've found today, I'm on a roll

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 16, 2014 Apr 16, 2014

Copy link to clipboard

Copied

Tribute,

Please share your solution for the rest of us!

Thanks!

RLS

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 17, 2014 Apr 17, 2014

Copy link to clipboard

Copied

@WiWildcat

You could start a new thread. That would increase your chances of getting new, fresh suggestions.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Apr 17, 2014 Apr 17, 2014

Copy link to clipboard

Copied

WiWildcat, to actually answer the question, I found a few ways, the most crude was a .cfm script something like:

<cfexecute name="C:\Windows\System32\cmd.exe" arguments="/C C:scripts\restartcf.bat" timeout="999"></cfexecute>

where restartcf.bat does a net stop/net start on the ColdFusion service - this is for the Windows platform obviously and uses a batch file.

In our case, we wanted to refresh our instance to get memory usage down. We use some legacy code that has memory leaks and we cannot replace it easily, so If you want to refresh your instance so that it releases (GCs) memory. Our method uses the ColdFusion 10 Administrator API and "toggles" your main database DSN, which is akin to a server refresh, it's a really good solution for us and does not require a server restart. I will private message you the code if that is of interest.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 17, 2014 Apr 17, 2014

Copy link to clipboard

Copied

@Tribule

Do you realize you actually asked 2 separate questions in your original post? They are:

How to restart ColdFusion 10 programatically? (the title)

Does anyone have the code (CFSCRIPT/CFML) to restart a CF10 instance?

Which were you aiming for?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Apr 17, 2014 Apr 17, 2014

Copy link to clipboard

Copied

LATEST

@BKBK

I was aiming for either. Either would have helped, but now we have a solution.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 17, 2014 Apr 17, 2014

Copy link to clipboard

Copied

Tribute,

We have purchased a full edition of CF for production and use developers copy for test/staging. The development is done at night from one place and testing is performed in a whole 'nother state.

We just need to be able to have the non-technical testers able to restart CF so it released the IP from development and allows testing to go do their thing.

WW

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 17, 2014 Apr 17, 2014

Copy link to clipboard

Copied

You may perhaps have to make a distinction. What I meant in my last post is that you can stop and restart a ColdFusion instance without having to restart all of ColdFusion.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Apr 17, 2014 Apr 17, 2014

Copy link to clipboard

Copied

When you say "restart CF" does that mean restart the CF service? If so, you can use that cfexecute code. We personally cannot use the CFIDE Admin API since it needs a CF version higher than standard. I'm not sure if your full version will support the instance API so you can use it to restart the instance (as opposed to the service) - see http://help.adobe.com/en_US/ColdFusion/10.0/Admin/WSc3ff6d0ea77859461172e0811cbf364104-7fcf.html for details of the API.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation