use java 7 servlet3.0 in openshift

My openshift app shows deployed successfully but still get 404.

2 reasons:

1 Java compiler version

In my pom file, I first set my compiler plugin version to 1.8. Then i found it is not currently(as of 12/14/2014) supported by openshift. So i put 1.7 there thinking that it would be fine. Turns out openshift uses 1.6 by default. To use 1.7 you have to create a “.openshift/markers/java7” and checkin to your openshift repo.

.openshift and markers are directory, so user mkdir to create them. java7 is just an empty file which could be created by ‘touch java7’.

So in the pom, the compiler plugin could look like:



The last step would be push to git in openshift.

2 build profile

previously i do not have an openshift build profile, since i saw a root.war i was thinking everything is fine. After i check the size of the war, i found it is not gonna work.

-rw-r–r–. 1 548d1af4e0b8cdd40800017b 548d1af4e0b8cdd40800017b 20461 Dec 14 00:07 ROOT.war

so the build profile is madantory:

            <!-- When built in OpenShift the 'openshift' profile will be used when
                invoking mvn. -->
            <!-- Use this profile for any OpenShift specific customization your app
                will need. -->
            <!-- By default that is to put the resulting archive into the 'webapps'
                folder. -->
            <!-- -->

After this, the war is back:

-rw-r–r–. 1 548d1af4e0b8cdd40800017b 548d1af4e0b8cdd40800017b 5359660 Dec 14 16:34 ROOT.war

Reference is HERE and HERE

One Comment Add yours

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s