- This topic has 9 replies, 2 voices, and was last updated 19 years, 10 months ago by Knut Erik Ballestad.
-
AuthorPosts
-
Knut Erik BallestadMemberHi.
I have a project that I package using an ant script to contain these parts:
– A web application, using Struts + taglibs
– A library of common code
– A Hibernate mapping configuration packaged as a JBoss .sar moduleThe main motivation for packaging this way is that I can then easily deploy different versions of the same web application.
(and include a corresponding version of the application’s hibernate module and the jars that the application depend on).So far so good.
When I want to use ME to deploy this application structure (to enable debugging with hot-swap code replace etc) the problems start.
1. How can I get ME to recognise the hibernate .sar, and deploy it as a part of the application – like I do ‘manually’ from my Ant script?
2. Are there other ME-compatible ways of packaging my .EAR application that achieves my goal of having concurrent versions of the same application deploed.
Riyad KallaMember1) Create a new Java Project names “<Somename>.sar”, where <Somename> should get replaced with the name you want the SAR to have.. like “Persistence.sar” or something.
Also make your Common Code a Java project as well.
Now make your web application a Web Project, and make it have dependencies on the Hibernate project and Common Code project, and setup the deployment tool ruels for packaging dependent projects.
2) NOW since you are not dealing with any EJBs, you can stop there and just deploy the Web Project, but you could also create a parent Enterprise Project that makes the Web Project one of it’s modules and then deploy that if you want EAR files.
MyEclipse does not support multiple deployments for the same project to the same or different app servers right now. This will be remedied later in the year with our 5.0 release (planned).
Knut Erik BallestadMember@support-rkalla wrote:
1) Create a new Java Project names “<Somename>.sar”, where <Somename> should get replaced with the name you want the SAR to have.. like “Persistence.sar” or something.
Also make your Common Code a Java project as well.
Now make your web application a Web Project, and make it have dependencies on the Hibernate project and Common Code project, and setup the deployment tool ruels for packaging dependent projects.
Should I create my ormapping.sar project as a Java project even though it contains absolutely no Java code?
(I already have ormappingclasses.jar as a separate file).– I have a common.jar project
– I have a ormappingclasses.jar that contains the hibernate classes.
– ormappingclasses.jar depends on common.jar (uses some interfaces)
– Both the ormapping.sar file and the web application depends on ormappingclasses.jar.
– The web application also depends on common.jarAll this is packaged inside of an MyApplication_v1.x.x.ear, so that I can deploy different versions of the application similtaneously. All I needs to change between deployments is the context path in my application.xml to refer to ‘myapp_v1.x.x’.
Riyad KallaMemberShould I create my ormapping.sar project as a Java project even though it contains absolutely no Java code?
If you want the deployer tool to handle all project deployments for you, then yes. It will handle packaging it and everything. If you do the deployment yourself, then no, there is no point.
I have a common.jar project
Ok, just to clarify, don’t name the project with a .jar ending, the deployment tool will atuomatically do that for you.
– I have a common.jar project
– I have a ormappingclasses.jar that contains the hibernate classes.
– ormappingclasses.jar depends on common.jar (uses some interfaces)
– Both the ormapping.sar file and the web application depends on ormappingclasses.jar.
– The web application also depends on common.jarI need to clarify some things:
1) Do your ormappings.sar, ormappings.jar OR common.jar CONTENTS every change?
Knut Erik BallestadMember@support-rkalla wrote:
– I have a common.jar project
– I have a ormappingclasses.jar that contains the hibernate classes.
– ormappingclasses.jar depends on common.jar (uses some interfaces)
– Both the ormapping.sar file and the web application depends on ormappingclasses.jar.
– The web application also depends on common.jarI need to clarify some things:
1) Do your ormappings.sar, ormappings.jar OR common.jar CONTENTS every change?ormappings.jar and ormappings.sar change syncronously with my database changes. This could be 100+ times during a project development.
common.jar changes every time I add or change functionality that is common for several projects. This now typically changes <10 times during a project.
Knut Erik BallestadMember@support-rkalla wrote:
1) Create a new Java Project names “<Somename>.sar”, where <Somename> should get replaced with the name you want the SAR to have.. like “Persistence.sar” or something.
Also make your Common Code a Java project as well.
Now make your web application a Web Project, and make it have dependencies on the Hibernate project and Common Code project, and setup the deployment tool ruels for packaging dependent projects.
2) NOW since you are not dealing with any EJBs, you can stop there and just deploy the Web Project, but you could also create a parent Enterprise Project that makes the Web Project one of it’s modules and then deploy that if you want EAR files.
MyEclipse does not support multiple deployments for the same project to the same or different app servers right now. This will be remedied later in the year with our 5.0 release (planned).
1.) I am not able to get ME to generate a .sar file at all, nor to include the correct .sar file created by my ant scripts this way. My common.jar file is being jar’ed up correctly by ME, and included on the root of the .ear file (as expected)
My .sar file needs to include 2 things:
– All my hibernate *.hbm.xml files (generated by middlegen from the current database structure)
– In the .sar META-INF folder, a jboss-service.xml like this example:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE server> <server> <mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=Hibernate"> <depends>jboss.jca:service=RARDeployer</depends> <depends>jboss.jca:service=LocalTxCM,name=MY_DS</depends> <attribute name="MapResources">1.hbm.xml,2.hbm.xml,.....,129.hbm.xml</attribute> <attribute name="JndiName">HibernateFactory</attribute> <attribute name="Datasource">java:/MY_DS</attribute> <attribute name="Dialect">net.sf.hibernate.dialect.SQLServerDialect</attribute> <attribute name="UseOuterJoin">false</attribute> <attribute name="ShowSql">false</attribute> <attribute name="UserTransactionName">UserTransaction</attribute> <attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute> <attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute> </mbean> </server>
(generated by my ant script, so that all tables are included on the MapResources line).
For the hibernate mapping to be correctly deployed, I need to deploy both ormappingclasses.jar and ormapping.sar into the .ear file, as well as include a file called jboss-app.xml into the .ear META-INF folder with this content:
<jboss-app> <module> <service>ormapping.sar</service> </module> </jboss-app>
I also have to add a MANIFEST.MF file into the .ear META-INF folder:
Manifest-Version: 1.0 Ant-Version: Apache Ant 1.6.2 Created-By: 1.5.0-b64 (Sun Microsystems Inc.) Bundle-SymbolicName: My Application Bundle-Version: 1.0 Bundle-Name: My application Bundle-Vendor: My Company Bundle-ClassPath: common.jar,ormappingclasses.jar,ormapping.sar
My .sar file references ormappingclasses.jar, which references common.jar.
My web application references ormappingclasses.jar, which references common.jar. In addition my web application references common.jar directly.
My first showstopper problem is that I am not able to get ME to create a .sar file, then I need ME to deploy according to my classpath/reference needs.
Riyad KallaMemberTell me how you have created the .sar project, what it’s name it, what kind of project it is, HOW it is related to the other projects and WHAT your deployment settings are (either globally or per-project and each project’s settings).
This is all an issue of packaging, albiet it may be confusing now because you are comming to ME right away with a complex project setup, as opposed to a simple web app that you slowly addded dependencies to.
Knut Erik BallestadMember@support-rkalla wrote:
Tell me how you have created the .sar project, what it’s name it, what kind of project it is, HOW it is related to the other projects and WHAT your deployment settings are (either globally or per-project and each project’s settings).
I created it as a Java project, like you told me to earlier in this thread.
The project is named ‘ormapping.sar’, which is what is shown in e.g. the package explorer.
The project has a java source path that refers to the target path of my generated hibernate mapping.
The ormapping.sar project depends on another project called ‘Common’@support-rkalla wrote:
This is all an issue of packaging, albiet it may be confusing now because you are comming to ME right away with a complex project setup, as opposed to a simple web app that you slowly addded dependencies to.
I have the .ear project up and running, but it is still not configured correctly to use ME’s hot swap feature for all parts:
I have an .ear project with this structure:
|
– webapp (referenced via ME, hot-swap works fine)
– ormappings.sar file (no hot-swap)
– unjar’ed common.jar (no hot-swap)
– unjar’ed ormappingclasses.jar (no hot-swap)From my point of view I have 2 problems:
1. I am not able to reference to ormappingclasses.jar and common.jar in mye .ear project, so I have to unpack them manually at .ear root to make them visible to my .sar mapping and my webapp. It might not be a problem to include these referenced resources unjar’ed, but anyway I am not able to make ME include these resources into the .ear project in ANY form.I do not get hot-swap support on these two critical resources since I have placed/copied these two resources in my .ear project manually.2. I am not able to configure ME to include my .sar file automatically. This is much less critical than to obtain hot-swap support for the contents of the two jar’s, since this mapping changes much less frequently, and I might accept living with manually updating and redeploying the .sar file.
Is it possible to make ME include resources unjar’ed at .ear root?
Is there another way of placing these two resources in the classpath of both the .sar file, and the webapp?
Riyad KallaMemberkeb,
I am sufficiently stumped by your project setup without having it sitting infront of me to work with, so I asked another developer about it and he had this to say:You know, for guys that already have the insanely complex project
dependencies that are application-server dependent extensions, and they
already have ant scripts to do all the work, how about pointing them to
Remote Debugging and just encouraging them to do what they already do? It
will allow them to get the debugging they want and they already have
deployment solved. 🙂 In fact, they don’t have to use remote debugging at
all. They can still start the server using our connectors, but just use
their own deployment script. That will work fine too.Which, IMO, is a very good suggestion. Does this fit the bill for you?
Knut Erik BallestadMember@support-rkalla wrote:
You know, for guys that already have the insanely complex project
dependencies that are application-server dependent extensions, and they
already have ant scripts to do all the work, how about pointing them to
Remote Debugging and just encouraging them to do what they already do? It will allow them to get the debugging they want and they already have deployment solved. 🙂 In fact, they don’t have to use remote debugging at all. They can still start the server using our connectors, but just use their own deployment script. That will work fine too.Which, IMO, is a very good suggestion. Does this fit the bill for you?
I did come to almost the same conclusion after my last posting:)
If I set up my .ear project to depend on my ‘common.jar’ project in ME, debugging with hot-swap actually works great – even without ME performing deployment. I have not gotten this to work on my .sar file yet, but this typically changes once a day, so I can easily live with not having hot-swap support on the .sar hibernate mapping.Hmmm, maybe if I set my build scripts to copy the code into a source folder of one of my dependent projects……. ❓
Anyway, thanx a lot for giving good support, even though I ask questions that may be a bit outside of ME support scope.
-
AuthorPosts