New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem generating jar file for the plugin bundle and add a service #774

Open
azOn2018 opened this Issue Jul 5, 2018 · 20 comments

Comments

Projects
None yet
3 participants
@azOn2018

azOn2018 commented Jul 5, 2018

Hi,

I am at an early stage in my work on trying to develop a plug-in bundle containing three plug-ins that extends ServicePlugin. At this stage, I just want to go through the whole process to test the setup and communication aspects. So the plug-ins are very basic at the moment which are meant to send a simple response. The configuration aspect has been a bit frustrating particularly due to my very limited experience of using Eclipse and also the BIMserver documentation. I was hoping to find a step by step guide on how to develop a plug-in and a service using the BIMserver 1.5 but the information available is limited and a bit mixed up due to various versions. More specifically, I'm using BIMserver v1.5.101 and Eclipse IDE for Java Developers Oxygen.3a Release (4.7.3a). What I have been able to do so far is the following:

  • Created a project in Eclipse to develop a plug-in bundle.

  • Generated a jar file of the plug-in bundle in Eclipse using the Export option but its structure was not what I was hoping despite trying various settings. I then used the command line to get the required structure for the jar file contents i.e. jar cvf fegplugins.bimserverFEpluginsBundle.jar feplugins META-INF plugin ). Note: I looked at some other plug-ins for BIMserver to understand the required structure.

  • Install my plug-in bundle using the 'Install from URL or File' option under 'Available Plugin Bundles' in BIMvie.ws frontend for BIMserver.

  • For a simple test project, I then tried to use 'Add internal service' option but had partial luck. Basically, on the 'Add internal service' page, I can see the three services listed and I was able to click on the Add button to bring up the 'Add service' page from the selected service. However, on the next page the 'Add service' button is disabled and I believe that's because under the 'Profiles' section, only 'No profiles' is listed. In case of other available services I have looked at, well they all have a profile (same as the service name) listed which when selected, enables the 'Add service' button. I don't know what to do to add/bring up a profile for my services.

  • Furthermore, using the Java Client API which comes with BIMserver, I created a small demo client class and successfully tested connection with the BIMserver in different setup (e.g. running BIMserver from Eclipse on port 8080 i.e. localhost:8080, also running BIMserver by executing Jar file and using the web front end BIMvie.ws plugin - localhost:8085).

Can you please provide some indication on how to fix the two issues mentioned above i.e. correctly generating jar file for the plug-in bundle in Eclipse and also sort out the Profile issue.

I have tried various options and looked at BIMserver documentation pages (e.g. https://github.com/opensourceBIM/BIMserver/wiki/Plugins---new-style https://github.com/opensourceBIM/BIMserver/wiki/Plugin-Development https://github.com/opensourceBIM/BIMserver/wiki/Eclipse) but I am now stuck. Thanks

@rubendel

This comment has been minimized.

Member

rubendel commented Jul 5, 2018

I'll give a more elaborate response later, but just checking, you did manage to run/test/develop your plugin within eclipse right?

@azOn2018

This comment has been minimized.

azOn2018 commented Jul 5, 2018

Thanks for the response. I basically used the code from one of the demo plug-ins and modified it slightly in Eclipse. So yes I am using Eclipse. As I mentioned previously, I am only at an early stage of developing a plug-in so for now just trying to understand and resolve configuration, setup and communication aspects/issues. So I created a project in Eclipse for my plug-in bundle and then created a jar file for it. To test the plug-in installation, etc I then started the BIMServer using the executable jar (not from within Eclipse) and then using BIMvie.ws frontend, installed it as mentioned in my previous message.

@rubendel

This comment has been minimized.

Member

rubendel commented Jul 5, 2018

Sorry it's not clear to me whether your plugin is running within your development version of BIMserver. As long as you are running your plugin in Eclipse it's a lot easier to debug stuff I'd say. Or are you planning to build a new version for every change you do in the code?

@azOn2018

This comment has been minimized.

azOn2018 commented Jul 5, 2018

OK let me clarify. The plan is to develop a plug-in for the proof of concept purpose so what I would like to do is to test the three possibilities:

  1. Everything within Eclipse including running the BIMserver from it ( LocalDevBimServerStarter ) and as you have mentioned as well that this is a lot easier to debug,
  2. Write plug-in code in Eclipse but test it by running BIMserver by executable jar (bimserverjar-1.5.101.jar) with BIMvie.ws web frontend,
  3. Using Tomcat or IIS server to test it as a remote service but this is for later on if possible.

I don't mind going for the easiest option i.e. number 1 initially and then try out options 2 and 3. However, a one off test at this stage for option 2 will also help me in understanding the process.

So for option 1, so far I am able to do the following: Using Program arguments for LocalDevBimServerStarter, I added -plugins "....." for my plug-in project. I can then start LocalDevBimServerStarter and by using a very simple demo demo client, can connect to the BIMserver and display my plug-ins basic info using (e.g. Identifier, Oid, Description, etc) as output.

For option 2, I think I have already mentioned the two issues I have i.e. Profile and plug-in bundle jar file creation in Eclipse.

For option 3, this is for later on if possible.

Considering this is for the proof of concept, I intend to include only basic functionality so the idea is to just have one version. However, if there is a need to improve it later on then I will create a new version.

@rubendel

This comment has been minimized.

Member

rubendel commented Jul 5, 2018

Ok thanks for the clarification. But I still don't understand whether you have managed to run your service using option 1. I understand you can see the identifier, oid and description, but that's not running the service right? Have you tried adding your service, just as described in for option 2, but just within Eclipse? This helps me identify the problem, since if this is working in Eclipse, a lot of possible problems can be discarded.

@azOn2018

This comment has been minimized.

azOn2018 commented Jul 5, 2018

Yes that's right, I haven't reached the stage of actually running the service. For option 2, I believe you have understood the stage I am at i.e. installed the plug-in but stuck at adding it to the project. For option 1, I believe I have added/attached (sorry in case I'm not using the correct terminology) the plug-in to the BIMserver using Program arguments for LocalDevBimServerStarter (i.e. -plugins "location of my plug-in" it's an actual location but I'm just highlighting here how I did that). As you know I can then display the identifier, oid and description of the service using getIdentifier(), getOid() and getDescription().

I would like do the rest i.e. attaching the service to a project and then running it. If there is some demo code which I can use to do that then it will be very useful. It was easier in case of Option 2 to get to the stage I am now because of BIMvie.ws. I have read the following: #322 but if you can point me to a small demo program which I can use then it will save a lot time.

Also for option 2, if I can get an idea on how to resolve the 2 issues I mentioned then it will be great as I will be able to move to writing some code for service to do something meaningful. Thanks

@rubendel

This comment has been minimized.

Member

rubendel commented Jul 5, 2018

Why are you not using BIMvie.ws in your development environment? It works just as well as in the released version. You can simply use BIMvie.ws to attach your service to a project, but the advantage is that you also have debugging and even changing code (live) at your disposal. So in short, no code needed for that.

Then when your service (even if it's doing nothing) is working, I'd be happy to help with the next stage, it just doesn't make sense to try and identify the problem if I don't know if it's working in development mode.

@azOn2018

This comment has been minimized.

azOn2018 commented Jul 6, 2018

Actually I did include BIMvie.ws by using -plugins "....." in the Program arguments for LocalDevBimServerStarter. I didn't get an error when I ran LocalDevBimServerStarter i.e. BIMserver successfully started. I then opened http://localhost:8080 in a web browser and on the page clicked on bimviews under the Web Modules section. This brought the following http://localhost:8080/apps/bimviews/ page but with 'Loading BIMviews...' message. I have looked at the console in the browser which showed the attached error.
bimviews-error

I am sure there must be a very easy fix to this issue but because the documentation and forum covers different versions, it's easy to get confused and loose time. Can you please point me in the right direction. Thanks

@rubendel

This comment has been minimized.

Member

rubendel commented Jul 6, 2018

You also need BIMsurfer (v1) and the BimServerJavaScriptApi. A list of typical plugins you might want/need is listed here: https://github.com/opensourceBIM/BIMserver/wiki/Eclipse#adding-the-plugins-property

@azOn2018

This comment has been minimized.

azOn2018 commented Jul 9, 2018

Both BIMsurfer (actually V2) and BimServerJavaScriptApi are included. Note: I'm currently using BIMserver v1.5.89 in development environment and I basically tried to follow the instructions on https://github.com/opensourceBIM/BIMserver/wiki/Eclipse#adding-the-plugins-property when I did the setup, etc previously. When I open http://localhost:8080 in a web browser, I get the following (screen shot attached):
bimserver-v1 5 89-onlocalhost

BIMsurfer v2 page looks ok, see the screen shot:
bimsurfer-plugin

Same goes for BimServerJavaScriptApi, see the screen shot:
bimserver-js-api

However, I get 'Loading BIMviews...' message for BIMvie.ws as mentioned previously.

@rubendel

This comment has been minimized.

Member

rubendel commented Jul 9, 2018

"You also need BIMsurfer (v1)"

@azOn2018

This comment has been minimized.

azOn2018 commented Jul 9, 2018

Sorry I am a bit confused with your reply. I included BIMsurfer v2 and the page looked fine which means it was installed ok. Any particular reason why I need an older version of BIMsurfer i.e. v1? Can you please indicate which one is version 1 on the following page? https://github.com/opensourceBIM/BIMsurfer/releases

@rubendel

This comment has been minimized.

Member

rubendel commented Jul 9, 2018

If you are loading from code, just the V1 branch (https://github.com/opensourceBIM/BIMsurfer/tree/V1). If you are installing from maven, there only is a BIMsurfer V1 release, the latest is this one: https://oss.sonatype.org/content/groups/public/org/opensourcebim/bimsurfer/0.0.43/

@rubendel

This comment has been minimized.

Member

rubendel commented Jul 9, 2018

BIMvie.ws has never been updated to work with BIMsurfer V2 as I never felt it had surpassed V1 in features and stability.

@azOn2018

This comment has been minimized.

azOn2018 commented Jul 10, 2018

OK first I tried with BIMsurfer V1 based on your suggestion with BIMserver v1.5.89-SNAPSHOT in Eclipse but had the same problem with BIMvie.ws. I then decided to do a sort of clean up and go for the latest version of BIMserver i.e. v1.5.103-SNAPSHOT. Briefly, in Eclipse I started LocalDevBimServerStarter by including three plugins [bimvie.ws ( https://github.com/opensourceBIM/bimvie.ws ), BIMsurfer ( https://github.com/opensourceBIM/BIMsurfer/tree/V1 ) and JavaScript-API ( https://github.com/opensourceBIM/BIMserver-JavaScript-API) ] in 'Arguments'.

The BIMserver started OK as you can see from this screen shot.

bimserver-startedineclipse

I then opened up localhost:8080 in a web browser (Firefox 60.0.1). See the screen shot:

bimserver-localhost8080

When I clicked on BIMviews, the following page came up (I opened web console to see for any errors/warnings - please see the errors which came up):

bimviews-errors

For BIMsurfer, the following page came up:

bimsurfer-screen

When I clicked on the 'Basic viewer' link under the Examples, the login input came up but it didn't work (see the screen shot with error messages shown on the console):

bimsurfer-error

The JavaScript API page looks ok (see the screen shot):

bimserver-js-api-screenshot

Unfortunately I am stuck with these setup/config issues and unable to make progress. I don't know what can I do to fix these frustrating problems. Any more suggestion please? Thanks

@rubendel

This comment has been minimized.

Member

rubendel commented Jul 10, 2018

This looks like Firefox, only Chrome is supported/tested on. I understand that is annoying, but since BIMvie.ws is only meant for developers I don't think it is an unreasonable requirement.

@hlg

This comment has been minimized.

Member

hlg commented Jul 11, 2018

I managed to use Firefox with LocalDevBimServerStarter. But I load only those plugins that I am actually developing from local folders. Everything else (bimview.ws, Javascript API etc.) I install from Maven. This way I don't have to bother with the build process of other plugins. However I observed that local plugins get loaded only with a substantial delay (#777). Maybe this is a drawback related to this specific setup.

@azOn2018

This comment has been minimized.

azOn2018 commented Jul 11, 2018

I have tested this is Chrome as well but errors are there. Please note the following:
Chrome v67.0.3396.99 by running LocalDevBimServerStarter from Eclipse (BimServer v1.5.103-SNAPSHOT) and including three plugins using -plugins in Arguments: bimviews-0.0.106, bimsurfer-0.0.43 and BIMserver-JavaScript-API.

Please see below the attached screenshots of the errors I am getting:

inchrome-bimviews-0 0 106-error

inchrome-bimsurfer-0 0 43-error-

@azOn2018

This comment has been minimized.

azOn2018 commented Jul 12, 2018

OK finally some luck. I decided to clean up and did the following:
For three plugins i.e. BIMvie.ws, BIMsurfer and Javascript API , I did clone the git repository and import the projects. Then copy the location on disk and add them using "-plugins" argument.

I then started LocalDevBimServerStarter and able to use bimvie.ws this time. See the screen shot:

installed-plugins-devbimserver-bimvie ws

The BIMsurfer has the same issue with Example 1 as before.

I then tested installing the plugin I am developing using -plugins argument as well as by selecting the .jar file of the plugin through bimvie.ws interface. I was able to install it but unable to test it because the original issues I highlighted (e.g Profile option not available) are also there in the bimserver development mode as well. So any suggestion to resolve these issues? at least I am in the same situation for two different modes of BIMserver.

@azOn2018

This comment has been minimized.

azOn2018 commented Jul 19, 2018

I managed to fix the profile option not available issue several days ago and now mentioning this here in case someone else had a similar problem. I compared the code of two different plug-ins and found that by replacing serviceDescriptor.setIdentifier(getClass().getName()); with serviceDescriptor.setIdentifier("" + internalService.getOid()); in the register method actually fixed the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment