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

NPE caused by using ClassLoader.getSystemResourceAsStream in OSGI environment #423

Closed
kdvolder opened this issue Mar 21, 2016 · 2 comments
Closed

Comments

@kdvolder
Copy link

RandomWordList initialization crashes in OSGI environment because it seems to be trying to use the system classloader to load application resources. This essentially makes the client unusable in OSGI environment as its not possible to instantiate it properly. (Well, I suppose we could try copying whatever resources it is looking for into the system classpath as a workaround)

The WordListRandomWords class should use its own classloader to load the wordlists that are enclosed in its own bundle rather than the system classloader.

This is the stacktrace of the NPE I got:

!ENTRY org.springframework.ide.eclipse.boot.dash 4 0 2016-03-21 16:36:59.521
!MESSAGE 
!STACK 0
java.lang.NullPointerException
    at java.io.Reader.<init>(Reader.java:78)
    at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
    at org.cloudfoundry.operations.applications.WordListRandomWords.getWordList(WordListRandomWords.java:53)
    at org.cloudfoundry.operations.applications.WordListRandomWords.<init>(WordListRandomWords.java:33)
    at org.cloudfoundry.operations.applications.DefaultApplications.<init>(DefaultApplications.java:124)
    at org.cloudfoundry.operations.DefaultCloudFoundryOperations.<init>(DefaultCloudFoundryOperations.java:58)
    at org.cloudfoundry.operations.CloudFoundryOperationsBuilder.build(CloudFoundryOperationsBuilder.java:62)
    at org.springframework.ide.eclipse.boot.dash.cloudfoundry.client.v2.DefaultCloudFoundryClientFactoryV2.getClient(DefaultCloudFoundryClientFactoryV2.java:46)
    at org.springframework.ide.eclipse.boot.dash.cloudfoundry.client.CloudFoundryClientFactory.getClient(CloudFoundryClientFactory.java:44)
    at org.springframework.ide.eclipse.boot.dash.cloudfoundry.CloudFoundryRunTarget.createClient(CloudFoundryRunTarget.java:145)
    at org.springframework.ide.eclipse.boot.dash.cloudfoundry.CloudFoundryRunTarget.connect(CloudFoundryRunTarget.java:102)
    at org.springframework.ide.eclipse.boot.dash.cloudfoundry.ops.ConnectOperation.doCloudOp(ConnectOperation.java:51)
    at org.springframework.ide.eclipse.boot.dash.cloudfoundry.ops.CloudOperation.runOp(CloudOperation.java:37)
    at org.springframework.ide.eclipse.boot.dash.cloudfoundry.ops.CloudOperation.runOp(CloudOperation.java:1)
    at org.springframework.ide.eclipse.boot.dash.cloudfoundry.ops.Operation.run(Operation.java:38)
    at org.springframework.ide.eclipse.boot.dash.cloudfoundry.ops.OperationsExecution$1.run(OperationsExecution.java:37)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/116092823.

@nebhale
Copy link
Member

nebhale commented Mar 21, 2016

We'll get on it.

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

No branches or pull requests

3 participants