chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Brosius <dbros...@mebigfatguy.com>
Subject Re: NPE trying to session.getRootFolder
Date Fri, 21 Feb 2014 16:32:13 GMT

I've added more to paths to my <prefer-application-packages> in my ear


and now i get

Caused by: java.lang.ClassCastException: Cannot cast 
weblogic.wsee.jaxws.spi.WLSServiceInterceptorFactory to 
com.sun.xml.ws.api.client.ServiceInterceptorFactory

Now this SPI is found in jaxws-rt-2.2.26-6.jar and is 
javax.xml.ws.spi.Provider=com.sun.xml.ws.spi.ProviderImpl there

and i have

<prefer-application-packages>
     <package-name>javax.xml.ws.*</package-name>
     ....


in my weblogic-application.xml in my ear, so it should be using that 
jar. But yet it is still picking up WLSServiceInterceptorFactory thru 
spi somehow.

Anyone know what my problem is?


---
<br type="_moz" />

On 2014-02-20 17:08, Dave Brosius wrote:
> It must be a classloader issue with some jar in wls, as this web app 
> fails
> 
> package com.suckage;
> 
> import java.io.IOException;
> import java.net.Authenticator;
> import java.net.PasswordAuthentication;
> import java.util.HashMap;
> import java.util.List;
> import java.util.Map;
> 
> import javax.servlet.ServletException;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> 
> import org.apache.chemistry.opencmis.client.api.Folder;
> import org.apache.chemistry.opencmis.client.api.Repository;
> import org.apache.chemistry.opencmis.client.api.Session;
> import 
> org.apache.chemistry.opencmis.client.bindings.CmisBindingFactory;
> import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
> import org.apache.chemistry.opencmis.commons.SessionParameter;
> import org.apache.chemistry.opencmis.commons.enums.BindingType;
> 
> public class CmisServlet extends HttpServlet {
> 
>     private Repository repository = null;
>     private Session session = null;
> 
>     @Override
>     public void init() throws ServletException {
>         super.init();
> 
>         List<Repository> repositories =
> SessionFactoryImpl.newInstance().getRepositories(getProps());
> 
>         for (Repository rep : repositories) {
>             if (rep.getName().equalsIgnoreCase("Main Repository")) {
>                 repository = rep;
>                 break;
>             }
>         }
> 
>         session = repository.createSession();
>     }
> 
>     @Override
>     protected void doGet(HttpServletRequest request,
> HttpServletResponse response)
>             throws ServletException, IOException {
> 
>         if (session != null) {
>             Folder f = session.getRootFolder();
> 
>             response.setStatus(HttpServletResponse.SC_OK);
>             
> response.getOutputStream().write(f.getName().getBytes("UTF-8"));
>         }
>     }
> 
>     private static Map<String, String> getProps() {
>         String wsdl =
> "http://10.177.101.190:9080/alfresco/cmisws/RepositoryService?wsdl";
> 
>         Map<String, String> properties = new HashMap<String, String>();
>         properties.put(SessionParameter.BINDING_TYPE,
> BindingType.WEBSERVICES.value());
>         properties.put(SessionParameter.WEBSERVICES_ACL_SERVICE, wsdl);
>         properties.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, 
> wsdl);
>         
> properties.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, wsdl);
>         properties.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, 
> wsdl);
>         properties.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, 
> wsdl);
>         properties.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, 
> wsdl);
>         
> properties.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, 
> wsdl);
>         properties.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, 
> wsdl);
>         properties.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, 
> wsdl);
> 
>         String username = "xxx";
>         String password = "yyy";
> 
>         properties.put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS,
> CmisBindingFactory.STANDARD_AUTHENTICATION_PROVIDER);
> 
>         properties.put(SessionParameter.USER, username);
>         properties.put(SessionParameter.PASSWORD, password);
> 
>         Authenticator.setDefault(new BasicAuthenticator(username, 
> password));
> 
>         return properties;
>     }
> 
>     static class BasicAuthenticator extends Authenticator
>     {
>         private PasswordAuthentication passwordAuthentication;
> 
>         public BasicAuthenticator(String user, String password)
>         {
>             passwordAuthentication = new PasswordAuthentication(user,
> password.toCharArray());
>         }
> 
>         @Override
>         protected synchronized PasswordAuthentication
> getPasswordAuthentication()
>         {
>             return passwordAuthentication;
>         }
>     }
> }
> 
> and this standalone succeeds
> 
> import java.net.Authenticator;
> import java.net.PasswordAuthentication;
> import java.util.HashMap;
> import java.util.List;
> import java.util.Map;
> 
> import org.apache.chemistry.opencmis.client.api.Folder;
> import org.apache.chemistry.opencmis.client.api.Repository;
> import org.apache.chemistry.opencmis.client.api.Session;
> import 
> org.apache.chemistry.opencmis.client.bindings.CmisBindingFactory;
> import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
> import org.apache.chemistry.opencmis.commons.SessionParameter;
> import org.apache.chemistry.opencmis.commons.enums.BindingType;
> 
> 
> public class Al {
> 
> public static void main(String[] args) {
> 
> 	Map<String, String> props = getProps();
> 
> 	List<Repository> repositories =
> SessionFactoryImpl.newInstance().getRepositories(props);
> 
> 	Repository repository = null;
> 	for (Repository rep : repositories) {
>             if (rep.getName().equalsIgnoreCase("Main Repository")) {
>                 repository = rep;
>                 break;
>             }
>         }
> 
> 	if (repository != null) {
> 		Session session = repository.createSession();
> 
> 		Folder f = session.getRootFolder();
> 		System.out.println(f.getName());
> 	}
> }
> 
> private static Map<String, String> getProps() {
> 	String wsdl =
> "http://10.177.101.190:9080/alfresco/cmisws/RepositoryService?wsdl";
> 
>         Map<String, String> properties = new HashMap<String, String>();
>         properties.put(SessionParameter.BINDING_TYPE,
> BindingType.WEBSERVICES.value());
>         properties.put(SessionParameter.WEBSERVICES_ACL_SERVICE, wsdl);
>         properties.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, 
> wsdl);
>         
> properties.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, wsdl);
>         properties.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, 
> wsdl);
>         properties.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, 
> wsdl);
>         properties.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, 
> wsdl);
>         
> properties.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, 
> wsdl);
>         properties.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, 
> wsdl);
>         properties.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, 
> wsdl);
> 
>         String username = "xxx";
>         String password = "yyy";
> 
>         properties.put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS,
> CmisBindingFactory.STANDARD_AUTHENTICATION_PROVIDER);
> 
>         properties.put(SessionParameter.USER, username);
>         properties.put(SessionParameter.PASSWORD, password);
> 
>         Authenticator.setDefault(new BasicAuthenticator(username, 
> password));
> 
>         return properties;
> }
> 
> }
> 
> class BasicAuthenticator extends Authenticator
> {
>     private PasswordAuthentication passwordAuthentication;
> 
>     public BasicAuthenticator(String user, String password)
>     {
>         passwordAuthentication = new PasswordAuthentication(user,
> password.toCharArray());
>     }
> 
>     @Override
>     protected synchronized PasswordAuthentication 
> getPasswordAuthentication()
>     {
>         return passwordAuthentication;
>     }
> }
> 
> 
> i even added <prefer-application-packages> like the following to try
> to use my copies of the jars in weblogic-application.xml
> 
>  	<prefer-application-packages>
> 	<package-name>org.apache.chemistry.*</package-name>
> 	<package-name>com.glassfish.gmbal.*</package-name>
> 	<package-name>com.sun.istack.*</package-name>
> 	<package-name>com.sun.xml.stream.*</package-name>
> 	<package-name>com.sun.xml.ws.*</package-name>
> 	<package-name>com.sun.xml.bind.*</package-name>
> 	<package-name>com.sun.xml.txw2.*</package-name>
> 	<package-name>org.jvnet.*</package-name>
> 	<package-name>javax.xml.bind.*</package-name>
> 	<package-name>javax.xml.ws.*</package-name>
> </prefer-application-packages>
> 
> 
> 
> 
> 
> ---
> <br type="_moz" />
> 
> On 2014-02-20 14:10, Dave Brosius wrote:
>> I'm using
>> 
>> Alfresco Community v4.0.0
>> (4003) schema 5025
>> 
>> The web service url is
>> 
>> http://some.local.host.com:9080/alfresco/cmisws/RepositoryService?wsdl
>> 
>> 
>> I decided to build a standalone app that just tested that one thing,
>> so it would be easier to test (the real thing is part of a web app on
>> weblogic)
>> 
>> It works fine in the standalone app. I'm now thinking that it's a
>> quiet jar conflict, as i had to download a bunch of jars that
>> apparently
>> wls was providing.
>> 
>> I'm going to stuff all the jars i downloaded into WEB-INF/lib and see
>> what happens.
>> 
>> ---
>> <br type="_moz" />
>> 
>> On 2014-02-20 11:56, Florian Müller wrote:
>>> Hi Dave,
>>> 
>>> Looks like the transferred XML is somehow corrupt. All properties
>>> became extensions.
>>> Would it be possible to capture the response from the Alfresco 
>>> server?
>>> Which Alfresco version are you connection to and which Alfresco CMIS
>>> URL did you use?
>>> 
>>> 
>>> Thanks,
>>> 
>>> Florian
>>> 
>>> 
>>> 
>>>> Greetings,
>>>> 
>>>>    I am running into a NPE trying to get the root folder from an
>>>> Alfresco cmis thru chemistry 0.10.0.
>>>> 
>>>> I'm assuming that there is some sort of configuration missing on my
>>>> part, but i'm not sure how to debug further.
>>>> 
>>>> Basically, when calling Session.getRootFolder it gets to
>>>> 
>>>> SessionImpl getObject(ObjectId objectId, OperationContext context);
>>>> 
>>>> where it fetches ObjectData, that looks like this:
>>>> 
>>>> Object Data [properties=Properties Data
>>>> 
>>>> [properties=[]][extensions=[{http://docs.oasis-open.org/ns/cmis/core/200908/}propertyId
>>>> {null=cmis:allowedChildObjectTypeIds}: ,
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyId
>>>> {null=cmis:objectTypeId}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}value {}:
>>>> cmis:folder],
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyString
>>>> {null=cmis:path}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}value {}: /],
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyString
>>>> {null=cmis:name}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}value {}: Company
>>>> Home],
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyDateTime
>>>> {null=cmis:creationDate}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}value {}:
>>>> 2013-11-18T19:22:26.382+05:30],
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyString
>>>> {null=cmis:changeToken}: ,
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyString
>>>> {null=cmis:lastModifiedBy}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}value {}: System],
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyString
>>>> {null=cmis:createdBy}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}value {}: System],
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyId
>>>> {null=cmis:objectId}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}value {}:
>>>> workspace://SpacesStore/03ceb69e-5168-4f1c-a3b4-64cbb2ad4bf7],
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyId
>>>> {null=cmis:baseTypeId}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}value {}:
>>>> cmis:folder],
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyId
>>>> {null=alfcmis:nodeRef}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}value {}:
>>>> workspace://SpacesStore/03ceb69e-5168-4f1c-a3b4-64cbb2ad4bf7],
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyDateTime
>>>> {null=cmis:lastModificationDate}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}value {}:
>>>> 2013-11-18T19:44:23.898+05:30],
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyId
>>>> {null=cmis:parentId}: , {http://www.alfresco.org}aspects {}:
>>>> [{http://www.alfresco.org}appliedAspects {}: P:app:uifacets,
>>>> {http://www.alfresco.org}properties {}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}propertyString
>>>> {propertyDefinitionId=app:icon}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}value {}:
>>>> space-icon-default],
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyString
>>>> {propertyDefinitionId=cm:description}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}value {}: The
>>>> company root space],
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyString
>>>> {propertyDefinitionId=cmis:policyText}: ,
>>>> {http://docs.oasis-open.org/ns/cmis/core/200908/}propertyString
>>>> {propertyDefinitionId=cm:title}:
>>>> [{http://docs.oasis-open.org/ns/cmis/core/200908/}value {}: Company
>>>> Home]], {http://www.alfresco.org}appliedAspects {}: P:cm:titled,
>>>> {http://www.alfresco.org}appliedAspects {}: P:sys:localized]]],
>>>> allowable
>>>> actions=Allowable Actions [allowable actions=[CAN_UPDATE_PROPERTIES,
>>>> CAN_GET_FOLDER_TREE, CAN_GET_PROPERTIES, 
>>>> CAN_GET_OBJECT_RELATIONSHIPS,
>>>> CAN_GET_DESCENDANTS, CAN_GET_APPLIED_POLICIES, CAN_GET_CHILDREN,
>>>> CAN_CREATE_DOCUMENT, CAN_CREATE_FOLDER, CAN_CREATE_RELATIONSHIP,
>>>> CAN_GET_ACL, CAN_APPLY_ACL]][extensions=null], change event 
>>>> info=null,
>>>> ACL=null, is exact ACL=null, policy ids=null, relationships=[],
>>>> renditions=[]][extensions=null]
>>>> 
>>>> It then switches on the objectData's baseTypeId
>>>> 
>>>> which uses the entry in the properties.properties object as
>>>> 
>>>>  PropertyData<?> property =
>>>> properties.getProperties().get("cmis:baseTypeId");
>>>> 
>>>> but as you can see above the properties.properties collection is 
>>>> empty.
>>>> 
>>>> since the value returned is null, the switch NPEs on me.
>>>> 
>>>> So i'm not sure why the properties.properties collection is empty.
>>>> 
>>>> Any help would be greatly appreciated.
>>>> 
>>>> dave

Mime
View raw message