I have read many tutorials including the official Spring documentation but unable to create a project which works with the following requirements.
Dynamic web project with Maven (Spring MVC with Spring Security implemented)
No XMLs should be used. (Fully annotated with Spring Boot)
IDE:Eclipse and without the use of command-line.
Should be deployable to JBOSS AS.
Edit: I have configured the project and tried running it using Run->Maven clean and Run->Maven build (clean and install goals)..
I can see the thymeleaf html files in the war file but when I hit the url for the thymeleaf html files, the spring tags in the page are not resolved and displayed as such.
Static html pages are loaded fine though.
PS: There are no errors in the console.
Related
I am a beginner with struts2 and I have few struts2 projects downloaded from a website, but they all are created as simple java projects and not as web-projects, so I am unable to deploy them on my Tomcat or JBoss AS server through Eclipse.
How can simple java projects be deployed on a Java EE server?
Your best bet is download sample applications from Struts2 official sites and deploy them on any of the server of your choice.
Those sample application comes with all required dependencies as well will give you idea about structuring of S2 application as well flow and configurations
I created a structure similar to the one shown on website and manually added all the files required and it worked.
I have just switched to Intellij Idea (11) and I'm having possibly simple problem for which I cannot find a solution within Intellij IDE. I have a web application which contains some classes marked with annotations from javax.ws.rs like eg. #Path("/members") etc and my web.xml file configured for handling REST calls.
The application is build with Maven, when I package the application either from command line or through the Intellij IDE and copy the .war file into tomcat webapps directory manually, all works fine, eg. I can access GET based services from the browser.
If I deploy the application through configured tomcat in Intellij IDE the application works but without the REST portion, so I'm not able to execute any rest based calls (all end up with 404 error). I cannot see anything in logs about deploying rest service classes like I do during manual deployment:
INFO: Adding scanned resource: com.softberries.klerk.rest.MemberResourceRESTService
so its definitively an IDE configuration option I've missed which prevents tomcat from scanning classes for this annotations.
The question is how should I configure my Tomcat within the IDE to work the same as started manually.
with Intellij you need to expose the classes as web services from Tools > WebServices.
Also check that in Setting > Web Services, the prefix path for web service is correct (by default is /services).
Here you have a nice tutorial about how to create webservices in intellij.
http://www.academia.edu/4526516/Creating_Web_Services_Applications_with_IntelliJ_IDEA
By the way... when you do a deploy from intellij, the application goes to:
C:\Users\userName.IntelliJIdea10\system\tomcat\NameDeploy"
This info appears in the console as: "Using CATALINA_BASE": .../path...
Hope this helps,
Cheers
When I develop an Axis2 web service on Eclipse, I noticed that Eclipse is automatically copying the classes from the lib folder of Axis2 to the lib folder of the new project. However, not all classes from the lib folder of Axis2 are being copied. Interestingly, the web service runs without any problem when deployed to Tomcat via Eclipse even if some the jars from Axis2 were not copied. Also, when I viewed the temp file of Tomcat, Tomcat seems to generate the jars for the listed modules on modules.list of the web service.
Can someone enlighten me regarding what is happening on this? Why Eclipse doesn't copy all the jars from Axis2? Why can the web service run on Tomcat even without the other jars from Axis2? What are those temp files for? When and why is it being generated?
I tried to run the same project on WebSphere and I am encountering a ClassDefNotFound exception because of the missing jars. My problem was solved when I copied all the Axis2 jars that was not copied by Eclipse to my project. But I'm not comfortable with my solution because Tomcat can run my project even without those jars. Is my solution really the right solution? Or am I missing a configuration setting?
This is just for clarification:
My web service is already running in Axis2. My class loading policy is set to PARENT_LAST. I know that since WebSphere has its own Axis2 configuration, the class loading policy must be set to PARENT_LAST so that WebSphere will use the Axis2 from the project itself. Aside from setting the class loading policy, I did something to make my web service run on WebSphere. I describe what I did above. My question is why such method must be taken?
WebSphere has it's own axis2 configuration as part of its Java EE server spec for JAX-WS. Change your class loading policy to PARENT_LAST and check if that solves your problem.
Edit:
As the original post already states: WebSphere is a Java EE server depending on version it supports its the standard Java JAX-WS web services. Actually web services became part of the standard jdk.
If you use JAX-WS like mentioned in Introduction to JAX-WS or building web services then you don't have to add any 3rd party library for getting your web services running. As soon as you use the non JDK implementation like axis2 you have to package it with your application.
IBM didn't just pack the axis2 into their WAS/JDK, they modified it. I'm not sure what Tomcat delivers, however as long as you use JAX-WS it shouldn't matter. With JAX-WS you don't have any direct import of the org.apache.axis packages. If you use these imports you have to supply the libraries and make sure that yours are loaded.
I just started web development, here is a simple example: i write a form submit jsp file and deployment descriptor web.xml to map the logical name used for request and servlet class , and controller servlet handle the http request and use printwriter to print the information in the request.(Don't have the model in this example.)
I know the simple way is to use ant to build a war and put into the web container(Like tomcat), but do i need to do it every time to see if the project is running? Or have a quick way to debug and see the result in eclipse?
A servlet container is the runtime environment for a Java web application. There are several open-source servlet containers available. Tomcat & Jetty are two popular ones. Both have plugins available that will allow you to do all your development and deployment from within Eclipse:
Tomcat & Eclipse
Jetty & Eclipse
I have a clean GWT application which I want to secure with Spring Security. I have a standard filter configuration in web.xml and a standard form-based security configuration in my Spring context file.
When I build my application as a .war and deploy it to an app server it works as expected, however when I try to run it in the GWT Jetty server within Eclipse I get the dreaded Unable to locate Spring NamespaceHandler exception because of the security namespace.
I know that this is usually due to a missing spring-security-config library, but I am certain that all my requisite Spring Security libraries are on the classpath. Is there something I'm missing about how the GWT Eclipse plugin server handles class loading?
I have tried every combination I can think of to manually add the Spring Security .jars to my project build path, my run configuration path, etc.
It appears that the GWT Eclipse plugin server does not respect the Eclipse project classpath settings. When I manually copy the spring-security .jars into WEB-INF/lib and run a GWT Compile, everything works as expected.