Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generated " .war" file cannot be deployed on glassfish due to error in EmbeddedGlassFishTestContainerFactory.createArchive() #1467

Closed
jerseyrobot opened this issue Jun 1, 2012 · 7 comments

Comments

@jerseyrobot
Copy link
Contributor

private void createArchive() {
// create an archive of the deployment descriptor and test classes
if ( !webXmlGeneratedOnTheFly() ) {
try {
/*
Construct a new scattered archive builder with the minimum information By default,
a scattered archive is not different from any other archive where all the files
are located under a top level directory (topDir).
**/
LOGGER.info("#1 inside method createArchive ==> webXmlGeneratedOnTheFly ==> Creating scatteredArchive [" + SRC_WEBAPP_PATH + "]");

// Create a scattered web application.
//ScatteredArchive archive = new ScatteredArchive("testapp", ScatteredArchive.Type.WAR);
//use global variable
//warArchive = new ScatteredArchive(baseUri.getRawPath()File.separator SRC_WEBAPP_PATH+File.separator+"myWarArchive", ScatteredArchive.Type.WAR);
warArchive = new ScatteredArchive(baseUri.getRawPath(), ScatteredArchive.Type.WAR);

This generate ".war" file

SHOULD HAVE USED the line

//warArchive = new ScatteredArchive(baseUri.getRawPath()File.separator SRC_WEBAPP_PATH+File.separator+"myWarArchive", ScatteredArchive.Type.WAR);

Affected Versions

[1.10]

@jerseyrobot
Copy link
Contributor Author

@glassfishrobot Commented
Reported by cqthien

@jerseyrobot
Copy link
Contributor Author

@glassfishrobot Commented
cqthien said:
I spent more time on this and discover, the bug is only reproducible when the JerseyTest is initialized with WebAppDescripter whose contextPath is "/".

java.lang.RuntimeException: javax.validation.ConstraintViolationException: Constraints for this Application configuration have been violated: on property [ name ] violation reason [ Invalid application name. The name must start with a letter, number or underscore and may contain only letters, numbers, and these characters: hyphen, period, underscore, slash, colon, hash, and semicolon. ]

When contextPath is something other than "/" the created war file will have name of the context path GF Server will use the filename as context root thus matching with contextPath, so all is working fine.

The suggested fix in the Issue Description is NOT complete. We should check for this special case

warArchive = new ScatteredArchive(baseUri.getRawPath().equals("/")?baseUri.getRawPath()File.separator"myWarArchive":baseUri.getRawPath(), ScatteredArchive.Type.WAR);

String deployedApp = deployer.deploy(warArchive.toURI(),"--contextroot",this.appDescriptor.getContextPath());

I can't seem to deploy a ".war" specifying rootcontext "/" but have to make a war with a non empty filename and only then GF accept to specify another root context

@jerseyrobot
Copy link
Contributor Author

@glassfishrobot Commented
@pavelbucek said:
adjusting priority

  • not a runtime bug
  • workaround available (looks like this is just a mishandled "corner case")

@jerseyrobot
Copy link
Contributor Author

@glassfishrobot Commented
@mpotociar said:
Will not fix minor Jersey 1.x test framework issues.

@jerseyrobot
Copy link
Contributor Author

@glassfishrobot Commented
Marked as won't fix on Friday, March 28th 2014, 8:50:42 am

@jerseyrobot
Copy link
Contributor Author

@glassfishrobot Commented
This issue was imported from java.net JIRA JERSEY-1195

@jerseyrobot
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant