I built my netbeans project and it created a .war
file including all the .jar
libraries. I need to remove my all libraries from .war
file. I tried to untick them from library folder but then the project does not deployed. How can I remove my libraries from the .war
file and if I remove them where should I put them correctly. In jboss also there is a folder called lib in standalone folder.Should I put them there? If so how to do it. I am not using maven.

- 87
- 2
- 11
-
Is there any specific reason for this? I guess you can include your jar file in classpath of the server where your war file is deployed(But it will require admin access of that server). Which server you are using? – Suyash Mar 16 '16 at 06:52
-
yes it is necessary to do this.I want to reduce the size of war file.Now it is like 65mb with all jars.I need to remove them from war file.I am using jboss as the server.can you tell me how to do this? – chinthi Mar 16 '16 at 07:09
2 Answers
If you are using Maven set the dependency scope to the libraries you would like omitted to have scope provided. You can add the dependencies of your WAR to the MANIFEST.MF file or the jboss-deployment-structure.xml file using Maven. If the lirbaries are not JBoss modules by default, eg Orcale JDBC driver, then you will need to create these modules yourself. See the JBoss AS 7 documentation on how to do this.

- 1,414
- 1
- 18
- 26
-
Thanks.But I do not use maven.I created the project with netbeans.How to add libraries to jboss as 7 and hoe to remove them from .war file.Can you show me.I tried many ways to ad it as a module.No luck yet – chinthi Mar 18 '16 at 10:55
-
hi please search the JBoss documentation on how to create a moudle. how do configure NetBeans to build the Java source code? – ozOli Mar 21 '16 at 11:37
You can try following approach. I haven't worked on Jboss so don't have detail idea about it.
Deploy each logical library (like "OpenJPA" or "Log4J") as a module, including its api and impl jars and any dependency JARs that aren't already provided by other AS7 modules. If there's already a module add a dependency on it rather than adding a JAR to your module. If several different libraries share some common dependencies, split them out into modules and add them as module dependencies in module.xml.
Use jboss-deployment-structure.xml to have your deployment .war / .ear / whatever declare a dependency on the module if it isn't autodetected and autoloaded.
Courtesy @Craig Ringer.
For complete thread go here
-
Thanks but I want to know how to do this.I have tried so many ways such as adding some modules. – chinthi Mar 24 '16 at 08:46