Unable to run write-attribute in jboss EAP 6.3.3 CLI - java-8

I am trying to run the below java code in my custom app:
I am using JBoss EAP 6.3.3 with Java 1.8.0_92 have also used Java 7. This used to work in JBoss EAP 6.3.2 (java 7)
ccp = new CLICommandParser(standalone + "/subsystem=security/security-domain=EncryptDBPassword/authentication=classic:write-attribute"
+ "(name=login-modules,value=["
+ "{flag=required,code=org.picketbox.datasource.security.SecureIdentityLoginModule,"
+ "module-options=[(username=" + dbUser + "),(password=" + dbPassword + "),(managedConnectionFactoryName=jboss.jca:name=jdbc/fooDS),(service=XATxCM)]}"
+ "])");
ccp.execute(client, true);
The error I get is, the security domain gets security-domain gets added by fails in next line of code mentioned above.
INFONFO: Command executed sucessfully: /subsystem=security/security-domain=EncryptDBPasswordXA/authentication=classic:add
Exception in thread "main" java.lang.IllegalArgumentException
at org.jboss.dmr.ModelValue.addChild(ModelValue.java:120)
at org.jboss.dmr.ModelNode.add(ModelNode.java:1116)
at org.jboss.dmr.ModelNode.add(ModelNode.java:930)
at com.foo.org.App$CLICommandParser.getListArgs(App.java:1417)
at com.foo.org.App$CLICommandParser.getNameOrValue(App.java:1448)
at com.foo.org.App$CLICommandParser.getListArgs(App.java:1380)
at com.foo.org.App$CLICommandParser.getNameOrValue(App.java:1460)
at com.foo.org.App$CLICommandParser.getListArgs(App.java:1363)
at com.foo.org.App$CLICommandParser.getNameOrValue(App.java:1448)
at com.foo.org.App$CLICommandParser.getListArgs(App.java:1380)
at com.foo.org.App$CLICommandParser.setOPArgs(App.java:1344)
at com.foo.org.App$CLICommandParser.setCommand(App.java:1253)
at com.foo.org.App$CLICommandParser.<init>(App.java:1224)
at com.foo.org.App.addSecurity(App.java:492)
at com.foo.org.App.run(App.java:176)
at com.foo.org.App.main(App.java:54)
I can however run the same command in JBoss CLI and this works. Is there a change I need to do around the code, seems like patch 3 doesn't like to use "write-attribute" in JBoss CLI.
Any pointers will be grateful.

Related

Failing to connect MQ with java 11

After upgrading to JDK 11 from JDK 8 and MQ 9.2.0.5 (from 9.2.0.4), i'm getting the below error when trying to open JMS connection.
I'm running on WLS 14.
I also upgraded allclient.jar to 9.2.0.5.
I tried running it with previous MQ (9.2.0.4) which worked fine with java 8, i get the same issue.
Same code works fine with MQ 9.2.0.4, JDK 8 and WLS 12.
I verified that method exists in jar and verified no other versions of allclient jars exists.
com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195;AMQ9546: Error return code
received.
[1=java.lang.NoSuchMethodException[com.ibm.mq.jmqi.remote.api.RemoteFAP.(com.ibm.mq.jmqi.JmqiEnvironment,
int)],3=Class.getConstructor0]
at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:857)
at com.ibm.mq.jmqi.JmqiEnvironment.getMQI(JmqiEnvironment.java:702)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:8437)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:7815)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl._createConnection(JmsConnectionFactoryImpl.java:322)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:242)
at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6026)
at com.ibm.mq.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:6086)
at org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter.doCreateConnection(UserCredentialsConnectionFactoryAdapter.java:188)
at . Caused by: java.lang.NoSuchMethodException: com.ibm.mq.jmqi.remote.api.RemoteFAP.(com.ibm.mq.jmqi.JmqiEnvironment,
int)
at java.base/java.lang.Class.getConstructor0(Class.java:3349)
at java.base/java.lang.Class.getConstructor(Class.java:2151)
at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:764)
Remove if you have com.ibm.* related packages in prefer-application-packages section in weblogic.xml.
I just ran a couple of Java/JMS applications using OpenJDK 11 and they ran fine. I agree with Doug Grove that you probably have a mismatch of MQ JAR files.
Add the following line to your code and then update your question with the output:
System.out.println("java.class.path="+System.getProperty("java.class.path"));
If you want to get fancy then you can do:
if (null != System.getProperty("java.class.path"))
{
if (System.getProperty("os.name").startsWith("Windows"))
System.out.println("java.class.path=\n"+(System.getProperty("java.class.path")).replace(';', '\n'));
else
System.out.println("java.class.path\n="+(System.getProperty("java.class.path")).replace(':', '\n'));
}

UnrecoverableKeyException on trying to read key using alias from keystore

I am getting the following error on Line #4 of code below in IBM Websphere
Liberty Profile 16.0.0
InputStream keystoreStream = EncryptionUtility.class.getResourceAsStream(keyStoreLocation);
KeyStore keystore = KeyStore.getInstance("JCEKS");
keystore.load(keystoreStream, storePass.toCharArray());
Key key = keystore.getKey(alias, keyPass.toCharArray());
Which results in the following exception:
Caused by: java.security.UnrecoverableKeyException: com.ibm.crypto.provider.AESSecretKey
at com.sun.crypto.provider.KeyProtector.unseal(KeyProtector.java:358)
at com.sun.crypto.provider.JceKeyStore.engineGetKey(JceKeyStore.java:133)
at java.security.KeyStore.getKey(KeyStore.java:804)
at com.comdata.base.helper.EncryptionUtility.initSymmetricKey(EncryptionUtility.java:134)
Any ideas why this is happening? Is anything need to be configured for cryptography?
I poked through the code of keyProtector.java in JDK 7 and UnrecoverableKeyException is triggered by ClassNotFoundException
com.ibm.crypto.provider.AESSecretKey
Do we need to install any feature via installUtility?
Any ideas why this is happening? Is anything need to be configured for cryptography?
The class not being found (com.ibm.crypto.provider.AESSecretKey) is from the IBM JDK.
It looks like your keystore was created using the IBM JDK and thus has a key packaged in it that uses the AESSecretKey from the IBM JDK.
At runtime, your Liberty server is probably using a non-IBM JDK, which would not have this IBM JDK specific class in it.
Do we need to install any feature via installUtility?
Nope. The missing class should be provided by the JDK, as opposed to a Liberty feature.

Apache Camel FTP Download does not delete remote file

First of all: I am quite new to Apache Camel and to Stack Overflow!
I have created a route which filters and downloads files from an SFTP Server and deletes those after processing.
My problem: On my local computer the route works perfectly. When I deploy this route (the same .war) on the production server, the download works but when the FTP component tries to delete the file I get the exception below. The development and production machine have the same camel, tomcat and java version. The only difference is the OS (Dev: Windows 7, Prod: Windows Server 2008 R2)
Any ideas???
java.lang.IllegalArgumentException: Resolving language: header detected type conflict: Not a Language implementation. Found: org.apache.camel.language.header.HeaderLanguage
at org.apache.camel.impl.DefaultLanguageResolver.resolveLanguage(DefaultLanguageResolver.java:76)
at org.apache.camel.impl.DefaultCamelContext.resolveLanguage(DefaultCamelContext.java:1135)
at org.apache.camel.model.language.ExpressionDefinition.createExpression(ExpressionDefinition.java:177)
at org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:118)
at org.apache.camel.builder.BinaryPredicateSupport.matchesReturningFailureMessage(BinaryPredicateSupport.java:60)
at org.apache.camel.builder.BinaryPredicateSupport.matches(BinaryPredicateSupport.java:50)
at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:90)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:60)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:166)
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:401)
at org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:99)
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:201)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:165)
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Here's the route:
String uri = "sftp://" + sftpUserId + "#" + sftpHost + "?" +
"password=" + sftpPassword + "&" +
"recursive=true" + "&" +
"filter=#fileFilter" + "&" +
"binary=true" + "&" +
"delete=true";
This is some other kind of problem. You need to tell more about the production environment. Do you use some special application server for your Camel app or how do you run it?
That error indicates some kind of class loading issue.
This problem is still unsolved. Running in Tomcat in a Windows Server (even as administrator) we did not manage to make this route work. Deploying the route in a Tomcat in Ubuntu Linux it worked right from the start without any modifications!!!

Error while using Admin task importSAMLIdpMetadata

I am currently trying to import identity provider metadata xml to websphere service provider using the below command in wsadmin jython
AdminTask.importSAMLIdpMetadata('-ssoId 1 -idpId 1 -idpMetadataFileName IDP-DD-Metadata-2014.xml -securityDomainName dd.test.net -signingCertAlias acs')
I am using websphere version 7
WASX7015E: Exception running command: "AdminTask.importSAMLIdpMetadata('-ssoId 1 -idpId 1 -idpMetadataFileName IDP-DD-Metadata-2014.xml -securityDomainName dd.test.net -signingCertAlias acs')"; exception information:
com.ibm.websphere.management.cmdframework.CommandException: com.ibm.websphere.management.cmdframework.CommandException
I have even tried avoiding all other attributes except the required one idpMetadataFileName
Any idea what is going wrong ?
Any guidance will be highly appreciated.

weblogic 10.3.6 issue

I have upgraded the WebLogic server from 10.3.5 to 10.3.6 for my application and upgraded the jars to the latest which are available with WebLogic 10.3.6.
I have created wlfullclient.jar and and the deployment was going fine.
When I try running the test cases for my application they were failing with the following error:
com.sun.xml.ws.util.ServiceConfigurationError:
weblogic.wsee.jaxws.tubeline.TubelineDeploymentListener:
Provider:`weblogic.wsee.wstx.wsat.tube.WSATTubelineDeploymentListener` is specified in jar:
> file:/root/Oracle/Middleware/wlserver_10.3/server/lib/wseeclient.jar!/META-INF/services/weblogic.wsee.jaxws.tubeline.TubelineDeploymentListener
but not found at
- com.sun.xml.ws.util.ServiceFinder.fail(ServiceFinder.java:241)
- com.sun.xml.ws.util.ServiceFinder.access$100(ServiceFinder.java:141)
- com.sun.xml.ws.util.ServiceFinder$LazyIterator.next(ServiceFinder.java:376)
weblogic.wsee.jaxws.spi.WLSServiceDelegate$WLSTubelineDeploymentListenerRepository.<init>(WLSServiceDelegate.java:355)
- weblogic.wsee.jaxws.spi.WLSServiceDelegate.<init>(WLSServiceDelegate.java:89)
- weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.<init>(WLSProvider.java:632)
- weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:143)
- weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:117)
- weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:88)
- javax.xml.ws.Service.<init>(Service.java:56)
While using WebLogic 10.3.5 the testcases were passing without issue.
I finally found that there is no folder named wsee in the new wlfullclient which was created for the new release (WebLogic 10.3.6).
Please help me how to fix this issue.
There seems to be problem with the webservices.
This discussion might help wsse JAXWS

Resources