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

Java Version can be detected and API can inform the user of an error #3432

Open
hogstrom opened this issue May 23, 2023 · 5 comments
Open

Java Version can be detected and API can inform the user of an error #3432

hogstrom opened this issue May 23, 2023 · 5 comments
Assignees
Labels
clarification enhancement New feature or request

Comments

@hogstrom
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I was installing the API ML on my local system. It had Java V8 and V11 installed and I incorrectly started Zowe with V11. All services started correctly except the API ML which attempted to start but ultimately failed the security configuration. The error is included below:

2023-05-23 13:34:30.652 <ZWEADS1:main:50331720> ZWESVUSR ERROR (o.z.a.s.HttpsFactory) error                                                                     
java.net.MalformedURLException: unknown protocol: safkeyring                                                                                                    
 at java.base/java.net.URL.<init>(URL.java:652)                                                                                                                 
 at java.base/java.net.URL.<init>(URL.java:541)                                                                                                                 
 at java.base/java.net.URL.<init>(URL.java:488)                                                                                                                 
 at org.zowe.apiml.security.SecurityUtils.keyRingUrl(SecurityUtils.java:246)                                                                                    
 at org.zowe.apiml.security.HttpsFactory.loadTrustMaterial(HttpsFactory.java:116)                                                                               
 at org.zowe.apiml.security.HttpsFactory.createSecureSslContext(HttpsFactory.java:188)                                                                          
 at org.zowe.apiml.security.HttpsFactory.getSSLConnectionSocketFactory(HttpsFactory.java:214)                                                                   
 at org.zowe.apiml.security.HttpsFactory.createSslSocketFactory(HttpsFactory.java:71)                                                                           
 at org.zowe.apiml.product.web.HttpConfig.getConnectionManager(HttpConfig.java:190)                                                                             
 at org.zowe.apiml.product.web.HttpConfig.init(HttpConfig.java:165)                                                                                             
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                              
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)                                                            
 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                    
 at java.base/java.lang.reflect.Method.invoke(Method.java:566)                                                                                                  
 at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389)
 at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333)
 at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) 
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440) 
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)                   
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)                      
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)                        
 at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)                                              
 at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$257/0x0000000000000000.getObject(Unknown Source)                                      
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)                                  
 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)                                                       
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)                                                         
 at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:410)                                   
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)    
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)               
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)                      
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)                        
 at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)                                              
 at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$257/0x0000000000000000.getObject(Unknown Source)                                      
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)                                  
 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)                                                       
 at org.springframework                                                                                                                                         
.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)                                                                                
 at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)                                               
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)                              
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)                                
 at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)                                        
 at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)                                             
 at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)                                   
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)    
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)               
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)                      
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)                        
 at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)                                              
 at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$257/0x0000000000000000.getObject(Unknown Source)                                      
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)                                  
 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)                                                       
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)                                                         
 at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)                                               
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)                              
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)                                

When switching to V8 API ML started successfully.

Describe the solution you'd like
API ML could check the Java version at initialization and issue a warning message that the Java Version has NOT been tested and remind the installer of the highest tested and supported version.

Describe alternatives you've considered
The component (API ML in this case) could alternatively fail which I think is preferred. The user could then optionally update the configuration to bypass the check. This would remind the user that the version might be the issue and aid in root cause analysis.

Willingness to help
Happy to help evaluate and comment on the solution.

@hogstrom hogstrom added enhancement New feature or request new labels May 23, 2023
@achmelo achmelo transferred this issue from zowe/api-layer May 29, 2023
@achmelo
Copy link
Member

achmelo commented May 29, 2023

We see the installation as a more suitable place to validate supported versions as there are more Java components than API ML. I believe there already exists a script that validates the Java version so maybe it is just a matter of listing supported versions.

@achmelo
Copy link
Member

achmelo commented May 29, 2023

there is already some work being done #3429

@balhar-jakub
Copy link
Member

@hogstrom Also I believe part of this problem is that Java 11 changes configuration for the safkeyring and therefore while the keyrings are supported, the configuration format needs to change.

@JirkaAichler will have the details, I believe

@boris-bc
Copy link

boris-bc commented Jun 1, 2023

Here's a Slack thread where exactly this problem is experienced by a user:
https://openmainframeproject.slack.com/archives/CC08782AG/p1685113827929439

@JirkaAichler
Copy link
Contributor

Safkeyring should still be supported in Java 11. However, some early versions of Java 11 on z/OS didn't contain keyring support. I would double-check the Java 11 version.

Not sure which Java version is precisely needed.

https://community.ibm.com/community/user/ibmz-and-linuxone/blogs/james-tang1/2022/09/14/additional-java-11-on-zos-security-providers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants