Announcement

Collapse
No announcement yet.

own bundle as IFrame

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • own bundle as IFrame

    Hello OX Forum!
    I am starting to get despaired developing an plugin for our OX.
    I want to integrate my own bundle as an IFrame in the configuration area of the OX GUI. Therefor I wrote a bundle with an html resource file (a simple form which is sending the data from the input fields as GET request to the servlet). The servlet is registered at the HttpService with the Alias "/ajax/foo".
    This setup works fine in Eclipse and I can reach my bundle with my browser without any problems at the given alias (localhost/ajax/foo/index.html).
    But when I export the bundle from Eclipse and install it on my OX Testsystem (put the bundle in the /opt/open-xchange/bundles/ directory an set an .ini file at /opt/open-xchange/etc/groupware/osgi/bundle.d pointing on the bundle) I can not reach my index.html with the browser on the expected path (http://ox-server.com/ajax/foo/index.html)
    The bundle is shown as ACTIVE in the listbundles list. What did I do wrong or doesn't this work this way?

  • #2
    Meanwhile I developed a very simple testservlet which contains only the servlet class, an activator class and a class which is using the
    com.openexchange.server.osgiservice.ServiceRegistr y. when i am trying to start this bundle for use in OX i get the following error in the log file:

    SEVERE: cannot start bundle: de.sipro.testservlet2
    org.osgi.framework.BundleException: The activator de.sipro.testservlet2.SiProActivator for bundle de.sipro.testservlet2 is invalid
    at org.eclipse.osgi.framework.internal.core.AbstractB undle.loadBundleActivator(AbstractBundle.java:141)
    at org.eclipse.osgi.framework.internal.core.BundleCon textImpl.start(BundleContextImpl.java:970)
    at org.eclipse.osgi.framework.internal.core.BundleHos t.startWorker(BundleHost.java:346)
    at org.eclipse.osgi.framework.internal.core.AbstractB undle.start(AbstractBundle.java:260)
    at org.eclipse.osgi.framework.internal.core.AbstractB undle.start(AbstractBundle.java:252)
    at com.openexchange.control.internal.GeneralControl.s tart(GeneralControl.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.sun.jmx.mbeanserver.StandardMetaDataImpl.invok e(StandardMetaDataImpl.java:414)
    at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDa taImpl.java:220)
    at com.sun.jmx.interceptor.DefaultMBeanServerIntercep tor.invoke(DefaultMBeanServerInterceptor.java:815)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxM BeanServer.java:784)
    at javax.management.remote.rmi.RMIConnectionImpl.doOp eration(RMIConnectionImpl.java:1410)
    at javax.management.remote.rmi.RMIConnectionImpl.acce ss$100(RMIConnectionImpl.java:81)
    at javax.management.remote.rmi.RMIConnectionImpl$Priv ilegedOperation.run(RMIConnectionImpl.java:1247)
    at javax.management.remote.rmi.RMIConnectionImpl.doPr ivilegedOperation(RMIConnectionImpl.java:1343)
    at javax.management.remote.rmi.RMIConnectionImpl.invo ke(RMIConnectionImpl.java:784)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:294)
    at sun.rmi.transport.Transport$1.run(Transport.java:1 53)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport. java:149)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:466)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport.java:707)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.ClassNotFoundException: de.sipro.testservlet2.SiProActivator
    at org.eclipse.osgi.framework.internal.core.BundleLoa der.findClassInternal(BundleLoader.java:434)
    at org.eclipse.osgi.framework.internal.core.BundleLoa der.findClass(BundleLoader.java:369)
    at org.eclipse.osgi.framework.internal.core.BundleLoa der.findClass(BundleLoader.java:357)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClass Loader.loadClass(DefaultClassLoader.java:83)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
    at org.eclipse.osgi.framework.internal.core.BundleLoa der.loadClass(BundleLoader.java:289)
    at org.eclipse.osgi.framework.internal.core.BundleHos t.loadClass(BundleHost.java:227)
    at org.eclipse.osgi.framework.internal.core.AbstractB undle.loadBundleActivator(AbstractBundle.java:134)
    ... 29 more
    Any ideas?
    The Activator looks like this:

    Code:
    package de.sipro.testservlet2;
    
    import java.util.concurrent.atomic.AtomicBoolean;
    import javax.servlet.ServletException;
    import org.osgi.framework.BundleActivator;
    import org.osgi.framework.BundleContext;
    import org.osgi.service.http.HttpService;
    import org.osgi.service.http.NamespaceException;
    //import com.openexchange.context.ContextService;
    //import com.openexchange.server.osgiservice.ServiceRegistry;
    
    public class SiProActivator implements BundleActivator {
    	
    	private final AtomicBoolean registered = new AtomicBoolean();
    
    	/*
    	 * (non-Javadoc)
    	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
    	 */
    	public void start(BundleContext context) throws Exception {
    		
    		try {
    			registerServlet();
    		} catch (final Exception e) {
    			e.printStackTrace();
    		}
    	}
    
    	/*
    	 * (non-Javadoc)
    	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
    	 */
    	public void stop(BundleContext context) throws Exception {
    		
    		try {
    			unregisterServlet();
    		} catch (final Exception e) {
    			e.printStackTrace();
    		}
    	}
    	private void registerServlet() throws ServletException, NamespaceException {
    		if (registered.compareAndSet(false, true)) {
    			final HttpService httpService = SiProTestServiceRegistry.getServiceRegistry().getService(HttpService.class);
    			if ( httpService == null) {
    				System.out.println("HTTP service is null");
    			} else {
    				httpService.registerServlet("ajax/sipro", new SiProTest(), null, null);
    				
    				
    			}
    		}
    	}
    	private void unregisterServlet() {
    		if (registered.compareAndSet(true, false)) {
    			final HttpService httpService = SiProTestServiceRegistry.getServiceRegistry().getService(HttpService.class);
    			if (httpService == null) {
    				System.out.print("Blubb");
    			} else {
    				httpService.unregister("ajax/sipro");
    			}
    			
    		}
    	}
    
    }

    Comment


    • #3
      Did you add your class(es) to Bundle-ClassPath: in META-INF/MANIFEST.MF ?

      How does that file look like?

      Where do you start your server? Within eclipse or outside?

      Comment


      • #4
        my manifest file looks like this:

        Code:
        Manifest-Version: 1.0
        Bundle-ManifestVersion: 2
        Bundle-Name: Testservlet2
        Bundle-SymbolicName: de.sipro.testservlet2
        Bundle-Version: 1.0.0.qualifier
        Bundle-Activator: de.sipro.testservlet2.SiProActivator
        Import-Package: 
         com.openexchange.server.osgiservice,
         com.openexchange.server,
         javax.servlet,
         javax.servlet.http,
         org.osgi.service.http,
         com.openexchange.context,
         org.osgi.framework;version="1.3.0"
        Bundle-RequiredExecutionEnvironment: JavaSE-1.6,
         J2SE-1.5
        Bundle-Classpath: .
        the ox testsystem is running out of eclipse on an debian system.

        Comment


        • #5
          changed the classpath to:

          Code:
          Bundle-Classpath: ., src, bin
          now the bundle is active but I still can not reach the servlet over the webbrowser. It seems like the servlet is not registered correctly. Browser message is:

          No servlet bound to path/alias: ajax/sipro

          Comment


          • #6
            problem solved. had to use the HttpServletManager class and playing around with the starting time of the bundle.

            Comment


            • #7
              hi all,

              I'm also looking for a way to implement my own apps/sites via an iframe. I have already created & registered my own test plugin, but now I'm stuck.

              basically what I need is a menu entry (it's only possible in the configuration section right?) which opens up an iframe in the main openXchange window. I know that it's possible with ox.Configuration.IFrame, but I'm really bad in coding (and with bad I mean that I don't have a clue at all)

              in addition to the links in the configuration section, I also need some links in the upper menu (same function, just opens up different iframes).

              anyone knows what I have to put in register.js to make this work ? :-)

              thanks,
              Bernd

              Comment


              • #8
                does nobody have an idea? there is also an iframe example on the openXchange demo site at http://demo-stable.open-xchange.com/ox6

                configuration --> iframe example --> opens up google in main frame

                is it possible to cvs checkout or download this example module/plugin ?

                thanks,
                Bernd

                Comment


                • #9
                  Hi,

                  there are some examples about integrating user interface plug-ins


                  Greetings

                  Comment

                  Working...
                  X