axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron Evans (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AXIS2-401) generated client stub throws IOException and requires non-null AXIS2_HOME
Date Thu, 19 Jan 2006 17:09:43 GMT
    [ http://issues.apache.org/jira/browse/AXIS2-401?page=comments#action_12363276 ] 

Aaron Evans commented on AXIS2-401:
-----------------------------------


As an update to this, I did manage to patch this.

If axis home is null, then it attempts to use the user's home directory and I believe that
is what was causing the "java.io.IOException: Access is denied" exception.  

To fix this this first problem, I forced it to use null for the repo location by implementing
a simple AxisConfigurator that extends FileSystemConfigurator:

public class MyClientAxisConfigurator extends FileSystemConfigurator
{
	public MyClientAxisConfigurator()
	{
		//Use null for axis home
		//Use false for isServer
		super(null,false);
	}
	
	public AxisConfiguration getAxisConfiguration() throws AxisFault
	{
		//pass null for repo location
        	return new DeploymentEngine().loadClient(null);
    	}
}

Then it is just a matter of modifying the generated Client stub constructor that takes an
endpoint as an argument like so:

public WebServiceClientStub(String targetEndpoint) throws java.lang.Exception
{
    //comment out this line
    //this(new ConfigurationContextFactory().createConfigurationContextFromFileSystem(AXIS2_HOME),targetEndpoint);

    //add this line
    this(new ConfigurationContextFactory().createConfigurationContext(new MyClientAxisConfigurator()),targetEndpoint);

}

Finally, the "addressing" module is required, so I simply copied addressing.mar from the axis
binary distribution to my lib directory and renamed it to addressing.jar and added to the
class path.


> generated client stub throws IOException and requires non-null AXIS2_HOME
> -------------------------------------------------------------------------
>
>          Key: AXIS2-401
>          URL: http://issues.apache.org/jira/browse/AXIS2-401
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug
>   Components: client-api
>     Versions: 0.94
>  Environment: Windows XP, JDK 1.5
>     Reporter: Aaron Evans

>
> I generated a client stub based on some wsdl using the eclipse plugin.
> In my stub, it created a static String for axis home and set it to null.
> It also had a comment that suggested this was ok:
> //default axis home being null forces the system to pick up the 
> //mars from the axis2 library
> public static final String AXIS2_HOME = null;
> However, when I run my client from windows, I get the stack trace given below.
> If I set this value to a path that points to a directory with axis2.xml and
> the modules directory in it, then it works fine.
> However, since I am just using axis in a client capacity and I didn't change
> the default axis2.xml or modules, I really think I should be able to run it
> without having to specify any "AXIS2_HOME" configuration.
> I have tried a few workarounds, but haven't been successful yet.  
> Stack trace:
> 	org.apache.axis2.deployment.DeploymentException: Access is denied;  nested exception
is: 
> 	java.io.IOException: Access is denied
> 	at org.apache.axis2.deployment.DeploymentEngine.prepareRepository(DeploymentEngine.java:845)
> 	at org.apache.axis2.deployment.DeploymentEngine.<init>(DeploymentEngine.java:117)
> 	at org.apache.axis2.deployment.DeploymentEngine.<init>(DeploymentEngine.java:107)
> 	at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:55)
> 	at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:39)
> 	at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:53)
> 	at com.mycompany.WebServiceClientStub.<init>(WebServiceClientStub.java:122)
> 	at com.mycompany.test.WebServiceClientStubTest.setUp(WebServiceClientStubTest.java:27)
> Caused by: java.io.IOException: Access is denied
> 	at java.io.WinNTFileSystem.createFileExclusively(Native Method)
> 	at java.io.File.createNewFile(File.java:850)
> 	at org.apache.axis2.deployment.DeploymentEngine.prepareRepository(DeploymentEngine.java:831)
> 	... 17 more

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message