0

I am having some issues getting an application to work and it seems to be down to problems with Apache Tiles.

The odd thing, and the basis of my question is that when I deploy through STS to the 2 tomcats using the same java versions the app works, yet when I take the war files built with maven (same version of java as tomcat is using) and then deploy them manually to either of the tomcats the application doesnt work.

I am building with maven through STS using jdk1.7.0_09

I am deploying through to STS to tomcat 7.0.32 using jdk1.7.0_09 - this works

deploying manually to tomcat webapps tomcat 7.0.32 using jdk1.7.0_09 - error:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.tiles.request.render.CannotRenderException: ServletException including path '/WEB-INF/tiles/layout.jsp'.

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 1 in the generated java file
The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files

I am deploying through to STS to tomcat 7.0.53 using jdk1.7.0_09 - this works

deploying manually to tomcat webapps tomcat 7.0.53 using jdk1.7.0_09 - error:

 org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.tiles.request.render.CannotRenderException: ServletException including path '/WEB-INF/tiles/layout.jsp'.

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 1 in the generated java file
The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files

I dont understand why it works when I deploy it to the same tomcats via Eclipse?

Finally when I try to deploy to the test server (classes still built with jdk1.7.0_09) which is set up using:

tomcat 8.2.0.23 jdk1.8.0_11

I get a different error (500 internal server error) trying to resolve the tiles view:

javax.servlet.ServletException: Could not resolve view with name 'base/dashboard/view' in servlet with name 'appServlet'

I am pretty stuck on this and its taken me a while to get to where I am but now I seem to have completely hit a brick wall, I just dont understand how the app can work in tomcat when deployed through STS but then not work when deployed manually to tomcat webapps.

Can anyone help shed some light on whats going on here?

Thanks

berimbolo
  • 3,319
  • 8
  • 43
  • 78

2 Answers2

1

Clearly, the answer is "yes there is", but this is not helpful.

Looking at the error message, the evidence is that:

  • the problem is happening when Tomcat is compiling a JSP, and

  • the problem is a classpath issue of some kind.

Now the weird thing is that the name of the supposedly missing class is java.util.Map$Entry; i.e. the standard Map.Entry interface. That class is in the standard Java library, and hence should be on the classpath for the JSP compiler.

Speculation: the difference between STS deployment and manual deployment could be a couple of things:

  • It could be that STS is precompiling the JSPs.
  • It could be that STS is configuring Tomcat differently; e.g. tweaking Tomcat configs in a way that affects Jasper.

After a bit of research (google), I suspect that root cause of the initial problems using versions of Tomcat 7. is that you trying to run code that has been compiled for / with a Java 8 compiler on Tomcat 7.

The TL;DR is that Tomcat 7 and Java 8 do not work together very well.

Reference:

The final problem ("Could not resolve view ...") looks unrelated, and could be a Tomcat 7 -> Tomcat 8 porting issue.

Community
  • 1
  • 1
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • Hi thanks, I had pretty much come to the same conclusions and had also read the post but you did give me an idea which I tried out just now. I cleaned up the tomcat webapps, started it up in STS which worked, and then I took the folder from wtpwebapps, deployed it tomcat webapps standalone and then restarted tomcat and it works... I am not exactly sure what this means right now... having only had 4 hours sleep but it certainly means there is a big difference between what maven is building and what STS is building. Ill need to think about it. Any ideas where to go from here? – berimbolo Jul 04 '15 at 06:58
  • Thanks for the reply, it didnt actually answer my query but tbh if you had been able to you would have to be psychic, but you did prompt me to take what was in wtp web apps and try and deploy it. i have finally gotten to the bottom of it, and its a misleading error to say the least... the cause is the same regardless off whether it be tc7 or tc8, its just the error which is different. The only diff I could see between wtpwebapp deploy and mine was that when built with maven – berimbolo Jul 04 '15 at 08:06
  • One idea would be to snapshot the two installation directory trees and compare them using "diff -r" – Stephen C Jul 04 '15 at 08:06
  • my pom declares this in the build section ${finalName}##${project.version} which in the past I have used with no ill effects and tomcat deploys and strips the version off so the context is just the web app name, STS didnt deploy any folders with ## in the name in tomcat/webapps or catalina/work but deploying the war from maven it did, so I renamed the war from mywebapp##0.6.2.war (illustrative) to mywebapp.war and then deployed the war and it worked.... So I still dont know why but I will nw email the tomcat users group looking for an answer. Thanks. – berimbolo Jul 04 '15 at 08:08
0

Just in case this is useful for anyone I fixed this quite simply by upgrading the version of tiles from 3.0.3 to 3.0.5.

berimbolo
  • 3,319
  • 8
  • 43
  • 78