Unzipped JAR in WAR classes folder not working?

SOLVED!

ok, so i have a web application which is working with the JAR files in the lib folder. I've been trying to unzip one of the JARs in my WEB folder's classes. So that the 2 projects merge in 1 project on build. I got the jar unzipped in the correct location using:

Building a WAR project with unzipped JAR dependency?

Now you may be asking yourself why i would want to do this. Since it's to hard to explain lets just go with: It's what I want to do.

Just to be clear: I dont want lectures telling me "it's wrong" and "you can't do that, it has to be this way". I know what i'm asking and i know you normally woulden't do this.

So lets give it a try:

I've set it to unzip in my classes folder. All files go in WEB-INF\classes.

However it doesn't load my beans anymore (those from the JAR). I scan both packages with the component scanner like when i was using the packaged JAR (which worked).

There is a difference though between the WAR and JAR. My JAR has different package names, like:

WAR: com.test JAR: com.root.test

Could it be that this is the problem? Different Package names?

If not what am i missing here?

If you need to see some code just ask as i'm unsure what it is you need to see.

Thanks in advance!

EDIT:

My currect folder structure inside the WAR's WEB-INF folder is as follows:

classes  
+- com  
+- +- root  
+- +- +- test  
+- +- +- +- processer  
+- +- +- +- splitter  
+- +- +- +- validators  
+- +- test  
+- +- +- beans  
+- +- +- services  
+- +- +- validators  

I scan it using:

<context:component-scan base-package="com.test,com.root.test"/>

UPDATE:

Ok i've found the problem. The code was all fine. It was a problem with Eclipse. Eclipse was cleaning the builder folder and not filling it up properly. I've removed eclipse out of the equation and it works fine.

Thanks for all the help guys, i realy appreciate it!

Answers


If the following is your situation:

  • JAR File classes: com.blammy.schmoores
  • WAR file classes: com.apple

Then this should be the contents (exploded) of your WEB-INF/classes directory:

  • com
    • blammy
      • schmoores
        • class files
    • apple
      • class files

The source of the class files is of no value; only the directory structure matters.

Also, the directory structure of the classes must match the package name of the class. For example, if your JAR file contains one class (kapow.class) and the package of this class is com.blammy.schmoores, then the directory structure of your classes direcirectory should be as I've noted above. The path to the kapow.class file should be .../WEB-INF/classes/com/blammy/schmoores/kapow.class


Need Your Help

How to handle null values while parsing XML in C# .Net?

c# .net xml linq xml-parsing

I'm trying to parse an XML into my domain model. Below is the code part

Get Max Value in a var formatted as JSON

javascript json max

I'm using Highcharts to render some charts in a Custom Web Publishing solution using a Filemaker backend. In the process of just trying to draw out the charts I want, I'm creating a JSONish object by