I’m attempting to migrate some existing projects, and champion that all new development be performed on GlassFish v3 along with a migration from Hibernate to JPA. In addition, we will be exposing Web Services for our other application to consume. So far so good. No real issues. However, we are currently using Maven for our build process and this is where things seems to become difficult.
First off, development is currently done with Eclipse. It seems to me that NetBeans has better Maven integration that Eclipse, but changing IDE’s would be difficult. That being said, the build process must use Maven. The one thing I like about this is the GlassFish-embedded server and the ability to test the code write from within the Maven build process. So I guess this is where things start getting complicated.
As an example, I have a small project that consists of my JPA entities. Because the engineers are familiar with a Dao pattern, I have chosen to employ Spring’s JpaTemplate to take advantage of the Exception handling within it. So now I’ve got my Dao’s wired into Spring, and I’ll set aside my difficulties with locating the EntityManager in the Embedded GlasssFish container until later.
Seeing as this project is being built as a simple jar file, is it possible to run my tests within the embedded GlassFish server? If so, can you please detail this for me so I can stop banging my head against the wall? J
Next, is more of a question pertaining to the best way to deploy an application that exposes Web Services: ejb or war? (Keeping in mind that I need to access my Dao’s that are defined within Spring. I’ve seen some documentation pertaining to simply defining your project as a web project, deploying it as a war file onto the server. However, I also see within the documentation that there are a few limitations by doing this that you would not have when deploying your application as an EJB project contained within an EAR project. I know that if I were to deploy my application as an EJB project, contained within an EAR, my EJB’s could acquire the Dao’s utilizing Spring’s @Autowired feature by simply using the following annotation:
@Interceptors(SpringBeanAutowiringInterceptor.class)
This works very well and is easy to use. However, I was unable to get this to work if I defined my EJB’s in a WebProject. (Is this another limitation or just my configuration).
Of course building the project based upon ejb or war, also defines the complexity of the pom.xml file. It’s certainly easier to build the war project with maven but it seems to me that it would be much cleaner to deploy the application as an ejb/ear project rather than a headless web application. The other behavior I noticed with deploying as a web application is that GlassFish does not seem to honor the name portion of the @WebService annotation. I have the following defined on my web service:
@WebService(serviceName=”AddressService”, name=”AddressService-v1”, portName=”AddressServicePort”, targetNamespace = “
http://www.mycompany.com/ws/address/v1 )
When deployed as an ejb/ear project, my web service was exposed as
http://localhost:8080/AddressService/AddressService-v1?wsdl
But when I deploy my project as a web application the service was exposed as
http://localhost:8080/applicationName/AddressService?wsdl
Any help and guidance here is greatly appreciated.
Thanks in advance.
[Message sent by forum member 'cmathrusse']
http://forums.java.net/jive/thread.jspa?messageID=470601