Hi all,
I'm very newbie of Alfresco.
Probably you could think what this man is doing when you see the title, but I hope you bear about it and hope you give me right way to start. (And somehow you could say I'm rude, it's because my English skill is not so good. I'm trying to write very carefully with respect.)
I used to develop and configure Documentum Content Server.
When I write a application, I set my IDE(Eclipse) using 'dfc.properties' which includes all information to connect to the server.
I believed there is some similar way to connect to Alfresco Server from my local IDE, but it has been a week since I started to find how to do that.
For example right now I'm trying to create a session refer to Java Clients | Alfresco Documentation.
Down below is my code from Eclipse(Struts2 Framework).
---------------------------------------------------------------------------------------------------------------------------------------
private static final String alfresco_server = PropertiesUtil.get("alfresco.server");
// alfresco_server = http://dreamintek:8080
private static final String autompub_url = PropertiesUtil.get("atompub.url");
// autompub_url = /alfresco/api/-default-/public/cmis/versions/1.1/atom
private static Map<String, Session> connections = new ConcurrentHashMap<String, Session>();
/**
* @param connectionName the name of the new connection to be created
* @param username the Alfresco username to connect with
* @param pwd the Alfresco password to connect with
* @return an Open CMIS Session object
*/
public static Session getSession(String username, String pwd) {
String connectionName = Constants.SESSION_KEY;
System.out.println("connectionName ===>>> "+connectionName);
Session session = connections.get(connectionName);
if (session == null) {
System.out.println("=== session null =====");
// No connection to Alfresco available, create a new one
SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
Map<String, String> parameters = new HashMap<String, String>();
parameters.put(SessionParameter.USER, username);
parameters.put(SessionParameter.PASSWORD, pwd);
parameters.put(SessionParameter.ATOMPUB_URL, alfresco_server+autompub_url);
parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
parameters.put(SessionParameter.COMPRESSION, "true");
parameters.put(SessionParameter.CACHE_TTL_OBJECTS, "0"); // Caching is turned off
// If there is only one repository exposed (e.g. Alfresco), these
// lines will help detect it and its ID
List<Repository> repositories = sessionFactory.getRepositories(parameters);
Repository alfrescoRepository = null;
if (repositories != null && repositories.size() > 0) {
System.out.println("Found (" + repositories.size() + ") Alfresco repositories");
alfrescoRepository = repositories.get(0);
System.out.println("Info about the first Alfresco repo [ID=" + alfrescoRepository.getId() +
"][name=" + alfrescoRepository.getName() +
"][CMIS ver supported=" + alfrescoRepository.getCmisVersionSupported() + "]");
} else {
throw new CmisConnectionException(
"Could not connect to the Alfresco Server, no repository found!");
}
// Create a new session with the Alfresco repository
session = alfrescoRepository.createSession();
// Save connection for reuse
connections.put(connectionName, session);
} else {
System.out.println("Already connected to Alfresco with the connection id (" + connectionName + ")");
}
return session;
}
---------------------------------------------------------------------------------------------------------------------------------------
When I start my local server(tomcat) and login from my application I get
2018-12-20 09:54:40,843 INFO [com.eim.common.interceptor.TimerInterceptor] - <[Action Excute Times] : 1.098 ms>
error at this line: List<Repository> repositories = sessionFactory.getRepositories(parameters);
I'm not saying to you to correct this error, I wanna know what is right way to approach.
Any further query or some help would be appreciated.
Regards,
Keon Joh
So, WHAT exactly is the error you are getting?
Keon, please share your full stack trace, otherwise we cannot help you.
Also, you might enjoy these tutorials: About the Alfresco Developer Tutorial Series | ECM Architect
Hi Axel, thanks for reply
That message is all I get from console. That means there is no response. So, fundamentally, I wanna know (as I mentioned) how to talk with Alfresco server from my development environment.
Regards,
Keon
Hi Jeff, thanks for reply.
To be honest, I don't know how to see full stack trace, just know that when that message came out it means there is no response from target. That's obvious, because I didn't insert any information of Alfresco server side, which I really wanna know...
Thank you for that link, I hope there's something that I'm looking for.
Regards,
Keon
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.