[jboss-jira] [JBoss JIRA] (DROOLS-1366) Cannot access remote KIE maven repo - Unauthorized access 401

Sambhaji Biradar (JIRA) issues at jboss.org
Wed Nov 23 13:58:00 EST 2016


    [ https://issues.jboss.org/browse/DROOLS-1366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13327403#comment-13327403 ] 

Sambhaji Biradar commented on DROOLS-1366:
------------------------------------------

Hi,
we tried with 6.5 only. This is what we are doing.

1. we have a rule project created on work bench. There are few rules and its build and deploy on work bench.  The project jar is exposed to client using a url with username and password of tomcat.

2. we have a client code running remotely. Below is the client code :
HttpURLConnection httpURLConnection;
            	   String url = "http://10.205.77.200:8080/kie-drools-wb/maven2/com/capitalone/cerberus/fraudengine/fraudrules/1.0/fraudrules-1.0.jar";
            	   KieServices ks = KieServices.Factory.get();
            	   KieRepository kr = ks.getRepository();


            	String userpassword = "tomcat:tomcat";
            	httpURLConnection = (HttpURLConnection)new URL(url).openConnection();
            	String authEnc = new Base64Encoder().encode(userpassword.getBytes());
            	httpURLConnection.setRequestProperty("Authorization", "Basic "+ authEnc);
            	InputStream is = httpURLConnection.getInputStream();
            	KieModule kModule = kr.addKieModule(ks.getResources().newInputStreamResource(is));
            	KieContainer kContainer = ks.newKieContainer(kModule.getReleaseId());

            	//kContainer.newStatelessKieSession();

                    
//                    ks.getRepository().addKieModule(ks.getResources().newInputStreamResource(stream));
//                    
//                    KieContainer kieContainer = ks.newKieContainer(releaseId);
//                    
                    KieScanner kieScanner = ks.newKieScanner(kContainer);
        	        kieScanner.start(5000L);
//        	        // alternatively:
        	        kieScanner.scanNow();

                    runRule(kContainer);
           
                    
 
//                  Scanner scanner = new Scanner(System.in);
//                  while (true) {
//                      runRule(kieContainer);
//                      System.out.println("Press enter in order to run the test again....");
//                      scanner.nextLine();
//                  }
                }
 
                private static void runRule(KieContainer kieKontainer) {
                	try {
                    KieSession kSession = kieKontainer.newKieSession();
                  
                    AuthorizationRequest authr = new AuthorizationRequest();
                    //authr.setAuthKey("test");
                    authr.setPosEntryMode("79");							//90 in request, valid value 80, 79
                    authr.setChipConditionCode("31");						//5 in request		
                    authr.setAccountNumber("4000000000000001");				
                    authr.setResponseCode("");
                    
                      kSession.insert(authr);	

                 
                    //kSession.setGlobal("out", System.out);
                     System.out.println(kSession.fireAllRules());
                     System.out.println(authr.getResponseCode());

                	}catch(Exception e){
                		e.printStackTrace();
                	}
                   
                   // System.out.println(authr.getRequestCode());
                
                }


3. The client code is working good for url whatever we have given. But  KieScanner is not doing continuous scan on repo updates. so, if I re-build the project and create next version, client does not load the latest artifects automatically.  

we do see 401 error in the file client maven repo. But same works good if work bench and client code both is running on same machine.

Hope this gives enough details.

> Cannot access remote KIE maven repo - Unauthorized access 401
> -------------------------------------------------------------
>
>                 Key: DROOLS-1366
>                 URL: https://issues.jboss.org/browse/DROOLS-1366
>             Project: Drools
>          Issue Type: Bug
>          Components: kie server
>            Reporter: Sambhaji Biradar
>            Assignee: Mario Fusco
>
> Using the latest 6.5 version, we are getting unauthorized access error. From the other posts I see that this issue was resolved in earlier versions but wondering if this issue was introduced again in 6.5. I tried this solution with no success - https://issues.jboss.org/browse/DROOLS-436.
> Could someone help resolving the issue please?
>  
> #NOTE: This is an Aether internal implementation file, its format can be changed without prior notice.
> #Mon Nov 21 19:20:51 EST 2016
> maven-metadata-central.xml.error=Could not transfer metadata com.xxx.xxx.ruleengine\:fraudrules\:1.1-SNAPSHOT/maven-metadata.xml from/to central (http\://repo1.maven.org/maven2/)\: Connect to repo1.maven.org\:80 timed out
> maven-metadata-guvnor-m2-repo.xml.error=Could not transfer metadata com.xxx.xxx.ruleengine\:rules\:1.1-SNAPSHOT/maven-metadata.xml from/to guvnor-m2-repo (http\://10.xxx.77.xxx\:8080/kie-drools-wb/maven2/)\: Unauthorized (401)
> maven-metadata-workbench.xml.lastUpdated=1479774051131
> maven-metadata-guvnor-m2-repo.xml/@default-guvnor-m2-repo-http\://10.xxx.77.xxx\:8080/kie-drools-wb/maven2/.lastUpdated=1479774051096
> maven-metadata-central.xml/@default-central-http\://repo1.maven.org/maven2/.lastUpdated=1479774050359



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list