question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WAR Deployment in TOMCAT - challenges

See original GitHub issue
Overview of the issue

I have built two apps using JHIPSTER - one on mysql and another on mongoDB; The war file is being build with the following command mvnw -Pprod -DskipTests package Then i rename the .original file and put the same in WEBAPPS folder;

I could not deploy on TOMCAT 8 and hence i put the same in TOMCAT 9 and luckily the first app with mysql started working; Then i put the second app into the webapps folder and now i see that it is giving strange error;

2017-06-27 16:40:31,319 ERROR [ContainerBackgroundProcessor[StandardEngine[Catalina]]] EndpointMBeanExporter: Could not register MBean for endpoint [requestMappingEndpoint] org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [org.springframework.boot.actuate.endpoint.jmx.DataEndpointMBean@211e5002] with key ‘requestMappingEndpoint’; nested exception is javax.management.InstanceAlreadyExistsException: org.springframework.boot:type=Endpoint,name=requestMappingEndpoint at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:628) org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [org.springframework.boot.actuate.endpoint.jmx.DataEndpointMBean@2573d632] with key ‘environmentEndpoint’; nested exception is javax.management.InstanceAlreadyExistsException: org.springframework.boot:type=Endpoint,name=environmentEndpoint similarly

2017-06-27 16:40:31,427 ERROR [ContainerBackgroundProcessor[StandardEngine[Catalina]]] EndpointMBeanExporter: Could not register MBean for endpoint [traceEndpoint] 2017-06-27 16:40:31,443 ERROR [ContainerBackgroundProcessor[StandardEngine[Catalina]]] EndpointMBeanExporter: Could not register MBean for endpoint [dumpEndpoint] 2017-06-27 16:40:31,487 ERROR [ContainerBackgroundProcessor[StandardEngine[Catalina]]] EndpointMBeanExporter: Could not register MBean for endpoint [configurationPropertiesReportEndpoint]

Motivation for or Use Case

We might need multiple apps to be installed on the TOMCAT; ANd the integration between tomcat & jhipster have to be smooth;

Reproduce the error

Build war from two jhipster apps - each on different db’s; put the war in webapps folder;

Related issues
Suggest a Fix

Naming of the beans that are not mentioned in the YML should be unique so that they do not clash - have uncommon names

JHipster Version(s)

4.5.2 Executing jhipster:info Welcome to the JHipster Information Sub-Generator

JHipster Version(s)
tourgeomongo@0.0.0 E:\junkdata\testjhi\geo
+-- UNMET PEER DEPENDENCY @angular/common@4.1.3
+-- UNMET PEER DEPENDENCY @angular/core@4.1.3
`-- generator-jhipster@4.5.2

**JHipster configuration, a .yo-rc.json file generated in the root folde

r**

{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "org.easytour.nammanimmacycle"
    },
    "jhipsterVersion": "4.5.2",
    "baseName": "tourgeomongo",
    "packageName": "org.easytour.nammanimmacycle",
    "packageFolder": "org/easytour/nammanimmacycle",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "hibernateCache": "no",
    "clusteredHttpSession": false,
    "websocket": false,
    "databaseType": "mongodb",
    "devDatabaseType": "mongodb",
    "prodDatabaseType": "mongodb",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "jwtSecretKey": "d3452a6955a78cf31558c21805cf8e11773edaa7",
    "clientFramework": "angular2",
    "useSass": false,
    "clientPackageManager": "yarn",
    "applicationType": "monolith",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "enableTranslation": false
  }
}
**Entity configuration(s) entityName.json files generated in the `.jhips

ter` directory**

TouristCircuit.json

{
    "fluentMethods": true,
    "relationships": [],
    "fields": [
        {
            "fieldName": "circuitName",
            "fieldType": "String"
        },
        {
            "fieldName": "startPoint",
            "fieldType": "String"
        },
        {
            "fieldName": "endPoint",
            "fieldType": "String"
        }
    ],
    "dto": "mapstruct",
    "service": "serviceImpl",
    "entityTableName": "tourist_circuit",
    "pagination": "infinite-scroll"
}

TouristDestination.json

{
    "fluentMethods": true,
    "relationships": [],
    "fields": [
        {
            "fieldName": "destinationName",
            "fieldType": "String"
        },
        {
            "fieldName": "geoCenter",
            "fieldType": "String"
        }
    ],
    "dto": "mapstruct",
    "service": "serviceImpl",
    "entityTableName": "tourist_destination",
    "pagination": "infinite-scroll"
}

TouristZone.json

{
    "fluentMethods": true,
    "relationships": [],
    "fields": [
        {
            "fieldName": "zoneName",
            "fieldType": "String"
        },
        {
            "fieldName": "zoneCenter",
            "fieldType": "String"
        }
    ],
    "dto": "mapstruct",
    "service": "serviceImpl",
    "entityTableName": "tourist_zone",
    "pagination": "pagination"
}

TourMedia.json

{
    "fluentMethods": true,
    "relationships": [],
    "fields": [
        {
            "fieldName": "title",
            "fieldType": "String"
        },
        {
            "fieldName": "description",
            "fieldType": "String"
        },
        {
            "fieldName": "location",
            "fieldType": "String"
        },
        {
            "fieldName": "circuitLines",
            "fieldType": "String"
        },
        {
            "fieldName": "url",
            "fieldType": "String"
        },
        {
            "fieldName": "mediaType",
            "fieldType": "Integer"
        },
        {
            "fieldName": "uploadTime",
            "fieldType": "Instant"
        }
    ],
    "dto": "mapstruct",
    "service": "serviceImpl",
    "entityTableName": "tour_media",
    "pagination": "pagination"
}

TourMedia2.json

{
    "fluentMethods": true,
    "relationships": [],
    "fields": [
        {
            "fieldName": "title",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldName": "description",
            "fieldType": "String"
        },
        {
            "fieldName": "mediaType",
            "fieldType": "Integer"
        },
        {
            "fieldName": "urlOfMedia",
            "fieldType": "String"
        }
    ],
    "dto": "mapstruct",
    "service": "serviceImpl",
    "entityTableName": "tour_media2",
    "pagination": "infinite-scroll"
}

Zone.json

{
    "fluentMethods": true,
    "relationships": [],
    "fields": [
        {
            "fieldName": "name",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldName": "geoCenter",
            "fieldType": "Instant"
        },
        {
            "fieldName": "location2",
            "fieldType": "String"
        }
    ],
    "dto": "mapstruct",
    "service": "serviceImpl",
    "entityTableName": "zone",
    "pagination": "pagination"
}

Browsers and Operating System

java version “1.8.0_131” Java™ SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot™ Client VM (build 25.131-b11, mixed mode)

git version 2.7.2.windows.1

node: v6.10.0

npm: 3.10.10

yeoman: 1.8.5

yarn: 0.21.3

Execution complete MYSQL APP:

    {
        "relationshipId": 5,
        "relationshipName": "rentalCharge",
        "otherEntityName": "hourlyRentalCharges",
        "relationshipType": "many-to-one",
        "otherEntityField": "id"
    }
],
"fields": [
    {
        "fieldName": "rentStartTime",
        "fieldType": "ZonedDateTime",
        "fieldValidateRules": [
            "required"
        ]
    },
    {
        "fieldName": "rentStopTime",
        "fieldType": "ZonedDateTime",
        "fieldValidateRules": []
    },
    {
        "fieldName": "fineApplied",
        "fieldType": "Boolean"
    }
],
"changelogDate": "20170427200614",
"dto": "mapstruct",
"service": "serviceClass",
"entityTableName": "rental_trip",
"pagination": "pagination"

}


Reward.json

```yaml
{
    "fluentMethods": true,
    "relationships": [],
    "fields": [
        {
            "fieldName": "rewardReason",
            "fieldType": "String"
        },
        {
            "fieldName": "rewardPoints",
            "fieldType": "Integer"
        }
    ],
    "changelogDate": "20170512060231",
    "dto": "mapstruct",
    "service": "serviceClass",
    "entityTableName": "reward",
    "pagination": "pagination"
}

StationDistanceMatrix.json

{
    "fluentMethods": true,
    "relationships": [
        {
            "relationshipName": "sourceNode",
            "otherEntityName": "rentalBufferNode",
            "relationshipType": "many-to-one",
            "otherEntityField": "stationName"
        },
        {
            "relationshipName": "destNode",
            "otherEntityName": "rentalBufferNode",
            "relationshipType": "many-to-one",
            "otherEntityField": "stationName"
        }
    ],
    "fields": [
        {
            "fieldName": "distance",
            "fieldType": "Float"
        }
    ],
    "changelogDate": "20170510105858",
    "dto": "mapstruct",
    "service": "serviceImpl",
    "entityTableName": "station_distance_matrix",
    "pagination": "pagination"
}

StockBufferNode.json

{
    "fluentMethods": true,
   "relationships": [
        {
            "relationshipId": 1,
            "relationshipName": "stockManager",
            "otherEntityName": "user",
            "relationshipType": "many-to-one",
            "otherEntityField": "firstName"
        }
    ],
    "fields": [
        {
            "fieldId": 1,
            "fieldName": "godownName",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldId": 2,
            "fieldName": "storageCapacity",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldId": 3,
            "fieldName": "address1",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldId": 4,
            "fieldName": "address2",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },

                  {
            "fieldId": 5,
            "fieldName": "city",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldId": 6,
            "fieldName": "state",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldId": 7,
            "fieldName": "zipcode",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldId": 8,
            "fieldName": "longitudePos",
            "fieldType": "Double",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldId": 9,
            "fieldName": "latitudePos",
            "fieldType": "Double",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldId": 10,
            "fieldName": "colorCode",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        }
    ],
    "changelogDate": "20170427195821",
    "dto": "mapstruct",
    "service": "serviceImpl",
    "entityTableName": "stock_buffer_node",
    "pagination": "pagination"
}

TripRentUnitsToFareMap.json

{
    "fluentMethods": true,
    "relationships": [],
      "fields": [
        {
            "fieldId": 1,
            "fieldName": "fareScheme",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldId": 2,
            "fieldName": "prePaidUnits",
            "fieldType": "Integer",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldId": 3,
            "fieldName": "chargesForPaidUnits",
            "fieldType": "Float",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldId": 4,
            "fieldName": "expirationPeriodInMonths",
            "fieldType": "Integer",
            "fieldValidateRules": [
                "required"
            ]
        }
    ],
    "changelogDate": "20170427200150",
    "dto": "mapstruct",
    "service": "serviceImpl",
    "entityTableName": "trip_rent_units_to_fare_map",
    "pagination": "pagination"
}

TypeOfIDCard.json

{
    "fluentMethods": true,
    "relationships": [],
    "fields": [
        {
            "fieldName": "authorizedIDName",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        },
        {
            "fieldName": "authorizationAgency",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        }
    ],
    "changelogDate": "20170428042651",
    "dto": "mapstruct",
    "service": "serviceImpl",
    "entityTableName": "type_ofidcard",
    "pagination": "pagination"
}

Browsers and Operating System

java version “1.8.0_131” Java™ SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot™ Client VM (build 25.131-b11, mixed mode)

git version 2.7.2.windows.1

node: v6.10.0

npm: 3.10.10

yeoman: 1.8.5

yarn: 0.21.3

Execution complete rememberMe key or the jwtSecretKey key. –>

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System

FIREFOX CHROME

  • [X ] Checking this box is mandatory (this is just to show you read everything)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jduboiscommented, Jun 27, 2017

We try to follow the “12 Factors”, so having 2 apps in one WAR is out of our scope. Besides, deploying a WAR on Tomcat is OK for legacy reasons, but this is clearly not where we are heading in the future.

-> this won’t have a high priority, but of course I hope we can find a solution for you

As you seem to have an issue with JMX, you could disable it - which can of course be seen as a bad idea - and try to deploy both. Hopefully this will work. The key is spring.jmx.enabled=false in your application.yml file. Can you try this and update the issue accordingly?

0reactions
jduboiscommented, Jul 3, 2017

OK so that works -> this is why I’m keeping this closed

Now if you want 2 different ports, I don’t think that’s possible. If you use the standard configuration in the JVM:

-Dcom.sun.management.jmxremote.port=$JMX_REGISTRY_PORT 
-Dcom.sun.management.jmxremote.rmi.port=$RMI_SERVER_PORT

This of course configures the ports for the whole JVM, not for a single app in Tomcat, and thus it just won’t work.

I don’t think there’s an easy solution here - but please note that isn’t the approach we are pushing, we do one app per JVM normally.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues with deploying a war file in Tomcat server
Im trying to deploy a war file in Tomcat and im having issues accessing the application. The code actually works fine in eclipse...
Read more >
How to deploy a WAR file to Tomcat 5 different ways
1. Copy and paste ... Perhaps the simplest way to deploy a WAR file to Tomcat is to copy the file to Tomcat's...
Read more >
How many WAR files can be deployed in Tomcat ... - Quora
You can deploy as many WAR applications to Tomcat as possible with the server resources, especially the available RAM. Now if you are...
Read more >
Deploying artifacts to Tomcat will sometimes fail on due to file ...
When a plan is configured to use Deploy Tomcat application task to deploy the generated artifacts to Tomcat (as explained here - Using ......
Read more >
Tomcat Web Application Deployment - Apache Tomcat
Deployment is the term used for the process of installing a web application (either a 3rd party WAR or your own custom web...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found