java,tomcat,java-8,tomcat8,embedded-tomcat-8
I was able to fix this issue using disabling the default TomcatURLStreamHandlerFactory before starting the sever instance TomcatURLStreamHandlerFactory.disable(); ...
jsp,spring-boot,embedded-tomcat-8
You can use an EmbeddedServletContainerCustomizer @Bean to look up the JSP servlet and configure its init parameters. For example, in your main @Configuration class: @Bean public EmbeddedServletContainerCustomizer customizer() { return new EmbeddedServletContainerCustomizer() { @Override public void customize(ConfigurableEmbeddedServletContainer container) { if (container instanceof TomcatEmbeddedServletContainerFactory) { customizeTomcat((TomcatEmbeddedServletContainerFactory) container); } } private void...
jsf,annotations,jsf-2.2,custom-component,embedded-tomcat-8
Alright, I figured out what was causing the issue. This morning I sat down to think about the differences between my working Servlet 3.1 version of the code, and the broken Spring Boot version. The main difference was how the code was being run. Embedded server vs. Standalone. Spring Boot's...
Tomcat uses the thread's context class loader to determine the JNDI context to perform the lookup against. If the thread context class loader isn't the web app classloader then the JNDI context is empty, hence the lookup failure. The problem is that the JNDI lookup of the DataSource that's performed...
java,jsp,tomcat,servlets,embedded-tomcat-8
On the JSP side, you don't need to say request.getSession(), just session.getAttribute();And you had a problem in your Main.java when creating the servlet context (a trick of using embedded Tomcat); you were not getting the context created by adding the webapp to tomcat, you had some other context. // File...
java,maven,tomcat,embedded-tomcat-8
Thank for M. Deinum for the link. I found answers on all my questions!
java,tomcat,websocket,tomcat8,embedded-tomcat-8
This was totally a mistake. In the tomcat example all the URLS are hard coded with examples but my context is example(without s). That was a mistake.
file-upload,spring-boot,embedded-tomcat-8
You register the DispatcherServlet yourself (instead of letting Spring Boot do it) so you have to take care to add the multipart configuration for it. Spring Boot only adds multipart configuration to the ServletRegistrationBeans that it creates itself (see here) so if you create your own you have to take...
port,spring-boot,embedded-tomcat-8
Reading between the lines you are trying to expose your Spring Boot application on port 80/443, but you don't really need to have it listening on one of those ports itself. Instead, you should use a reverse proxy such as HAProxy, which will start up as root, but then jails...
java,tomcat,websocket,embedded-tomcat-7,embedded-tomcat-8
One alternative is to extend javax.websocket.Endpoint: https://blogs.oracle.com/arungupta/entry/websocket_client_and_server_endpoint public class MyEndpoint extends Endpoint { @Override public void onOpen(final Session session, EndpointConfig ec) { session.addMessageHandler(new MessageHandler.Whole<String>() { @Override public void onMessage(String text) { try { session.getBasicRemote().sendText(text); } catch (IOException ex) { Logger.getLogger(MyEndpoint.class.getName()).log(Level.SEVERE, null, ex); } } }); } ...
spring-mvc,mime-types,spring-boot,embedded-tomcat-8
OK, found it myself :-) In Spring boot you can customize the servlet container with this customizer and add new mimetypes there. @Component public class ServletCustomizer implements EmbeddedServletContainerCustomizer { @Override public void customize(ConfigurableEmbeddedServletContainer container) { MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); mappings.add("woff","application/x-font-woff"); container.setMimeMappings(mappings); } } ...
spring-boot,hazelcast,embedded-tomcat-8,spring-session
As described in Hazelcast's documentation, you need to configure Hazelcast's SpringAwareWebFilter and SessionListener. You can do so in Spring Boot by declaring a FilterRegistrationBean and a ServletListenerRegistrationBean respectively: @Bean public FilterRegistrationBean hazelcastFilter() { FilterRegistrationBean registration = new FilterRegistrationBean(new SpringAwareWebFilter()); registration.addUrlPatterns("/*"); registration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE); // Configure init...
java,tomcat,spring-boot,tomcat8,embedded-tomcat-8
Create you own Filter. This Filter should: check if you have to rewrite your request If yes, rewrite URL and URI forward request it comes again through same filter, but first check will deliver false don't forget and be carefull to call chain.doFilter Forwarding will not change any URLs in...