aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes ClassNotFoundException while using yguard Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply locked New topic
Author

ClassNotFoundException while using yguard

Deepak Jha
Greenhorn

Joined: Jul 07, 2008
Posts: 2
I have a Strange Isuue while using yguard obfuscator...
I have some Jsp Files and some Normal Class Files in my code. I want to obfuscate the class files but because of a lot of these classes are imported and used in My jsp I had to precompile teh Jsps.

After Precompilation i tried to obfuscate the class files using the following kind of statement my ant file :-

<target depends="jar" name="yguard">
<taskdef name="yguard" classname="com.yworks.yguard.YGuardTask"
classpath="yguard.jar"/>
<!-- the following can be adjusted to your needs -->
<yguard>

<inoutpair in="${jar}" out="${obfjar}"/>

<externalclasses>
<pathelement location="classpath.jar"/>
<pathelement location=".\lib\activation.jar"/>
</externalclasses>
<rename logfile="${renamelog}">
<property name="error-checking" value="pedantic"/>

<keep>
<class>
<patternset>
<include name="com.pramati.jsp.generated.**.*jsp"/>
<include name="com.pramati.jsp.generated.tags.**.*tag"/>
</patternset>
</class>

</keep>
</rename>
</yguard>
</target>


Assume that these paths are correct. When I try to run the above target i get teh following Stack Trace:-

Caused by: java.lang.ClassNotFoundException: com.wm.net.URLStreamHandlerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:580)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at com.yworks.yguard.ObfuscatorTask$_g.resolve(Unknown Source)
at com.yworks.yguard.obf.Cl.scanExtSupers(Unknown Source)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Unknown Source)
at com.yworks.yguard.obf.Cl.resolveOptimally(Unknown Source)
at com.yworks.yguard.obf.ClassTree$4.classAction(Unknown Source)
at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
at com.yworks.yguard.obf.ClassTree.resolveClasses(Unknown Source)
at com.yworks.yguard.obf.GuardDB.createMap(Unknown Source)
at com.yworks.yguard.obf.GuardDB.remapTo(Unknown Source)

Please help me regarding the above.. As i tried finding the above class all over the places in google but was unable to do it.

Thanks In Advance
Deepak
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5843
    
    7

Which JAR contains the missing class (com.wm.net.URLStreamHandlerFactory)? This is a complete guess because I have never used yguard, but I think you will have to add that JAR to the list of JARS in the <externalclasses> entry for the <yguard> task.
[ July 07, 2008: Message edited by: Peter Johnson ]

JBoss In Action
Deepak Jha
Greenhorn

Joined: Jul 07, 2008
Posts: 2
Hi Peter,

The problem is fixed now as i found the jar in one of the wm projects inside wmsutdown.zip. The jar which has this class file is wmprobe.jar.

http://www.wmusers.com/software/browse.shtml?keys=wmshutdown&SUBMIT.x=0&SUBMIT.y=0

Anyways, Thanks for replying
John McGrey
Greenhorn

Joined: Jan 18, 2012
Posts: 3
Hello,

So, the jsps were obfuscated as well and the war file worked?
Because I am using yGuard as well and I have major problems using it. I mean all the obfuscation of the class, configuration, and jsp files were good ,but when deploying on tomcat it shows: HTTP Status 404 : The requested resource (/myProject/login) is not available.
which means there is a big trouble, where the original war file without yguard thing works great in tomcat.
CAN YOU PLEASE ADVISE?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5843
    
    7

John, please to not ask the same question in multiple posts.
http://www.coderanch.com/t/564901/tools/yGuard-has-trouble-dealing-configuration
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassNotFoundException while using yguard