HI All,
I have installed the Magnolia CMS 4.4.2 Enterprise Editition "trial version"
and I am trying to connect to the repository from a servlet deployed in
another .war in the same Tomcat 6 instance but I received:
*javax.naming.NameNotFoundException*
info.magnolia.jndi.InMemoryContext.getBoundObject(InMemoryContext.java:67)
info.magnolia.jndi.InMemoryContext.lookup(InMemoryContext.java:232)
info.magnolia.jndi.InMemoryContext.lookup(InMemoryContext.java:239)
The steps that I have followed are the next:
1. I have placed* jcr-1.0.jar* and* magnolia-jndi-1.0.1.jar* in Tomcat 6's
lib folder.
2. I have modified the *repositories.xml* placed in *
magnolia-enterprise-4.4.2/apache-tomcat-6.0.29/webapps/magnoliaAuthor/WEB-INF/config/default
*
<Repository name="magnolia" provider="info.magnolia.jackrabbit.ProviderImpl"
loadOnStartup="true">
<param name="configFile"
value="${magnolia.repositories.jackrabbit.config}" />
<param name="repositoryHome"
value="${magnolia.repositories.home}/magnolia" />
<!-- the default node types are loaded automatically
<param name="customNodeTypes"
value="WEB-INF/config/repo-conf/nodetypes/magnolia_nodetypes.xml" />
-->
* <param name="contextFactoryClass"
value="info.magnolia.jndi.InMemoryContextFactory" />*
* <param name="providerURL" value="http://www.magnolia.info/jcr" />*
* <param name="bindName" value="magnoliaAuthor" />*
<workspace name="website" />
<workspace name="config" />
<workspace name="users" />
<workspace name="userroles" />
<workspace name="usergroups" />
<workspace name="mgnlSystem" />
<workspace name="mgnlVersion" />
</Repository>
3. My servlet is :
public class MgnlJndiConnector extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException,IOException{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.print("Testing with Magnolia 3.5.4 ............n");
* String contextFactoryClass =
"info.magnolia.jndi.InMemoryContextFactory";*
* String providerURL = "http://www.magnolia.info/jcr";*
* final String bindName = "magnoliaAuthor";*
final Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, contextFactoryClass);
env.put(Context.PROVIDER_URL, providerURL);
try {
InitialContext ctx = new InitialContext(env);
// first try to find the existing object if any
Repository repository = (Repository) ctx.lookup(bindName);
SimpleCredentials credentials = new SimpleCredentials(
"superuser", "superuser".toCharArray());
Session jcrSession = repository.login(credentials);
Workspace workspace = jcrSession.getWorkspace();
out.print("Got a workspace:" + workspace.getName() + "n");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
Please, Could you help me? I guess that I am missing some important steps.
Regards
Alvaro
--
______________________________
Álvaro Vilaplana García
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------