• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to create War using Ant

 
Mark Kafe
Ranch Hand
Posts: 60
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i m new to ant, i create build file for creating war file but i have not make it proper.


please any body can give me sample build.xml file for war files
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are not a code mill. Please post your build.xml and we will help you fix it. Make sure you embed the build.xml within 'code' tags (select the text and click the Code button above the editor window,)
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34860
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also please share the error message you got when running it.
 
Mark Kafe
Ranch Hand
Posts: 60
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply

I do it....................

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do it....................


Do what? Post the information we asked for? Fix the problem? If you fixed the problem, it would be nice if you posted the solution so that when other ranchers come across your post they can also see the solution.
 
Mark Kafe
Ranch Hand
Posts: 60
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter Johnson,
i fix the problem, first time i make ant file.

here the Build.xml file


 
Mark Kafe
Ranch Hand
Posts: 60
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But know i have three projects i want to compile all projects in one Build.xml
file throguh Ant if any one have any idea about this please tell me...............
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One possibility: add a target that does an antcall for each project. Something like this:



A few caveats:
I haven't run the above code, it could have syntax errors.
You have to supply the app name and base directories.
You might have to set inheritaAll to false (see the Ant docs for the antcall task).

The general idea here is that your build.xml file should be written so that is is generic and can build an web app (in this case) with the only thing you need to supply if the location of the files and name for the WAR.
 
Mark Kafe
Ranch Hand
Posts: 60
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey i want to create Jar file from a Data services Projects.i means hibernate project that have HBM.XML files but i have no idea how i add hbm.xml files in jar file..........please any body help me

i try this way



but its not working..........
because i have hbml.xml files in src folder but how it adds in jar file i have no idea.........................
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you posted is the javac which is used to compile java source files - it doesn't do anything with hbm files. Since you are gathering all of the JAR file contents into a jar directory, I suggest copying the hmb file there before the jar task (on line 41 of the build.xml you posted). Something like this:


Also, you should change the destdir for the javac task to be "${basedir}/jar/" otherwise your classes will be in the wrong location in the JAR file.
 
Mark Kafe
Ranch Hand
Posts: 60
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thnx Peter Johnson now its working fine........all hbm file add in packages.........

i also make war files frm ant build but some jar missing errors when i deploy it on tomcat..........please can you check it, where mistake in code...............

 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not using the war task here? And what is the error ?
 
Mark Kafe
Ranch Hand
Posts: 60
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thnx all for yours reply.............

this error when i deploy war file in tomcat........

SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature
at com.sun.faces.config.ConfigureListener.registerELResolverAndListenerWithJsp(ConfigureListener.java:1628)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:453)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:850)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:724)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:493)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Jul 27, 2009 1:43:25 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you might be deploying with a conflicting library to that on Tomcat, what Jars are bundled up in your WAR?
 
Mark Kafe
Ranch Hand
Posts: 60
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yaa its jar problems i add el-api.jar files when i create WAR file and this jar file also in tomcat lib folder............now i remove it from war files and now its working fine...............
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great to hear!
 
Mark Kafe
Ranch Hand
Posts: 60
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i make jar file wirh ANT Build..........here the code that i use for this build





but i want to debug classes that have in jar files...........Now its only .classes files ............
can any way that i also add . java files also and when i want to debug class its working fine???
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your debugger should be able o step through .class files. What debugger are you using?
 
Mark Kafe
Ranch Hand
Posts: 60
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i use MyEclipse 7.1 IDE and also use MyEclipse debugger.......................
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case you should be able to attach the debugger to the debug potr of your server/application and debug normally. You just need to make sure that in Eclipse you have the source code for the 3rd party lib referenced in your libraries section (in short, check the libs you have in the classpath of your project in eclipse, for each lib you can right click and attach the source code zip - which you will have downloaded)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic