[MAGNOLIA-4466] Print proper error message in case of incorrect host name configuration Created: 03/Jul/12  Updated: 11/Oct/13  Resolved: 12/Sep/12

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 4.5.3
Fix Version/s: 4.5.5

Type: Bug Priority: Minor
Reporter: Claus Nielsen Assignee: Jaroslav Simak
Resolution: Fixed Votes: 0
Labels: installation
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Tomcat 7.0.26 on OpenJDK 1.6.0_24-b24 on Ubuntu 12.04 on Amazon EC2.


Attachments: Text File stacktrace1.txt     Text File stacktrace2.txt    
Issue Links:
Relates
relates to MAGNOLIA-5379 NullPointerException when server name... Closed
relation
is related to MAGNOLIA-4486 fails to launch with tomcat bundle an... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

I'm trying to install magnolia for the first time.
I downloaded magnolia-bundled-webapp-4.5.3.war and dumped it in Tomcat's webapps folder, but when i try to start it it fails with an NPE.

I get this in the localhost log file: see attached stacktrace1.txt

On a 2nd attempt, trying to start the app from Tomcat manager, I got this similar, but slightly longer, stacktrace:
see attached stacktrace2.txt



 Comments   
Comment by Ondrej Chytil [ 03/Jul/12 ]

Hi Claus,

I'm unable to reproduce this issue with Tomcat 7 and Magnolia 4.5.3. Are you sure you deployed war file correctly? Please see http://documentation.magnolia-cms.com/administration/installation/war/tomcat.html.

Comment by Claus Nielsen [ 03/Jul/12 ]

Yes.
And now i have also tried the version with tomcat bundled. Same result.
And I have tried it with Oracle's Java 7 JDK. Same result.

Comment by Jan Haderka [ 03/Jul/12 ]

the line that fails is the one trying to resolve server name in order to find out configuration specific to that server:

      System.setProperty("server", platform.getComponent(MagnoliaInitPaths.class).getServerName());

Documentation for getServerName() says:

    /**
     * The server name  is resolved to the full name obtained by using InetAddress.getLocalHost().getHostName(), which
     * may also contain the server domain, depending on your server configuration/operating system. You can set the
     * optional context parameter "magnolia.unqualified.server.name" to true if you prefer using the unqualified name
     * (the server "server.domain.com" will be simply resolved as "server").
     *
     * <pre>
     * &lt;context-param>
     *   &lt;param-name>magnolia.unqualified.server.name&lt;/param-name>
     *   &lt;param-value>true&lt;/param-value>
     * &lt;/context-param>
     * </pre>
     */
    @Override
    public String getServerName() {
        return serverName;
    }

so I would presume that your server security configuration forces java to return null from this call and you using default war file means you don't have optional context parameter mentioned in the javadoc configured either. If you fix your server config or Magnolia configuration, all should be fine.

But I agree that there should be nicer error message printed out in case of such issue then NPE.

Comment by Claus Nielsen [ 03/Jul/12 ]

Ahhh...
I had an incorrect hostname in /etc/hostname.
Thanks!

Comment by Jan Haderka [ 03/Jul/12 ]

Thx for confirming the analysis.

Generated at Mon Feb 12 03:56:03 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.