SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye
Issue Details (XML | Word | Printable)

Key: CMP-869
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Shay Banon
Reporter: john
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Compass

ScannerFactory issue with Jboss AS 5.0 : Protocol [vfszip] is not supported

Created: 06/May/09 03:14 AM   Updated: 25/May/09 11:56 AM
Component/s: Compass::Core
Affects Version/s: 2.3.0 beta1
Fix Version/s: 2.3.0 beta1

File Attachments: 1. Java Source File ScannerFactoy.java (2 kB)

Environment:
JBoss AS 5.0.1 GA
Compass/JPA 2.3.0M1 (with annotations)


 Description  « Hide
The following piece of code gave me an error :

private CompassConfiguration conf;
conf.addScan("entities"); // entities is the name of my package.

org.compass.core.config.ConfigurationException: Failed to create scan factory for basePackage entities and url vfszip:/D:/DEV/jboss-5.0.1.GA/server/default/deploy/CompassHibernateEAR.ear/CompassHibernate.jar/entities/; nested exception is java.io.IOException: Protocol vfszip is not supported by scanner
at org.compass.core.config.binding.scanner.ScannerFactoy.create(ScannerFactoy.java:48)

I've tried it on an old version of JBOSS, url param of ScannerFactory is: jar:file:/D:/DEV/jboss-4.2.2.GA/server/default/tmp/deploy/tmp19840CompassHibernateEAR.ear-contents/CompassHibernate.jar!/entities and it's work fine.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Shay Banon added a comment - 07/May/09 07:58 PM
Hi mate,

I was wondering if you can maybe try and help me resolve this issue. The ScannerFactory decides which one to scanner to use (either file or jar). I believe we need to use the jar scanner in this case (I hope vfszip supports it). I think in this case we can do the same hack that the ScannerFactory does for urls that end with "!/" to vfszip. Can you give it a go?

Thanks in advance,
Shay


john added a comment - 08/May/09 05:06 PM
Hi Shay,

I've just tried a little thing :

Breakpoint in my client app code on line : conf.addScan("entities");
then stepped to : public static Scanner create(String basePackage, URL url, Filter filter) throws IOException {... method till : } else if (url.getProtocol().equals("file")) {

Eclipse debbugger says that url = vfszip:/D:/DEV/jboss-5.0.1.GA/server/default/deploy/CompassTest2EAR.ear/CompassTest2.jar/entities/ as I expected that.

I turned it in order to get url = file:/D:/DEV/jboss-5.0.1.GA/server/default/deploy/CompassTest2EAR.ear/CompassTest2.jar/entities/ to pass this test
and so
return new JarScanner(basePackage, url.openStream(), filter); is called and it's working with no "protocol vfszip unsupported" errors.

but... never goes into : getMappingBinding().addInputStream(si.getInputStream(), si.getName()); (in addScan method).

I Will have a look to new vfszip next week...

have a nice day
John


Shay Banon added a comment - 08/May/09 05:23 PM
I think that its probably because the basePackage needs to be removed from the end of the url (similar to what is done at the beginning of the method).

john added a comment - 22/May/09 07:43 AM
Hi,

Sorry for the long time without answer...

I've taken the test you've suggested and it seems to be OK.

Just added in ScannerFactoy class :

...
} else if (url.getProtocol().equals("vfszip")) { url = new URL(urlString); // urlString init : begining of the method return new JarScanner(basePackage, url.openStream(), filter); } else {
...

And items in the package were found successfuly.

John


john added a comment - 22/May/09 07:49 AM
same readeable code :

...
else if (url.getProtocol().equals("vfszip")) { url = new URL(urlString); return new JarScanner(basePackage, url.openStream(), filter); }
...


john added a comment - 22/May/09 07:50 AM
delete this and last post... JIRA's killing my NewLine characters.... sorry

Shay Banon added a comment - 24/May/09 10:02 AM
Can you simply upload the new ScannerFactory class (just attach it to the issue)? I will make the relevant changes.

john added a comment - 25/May/09 02:31 AM
modified ScannerFactoy.java

original from :
build.number=489
build.timestamp="2009-05-20 10\:34\:10"


Shay Banon added a comment - 25/May/09 11:56 AM
Fixed and committed. Will be available in the next nightly build of 2.3. Would be great if you can test it.