Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

I get an error while obfuscate the war file.

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I'm a junior developer, I'm new to Proguard. I am trying to obfuscate since I will use my war file in my standalone web project. I am obfuscate with the proguard task I added the war file to in build.xml. however, the project is receiving an error. these are my interface and database classes and model classes. war file can be obfuscate written. But there are a lot of sources that can not be written.
While looking for the error I received, it redirects to the proguard site and I don't understand the article there. Please guide me.


[proguard] Warning: class [WEB-INF/classes/com/mycompany/wab/db/MyList.class] unexpectedly contains class [com.mycompany.wab.db.MyList]
[proguard] Warning: class [WEB-INF/classes/com/mycompany/wab/db/impl/Derby.class] unexpectedly contains class [com.mycompany.wab.db.impl.Derby]
[proguard] Warning: class [WEB-INF/classes/com/mycompany/wab/db/impl/Oracle.class] unexpectedly contains class [com.mycompany.wab.db.impl.Oracle]
[proguard] Warning: class [WEB-INF/classes/com/mycompany/wab/db/impl/SqlFactory.class] unexpectedly contains class [com.mycompany.wab.db.impl.SqlFactory]
[proguard] Warning: class [WEB-INF/classes/com/mycompany/wab/db/interfaces/IDerby.class] unexpectedly contains class [com.mycompany.wab.db.interfaces.IDerby]
[proguard] Warning: class [WEB-INF/classes/com/mycompany/wab/db/interfaces/IOracle.class] unexpectedly contains class [com.mycompany.wab.db.interfaces.IOracle]
[proguard] Warning: class [WEB-INF/classes/com/mycompany/wab/data/CodeTemplate.class] unexpectedly contains class [com.mycompany.wab.data.CodeTemplate]

[proguard] Warning: there were 895 classes in incorrectly named files.
[proguard]          You should make sure all file names correspond to their class names.
[proguard]          The directory hierarchies must correspond to the package hierarchies.
[proguard]          (http://proguard.sourceforge.net/manual/troubleshooting.html#unexpectedclass)
[proguard]          If you don't mind the mentioned classes not being written out,
[proguard]          you could try your luck using the '-ignorewarnings' option.
 
Saloon Keeper
Posts: 6380
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post the ProGuard configuration. It seems that it considers "WEB-INF/classes/com/mycompany/wab/db/MyList" to be the class name rather than "com/mycompany/wab/db/MyList", so one of the settings (most likely a classpath) seems incorrect.
 
kübra utman
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:Post the ProGuard configuration. It seems that it considers "WEB-INF/classes/com/mycompany/wab/db/MyList" to be the class name rather than "com/mycompany/wab/db/MyList", so one of the settings (most likely a classpath) seems incorrect.



I'm new to programming, I don't understand how to do this. When I open the war file with winrar, I can only see my classes file. I don't have a classes folder under web-inf in the project.
 
kübra utman
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My config.pro file
-injars  C:/Users/utman/Desktop/givenForWar/WB.war
-outjars C:/Users/utman/Desktop/givenForWar/ObWB.war
-libraryjars C:/Program Files/Java/jdk1.8.0_221/jre/lib/rt.jar
-libraryjars C:/Users/utman/workspaceProje/devObfuscated/WebContent/WEB-INF/lib/log4j-1.2.13.jar
-ignorewarnings
-dontoptimize
-dontshrink
-keep class * implements java.sql.Driver
 
Tim Moores
Saloon Keeper
Posts: 6380
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


-injars  C:/Users/utman/Desktop/givenForWar/WB.war
-outjars C:/Users/utman/Desktop/givenForWar/ObWB.war


There's the problem right there. As the parameter names imply, ProGuard works with jar files, not war files. It should only be used with the jar file that contains your code, and not touch anything else.
 
kübra utman
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:


-injars  C:/Users/utman/Desktop/givenForWar/WB.war
-outjars C:/Users/utman/Desktop/givenForWar/ObWB.war


There's the problem right there. As the parameter names imply, ProGuard works with jar files, not war files. It should only be used with the jar file that contains your code, and not touch anything else.


How will the classes in the project be obfuscate? Project web project but I have to obfuscate the war file
 
Tim Moores
Saloon Keeper
Posts: 6380
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Obfuscation only applies to class files, so there's no concept of "obfuscating the war file". You'd obfuscate your jar file(s), and then use those when creating the war file. If someone told you to "obfuscate the war file", that's what they meant.

If you set this task for yourself, and for some reason think that something else needs to be done, please elaborate.
 
kübra utman
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what to do about it. I try to do what I am told, but there is not much information. My addiction jar files used in my project are in the web-inf lib folder. What should I give as input to proguard?
 
Rancher
Posts: 4548
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly as Tim said, you obfuscate the jar files.
Then create the war file.
 
kübra utman
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dave Tolls wrote:Exactly as Tim said, you obfuscate the jar files.
Then create the war file.


Should I take my web project as a jar and obfuscate?
 
Tim Moores
Saloon Keeper
Posts: 6380
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, obfuscate just the jar file. You mentioned "addiction jar files" - if that is the jar file that contains all your classes, that's the one to obfuscate. You just need to change the "injars" and "outjars" parameters accordingly.
 
kübra utman
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:No, obfuscate just the jar file. You mentioned "addiction jar files" - if that is the jar file that contains all your classes, that's the one to obfuscate. You just need to change the "injars" and "outjars" parameters accordingly.


I have only java libraries in my WEB-INF lib file, I don't have source code. it contains dependencies. For example guava.jar or httpclient-4.5.8.jar. How to prepare the jar file I will give as input
 
Tim Moores
Saloon Keeper
Posts: 6380
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's nothing to prepare. You already have your classes in a jar file, and a ProGuard cnfig file to obfuscate it. What stops you from just doing it?
 
kübra utman
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:There's nothing to prepare. You already have your classes in a jar file, and a ProGuard cnfig file to obfuscate it. What stops you from just doing it?


The project fails when I include the beans in the jar.
 
Tim Moores
Saloon Keeper
Posts: 6380
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "it fails" mean? What, exactly, are you trying to do, what, exactly, is the result, and what, if any, error messages are being shown? TellTheDetails
 
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic