Mantis - Resin
Viewing Issue Advanced Details
474 minor always 12-01-05 11:17 12-06-05 15:08
sam  
 
urgent  
closed 3.0.15  
fixed  
none    
none 3.0.16  
0000474: InstanceAlreadyExistsException with multiple virtual hosts
(rep by L Geller)

[10:33:11.319] javax.management.InstanceAlreadyExistsException:
resin:type=Host,Server=default,name=lenchik.foo.hogwarts.com

[10:33:11.319] at com.caucho.jmx.AbstractMBeanServer.registerMBean(AbstractMBeanServer.jav a:427)
[10:33:11.319] at com.caucho.jmx.Jmx.register(Jmx.java:229)
[10:33:11.319] at com.caucho.server.deploy.DeployController.init(DeployController.java:282)
[10:33:11.319] at com.caucho.server.deploy.DeployContainer.init(DeployContainer.java:338)
[10:33:11.319] at com.caucho.server.deploy.DeployContainer.generateController(DeployContainer.java:324)
[10:33:11.319] at com.caucho.server.deploy.DeployContainer.startImpl(DeployContainer.java: 270)
[10:33:11.319] at com.caucho.server.deploy.DeployContainer.start(DeployContainer.java:151)
[10:33:11.319] at com.caucho.server.host.HostContainer.start(HostContainer.java:467)
[10:33:11.319] at com.caucho.server.resin.ServletServer.start(ServletServer.java:909)

Subsequently, I cannot invoke any(!) URL/hostname. I get a 404 in the browser,
and in the log I get the same error (slightly different stack trace):

[10:44:41.374] javax.management.InstanceAlreadyExistsException:
resin:type=Host,Server=default,name=lenchik.foo.hogwarts.com

[10:44:41.374] at com.caucho.jmx.AbstractMBeanServer.registerMBean(AbstractMBeanServer.java:427)
[10:44:41.374] at com.caucho.jmx.Jmx.register(Jmx.java:229)
[10:44:41.374] at com.caucho.server.deploy.EnvironmentDeployController.initEnd(EnvironmentDeployController.java:256)
[10:44:41.374] at com.caucho.server.deploy.DeployController.init(DeployController.java:282)
[10:44:41.374] at com.caucho.server.deploy.DeployContainer.init(DeployContainer.java:338)
[10:44:41.374] at com.caucho.server.deploy.DeployContainer.generateController(DeployContainer.java:324)

I noticed that the error always mentions the host id of the last host
included using resin:import construct. Also, this error repeats N times
if I have N+1 hosts.

For example, the tail of the main config is:

<resin:import path='c:/resin/resin/conf/resin_slytherin.conf' />
<resin:import path='c:/resin/resin/conf/resin_gryffindor.conf' />


And resin_gryffindor.conf contains


<server xmlns="http://caucho.com/ns/resin" [^] >
<host id="lenchik.foo.hogwarts.com">

...

</host>
</server>

I tried swapping the order of my host config includes (I got 11 of them
locally), and the error ALWAYS repeats 10 times, always mentioning the
last host id.
has duplicate 0000489closed  allow muleiple <host> with no specified root-directory 

Notes
(0000514)
sam   
12-06-05 11:04   
These host names do not match the exception above, however they will reproduce the problem.

resin-prod.conf ----------------------------------------------

<resin xmlns="http://caucho.com/ns/resin" [^] xmlns:resin="http://caucho.com/ns/resin/core"> [^]
  <log name='' level='info' path='stdout:' timestamp='[%H:%M:%S.%s] '/>

  <server xmlns="http://caucho.com/ns/resin"> [^]
    <class-loader>
      <tree-loader path="$resin-home/lib"/>
      <compiling-loader path='webapps/WEB-INF/classes'/>
      <library-loader path='webapps/WEB-INF/lib'/>
    </class-loader>

    <http server-id="a" host="*" port="80"/>
    <cluster>
      <srun server-id="a" host="localhost" port="6803" index="1"/>
    </cluster>

    <web-app-default>
      <class-loader>
        <compiling-loader path='WEB-INF/classes'/>
        <library-loader path='WEB-INF/lib'/>
      </class-loader>
      <session-config session-timeout='5'/>

      <servlet servlet-name="resin-file" servlet-class="com.caucho.servlets.FileServlet"/>
      <servlet servlet-name="resin-jsp" servlet-class="com.caucho.jsp.JspServlet">
        <load-on-startup/>
      </servlet>
    </web-app-default>

    <host-default>
      <stderr-log path='logs/error.log' />
      <access-log path='logs/access.log' rollover-period='1D'
        format='%{Host}i %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" "%{cookie}i"' />
    </host-default>

    <resin:import path='c:/resin/resin/conf/resin_static.conf' />
    <resin:import path='c:/resin/resin/conf/resin_frncf.conf' />
  </server>
</resin>

resin-static.conf ----------------------------------------

<server xmlns="http://caucho.com/ns/resin" [^] >

<host id='lenchik.static.hogwarts.com'>

  <document-directory>c:/resin/resin/doc</document-directory>

  <access-log path='logs/access_static.log' rollover-period='1W'
    format='%{Host}i %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" "%{cookie}i"' />

  <web-app id='/'>
    <work-dir>c:/resin/resin/logs/static_work</work-dir>
  </web-app>
</host>
</server>

resin-frncf.conf ---------------------------

<server xmlns="http://caucho.com/ns/resin" [^] >

<host id="lenchik.gryfch.hogwarts.com">
  <host-alias>lenchik.gryffb.hogwarts.com</host-alias>
  <host-alias>gryffb.hogwarts.com</host-alias>
  <host-alias>qa.gryffb.hogwarts.com</host-alias>
  <host-alias>lenchik.gryffbprv.hogwarts.com</host-alias>
  <host-alias>lenchik.gryffbinternal.hogwarts.com</host-alias>
  <host-alias>lenchik.gryfboxing.hogwarts.com</host-alias>

  <document-directory>c:/dev/web/htdocs/fr_site/frncf</document-directory>

  <web-app id='/'>
    <work-dir>c:/resin/resin/logs/frncf_work</work-dir>

    <path-mapping url-pattern='/skins/*' real-path='c:/dev/web/htdocs/skins/frncf'/>
  </web-app>
</host>
</server>
(0000516)
ferg   
12-06-05 15:08   
The configuration in this instance is incorrect. Resin should give a warning.

When the root-directory of two virtual hosts is identical, Resin merges the two virtual hosts. That merging was not properly taking the configuration into account.