This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 56369 - Appserver doesn't start HTTP server if HTTP monitor window closed
Summary: Appserver doesn't start HTTP server if HTTP monitor window closed
Status: CLOSED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Sun Appserver 8 (show other bugs)
Version: 4.x
Hardware: All Linux
: P3 blocker (vote)
Assignee: Geertjan Wielenga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-14 12:57 UTC by Jaroslav Pospisil
Modified: 2006-03-24 13:09 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Pospisil 2005-03-14 12:57:20 UTC
Build 200503101100
1.Add appserver and enable HTTP monitor
2.Create new web module
3.Edit web.xml ans web folder to enable HTTP monitor with this module(check the
help/HTTP Monitor/Setting up...)
4.Run module once without open HTTP monitor window(default) 
5.
ERROR: HTTP monitor window won't appear and even if it's opened afterwards,no
record is there.
NOTICE: HTTP server is not running,if I check it - appserver doesn't start HTTP
server.
Comment 1 Petr Jiricka 2005-03-14 14:49:26 UTC
Easy to do, see how Tomcat module does this

org.netbeans.modules.tomcat5.ide.MonitorSupport:

    private static URL getSampleHTTPServerURL() {
        FileSystem fs = Repository.getDefault().getDefaultFileSystem();
	    FileObject fo = fs.findResource("HTTPServer_DUMMY");
	    if (fo == null) {
	        return null;
	    }
	    URL u = URLMapper.findURL(fo, URLMapper.NETWORK);
	    return u;
    }

Comment 2 _ ludo 2005-03-15 15:33:37 UTC
I am lost.
Easy to do where?
What to do?

Did you add the necessary jar for this to work also? This is not described in
your secenario.
need more info asap.
Comment 3 Jaroslav Pospisil 2005-03-15 15:41:21 UTC
I ve added the needed jar and also created the filter in web.xml as is described
in help.I've checked all and tested it also case with open HTTP monitor
window,when it works O.K.
Comment 4 _ ludo 2005-03-15 16:38:38 UTC
which needed jar?
i.e one or two: httpmonitor and schema2beans?

For app server, schema2beans should not be added.
What does it mean that "HTTP Server" is not running? Which one? the one from
NetBeans?
Hw a plugin can start programatically the internal server?
Based on wich information?
Comment 5 Jaroslav Pospisil 2005-03-16 10:00:57 UTC
O.K. I'll write it step by step.
1) I added the appserver 8.1 in Runtime tab
2) I switched to Properties of this appserver and checked Enable HTTP Monitor
3) I've created new Web module - all stay default so server was appserver
4) I consulted the Help/Contents/Servers and Databases/HTTP monitor/Setting up
the HTTP monitor
5)I opened the web.xml and inserted filter:
<filter>
    <filter-name>HTTPMonitorFilter</filter-name>
   
<filter-class>org.netbeans.modules.web.monitor.server.MonitorFilter</filter-class>
    <init-param>
      <param-name>netbeans.monitor.ide</param-name>
      <param-value>localhost:8082
      </param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>HTTPMonitorFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>ERROR</dispatcher>
  </filter-mapping>
6) Since I used SJS appserver 8.1,I only added
IDE-install-directory/enterprise1/modules/ext/org-netbeans-modules-web-httpmonitor.jar
to WEB-INF/lib of my web module.
7) I started application by clicking on Run in menu and then HTTP server from
Netbeans didn't started what also caused no HTTP monitor window was opened and
no record there appeared.

When I work with Tomcat,HTTP server is always started after I Run the web
application, so I expect the same behaviour from appserver.
I think we had to to either correct this or update the help and specifically say
the user,he must run the HTTP server first,if he want to use HTTP monitor with
appserver.
Comment 6 Jaroslav Pospisil 2005-03-16 12:48:25 UTC
I'm forwarding oppinion of Stepan Herold:

Tomcat's starts the internal http server by itself, in the
MonitorSupport.getSampleHTTPServerURL method

    private static URL getSampleHTTPServerURL() {
        FileSystem fs = Repository.getDefault().getDefaultFileSystem();
        FileObject fo = fs.findResource("HTTPServer_DUMMY");
        if (fo == null) {
            return null;
        }
        URL u = URLMapper.findURL(fo, URLMapper.NETWORK);
        return u;
    }

The URLMapper.findURL call causes the internal http server to startup.
 
Comment 7 _ ludo 2005-03-17 01:47:20 UTC
our plugin does the same, but this call is in the automatic setting or http
moniotr, and this bug is about manual configuration of http monitor in the web
app itself...
So how can the plugin knows when it deployed to configured for http monitor web
apps that it needs to start the internal http monitor?

Comment 8 Sherold Dev 2005-03-17 12:47:42 UTC
This is how it works for tomcat when you set its "http monitor enabled" option
and I guess from Ludo's comment that it works the same way for appserver.

To summarize it: these steps needs to be done by plugin before the server with
the "http monitor enabled" option is started.

1. The httpmonitor and schema2beans jar files should be copied to the server
(appserver requires only the httpmonitor jar since it already has the
schema2beans jar).

2. The filter declaration should be added to the <CATALINA_BASE>/conf/web.xml.
(default-web.xml for appserver). This does NOT belong to web applications web.xml!

3. plugin should then start the internal http server (the one from the runtime
tab) by calling the URLMapper.findURL(fo, URLMapper.NETWORK), as described above.

However, if an user wants to enable the http monitor manually, he should perform
ALL the above steps by himself. In this case it is OK to add the filter
definition to application's web.xml.

I've just checked the ide help and the #3 step is missing. User should go to the
runtime tab and start the internal "HTTP Server" manually.

TO Geertjan: CC'ing Geertjan since this issue is bound to be reassinged to him.

TO Jarda: could you please check whether it works for appserver with "http
monitor enabled" option as described? I mean w/o copying or tweaking the web.xml.
Comment 9 Jaroslav Pospisil 2005-03-17 13:32:47 UTC
Cannot reproduce in build 200503170655,probably fixed.
Reassigning to Geertjan,help should be updated.
Comment 10 Geertjan Wielenga 2005-04-01 16:57:07 UTC
Fixed in "Setting up the HTTP monitor" topic.

Please verify this topic very carefully.
Comment 11 Jaroslav Pospisil 2005-05-03 10:05:02 UTC
Verified in 200504291131.