|
Sweet Home 3D Forum » List all forums » » Forum: Developers » » » Thread: SweetHome3DJS - Porting plugin - ARM architecture support |
|
| Print at Dec 19, 2025, 3:13:54 AM | |
| Posted by adizanni at Feb 16, 2024, 4:25:40 PM |
|
SweetHome3DJS - Porting plugin - ARM architecture support Hello, I managed to port my SweetHome3D plugin to a personal custom web site based on SweetHome3DJS. As my plugin is based on a modified OBJWriter to preserve the object names across exports, I need to import the J3D libraries. I have noticed that J3D libraries come with some binaries and I did not find binaries compiled for ARM architecture. My Web Site will run as an add-on to Home Assistant: most of the users are running home assistant on ARM architectures (raspberry and similar). Is there a way to have those libraries in armv7 or armv8 architectures ? I will soon post my source in GitHub. Thanks in advance for the support Andrea |
| Posted by Puybaret at Feb 16, 2024, 5:52:56 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support You’ll find the libraries in the JAR files at https://jogamp.org/deployment/jogamp-current/jar/ Pick up the files prefixed by gluegen-rt-natives and jogl-all-natives, probably gluegen-rt-natives-linux-armv6hf.jar and jogl-all-natives-linux-armv6hf.jar. ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by Puybaret at Feb 16, 2024, 5:58:47 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support By the way, you should choose a license for your plug-in project. If you plan to distribute it along with Sweet Home 3D in the same package, it should be under GNU GPL, otherwise if you distribute it separately, any license will be ok. ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by adizanni at Feb 16, 2024, 6:42:28 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Thanks, I'll test. Added a GNU-GPL license file to the github repository for the plugin (it contains the SweetHome3d portable jar). I will do the same for the Home Assistant add-on |
| Posted by Puybaret at Feb 16, 2024, 7:28:56 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Don’t hesitate to ask questions if needed. If all goes well and you want to run Sweet Home 3D from a JAR executable file, you should have to update SweetHome3DBootstrap class and jarExecutable target in build.xml file. ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by adizanni at Feb 16, 2024, 7:59:47 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support I have the impression that those libraries require a desktop environment: Root Cause is the lack of a X!! Display, but the libraries will have to run headless in a server like environment inside a container. Type Exception Report Message An exception occurred processing [/exportToHA.jsp] at line [89] Description The server encountered an unexpected condition that prevented it from fulfilling the request. Exception org.apache.jasper.JasperException: An exception occurred processing [/exportToHA.jsp] at line [89] 86: } 87: } 88: 89: BranchGroup root = new BranchGroup(); 90: Object3DBranchFactory objectFactory = new Object3DBranchFactory(); 91: 92: // Add 3D ground, walls, rooms and labels Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:610) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:489) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328) jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) Root Cause jakarta.servlet.ServletException: java.lang.ExceptionInInitializerError org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:667) org.apache.jsp.exportToHA_jsp._jspService(exportToHA_jsp.java:383) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328) jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) Root Cause java.lang.ExceptionInInitializerError javax.media.j3d.GroupRetained.<init>(GroupRetained.java:155) javax.media.j3d.BranchGroupRetained.<init>(BranchGroupRetained.java:50) javax.media.j3d.BranchGroup.createRetained(BranchGroup.java:72) javax.media.j3d.SceneGraphObject.<init>(SceneGraphObject.java:114) javax.media.j3d.Node.<init>(Node.java:172) javax.media.j3d.Group.<init>(Group.java:551) javax.media.j3d.BranchGroup.<init>(BranchGroup.java:63) org.apache.jsp.exportToHA_jsp._jspService(exportToHA_jsp.java:278) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328) jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) Root Cause java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it. javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:854) javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:267) javax.media.j3d.GroupRetained.<init>(GroupRetained.java:155) javax.media.j3d.BranchGroupRetained.<init>(BranchGroupRetained.java:50) javax.media.j3d.BranchGroup.createRetained(BranchGroup.java:72) javax.media.j3d.SceneGraphObject.<init>(SceneGraphObject.java:114) javax.media.j3d.Node.<init>(Node.java:172) javax.media.j3d.Group.<init>(Group.java:551) javax.media.j3d.BranchGroup.<init>(BranchGroup.java:63) org.apache.jsp.exportToHA_jsp._jspService(exportToHA_jsp.java:278) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328) jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) Note The full stack trace of the root cause is available in the server logs. |
| Posted by adizanni at Feb 16, 2024, 8:18:33 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support To explain better what I'm doing:
I was assuming that the SweetHome3D could run headless. It seems that the Home class and Homerecorder class can run headless, but as soon as I reference the J3D class, the exception is raised for lack of a display. This is a pity as I only use J3D to serialize the home into Waterfront format (based on a modified ObjWriter class). This is an operation that wouldn't require any visualization. |
| Posted by adizanni at Feb 16, 2024, 8:42:17 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support I've tried to do it using the jogl-noawt library, same error. Then I stumbled across this forum thread: https://forum.jogamp.org/Java3D-in-batch-mode-td4039415.html And this seems pretty much a final word: my idea is not feasible. I think that your effort to keep the code within a MVC model is nullified by an external library. Maybe I can port the OBJWriter to JavaScript but this is kind of another size.... |
| Posted by Puybaret at Feb 16, 2024, 9:08:23 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Sweet Home 3D can run headless if you set the Java property java.awt.headless to true (which is probably the default value in Tomcat) and set the Java property j3d.rend to noop. You may even need no library in that case but I’m not sure. ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by adizanni at Feb 16, 2024, 10:01:54 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Thanks again. It worked. When I will be more stable I will test it without ogl and gluegen libraries.... |
| Posted by adizanni at Feb 18, 2024, 12:12:53 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Always related to this project. I think that I got from other posts that the JSP code is only compatible with JAVA 1.8. When I tried JAVA 21 I found only one problem: Unable to make field protected static final java.lang.String javax.swing.undo.AbstractUndoableEdit.UndoName accessible: module java.desktop does not "opens javax.swing.undo" to unnamed module @1cc19e8a in the WriteHomeEdits.jsp file. Even following all stackoverflow suggestions to change some JVM parameters and allow reflect action, it does not work. I have a problem with the fact to stay in 1.8: I'm packaging a container with tomcat and jdk, the only based image still supporting 1.8 is quite outdated and brings a lot of vulnerabilities. Is there any workaround to make your code compatible with recent versions of Java ? (or maybe it is already but I'm doing the things wrong). I Thanks in advance for your support. Andrea |
| Posted by adizanni at Feb 18, 2024, 1:57:36 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support By the way, this is the link to the Home Assistant addon repository with the customized WAR: https://github.com/adizanni/sh3d-ha. I will soon publish the WAR project behind to make the code visible. |
| Posted by Puybaret at Feb 18, 2024, 6:33:57 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Being compatible with Java 1.8 doesn't mean it won't work with further versions. sweethome3d.com JSP server works with Java 11 and you can probably fix your issue by setting the right --add-opens JVM option (try --add-opens=java.desktop/javax.swing.undo=ALL-UNNAMED). ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by adizanni at Feb 18, 2024, 8:52:37 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Again thanks, I did not know what was the class to apply the ALL-UNNAMED even if the error was saying all. You are debugging my project almost line by line :). I've not yet donated for your project but I'm going to do it now. Hope that my projects are a little contribution to enlarge your community. Merci Encore. Andrea |
| Posted by Puybaret at Feb 19, 2024, 1:54:08 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Translating the Java error you reported to the right Java option is not straightforward and I had to make some searches me too. Thanks for your donation Andrea ![]() ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by adizanni at Feb 19, 2024, 8:54:32 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Hello, it was not a lot of money but unfortunately I'm not rich, hope that I bring you new donations via my project.... I have another problem/question. I kind of understood that whenever the model brings new resources (furniture, textures, etc), you save those to the lib/resources library using the WriteResource jsp, is it correct ? As I'm packaging the webapp in a docker environment whenever I recreate the image the resources get lost. I have to find a way to save them outside the webapp folder (as I do for the saved models and the exports). Are you interested in having a docker image for SweetHome3D ? I know this was not in your initial vision, but now the libraries are in the public domain so it could be a plus..... I can study a way to industrialize the deployment each time you have a new version. Just an idea. Andrea. |
| Posted by Puybaret at Feb 20, 2024, 11:35:05 AM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support You should adapt to your needs the parameters writeResourceURL and readResourceURL in SweetHome3DJSApplication initialization. These parameters and other ones with a URL can be equal to the URLs of your choice to customize the services which manage the storage of homes, resources and preferences. These services may store resources in a folder different from userResources in the web space of the server. It may depend on the logged user and use a database for example. This is the case for Sweet Home 3D Online version. If you look at the source code of SweetHome3DJSOnline.jsp displayed when you edit a home in the Online version, you'll see that SweetHome3DJSOnlineApplication, a subclass of SweetHome3DJSApplication, is initialized with parameters different from the version in SweetHome3DJS public code. Thanks for proposing a docker image, but I prefer not to make the delivery of Sweet Home 3D new versions more complex at this time. Creating this image could be automated in a script but the result must always be checked manually, and I don't want to make the delivery checking time last longer. But feel free to program it in your project. ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by adizanni at Feb 20, 2024, 11:09:23 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Thanks again: for the persistency architecture I will need to dedicate more time, for the moment I'm resolving with a "not so clean" folder linking. Of course these are mainly solution that will stay local, protected by the home network, but I prefer not to open breaches and vulnerabilities, as much as possible. This brings me to another question, home assistant can shield the add-ons using an internal proxy that rewrite the URLs. All the portal jsp pages are properly rewritten but when I open the sweethome.jsp it seems that all server calls are not getting rewritten and target the original URLs. It is a complex problem, I'm not expecting an answer or an analysis from your side; maybe you have already stumbled upon the issue and got a solution. The rewritten leading URL parts are passed on by the proxy via a header field. I have another question related to your previous answer: how can the end user load additional furnitures and object to the catalogue ? There seem to be no function to achieve that, there is one to import texture though. Thanks in advance for your support. Andrea. |
| Posted by Puybaret at Feb 22, 2024, 2:29:47 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support I'm not sure at all but did you set the URL base used at different places in application initialization, so it correctly indicates the redirection you mentioned? Even though I found a way to import a 3D model in the Mobile version using existing code, importing additional furniture is not completely programmed. The Import furniture wizard and saving imported furniture in preferences is missing in current version. ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by adizanni at Feb 24, 2024, 10:57:50 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Hello Emmanuel, I've spent significant time but I could no make SweetHome3DJS to work behind a Proxy: there are many places where URL are configured for WriteHomeEdidts, userPreferences, etc. I have the impression that, sometimes the URLs are used in the frontend (those require the URL rewrite to reach the proxy), sometimes they are used in the backend (those cannot go through the proxy which is out of reach of the tomcat server). Result, when I rewrite with proxy URLs, I break something in the backend, when I rewrite with tomcat URLs, I break something in the frontend. I have tried many combinations of things that I can do in the JSP, but I have no control on the Javascript and on the Java libraries (recorders, user preferences management, etc.), so I have abandoned. If you have any ideas, they are welcome. Andrea |
| Posted by adizanni at Feb 26, 2024, 6:07:07 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support I think I'm narrowing in the problem. The URL are not really a problem, I set the external URLs for the JavaScript interaction in the index.jsp and I set internal URLs for the call to the backend classes (ServerUserPreferences and HomeRecorder) the problem is the session. You store the reference to the file being opened in a session variable. I see that behind the proxy, the sessionid is renewed at every call and the session variable is destroyed, so the WriteHomeEdits script assumes that the Home file was never opened in the first place. I will explore the possibility to create a custom session manager...... |
| Posted by Puybaret at Feb 27, 2024, 5:49:31 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support You may use application instead of session in readHome.jsp, writeHomeEdits.jsp and closeHome.jsp. It's used to store the reference copy of the edited file, so there's no risk that some conflicts happen here. But if there's more than a user in your application, you'll have to manage session somewhere in case you don't want a user to edit the files of other users. ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by adizanni at Feb 27, 2024, 10:20:42 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Hello Emmanuel, thanks it is a good idea, of course it would be more elegant to have a custom session, but this would take a serious amount of effort. Nevertheless by putting application instead of session, I'm back to my previous issue. There is something in this code that brings up to javascripts the URLs: serverUserPreferences = new ServerUserPreferences(This is where there is a mix of server bound calls and client bounds calls that are using the newly crafted URLs. If I use server URLs (http://localhost....) the server classes are working fine but they somehow pass on the URL to Javascript, in the console I see this error message: Failed to load resource: net::ERR_CONNECTION_REFUSED which is normal because the client do not "see" localhost. If I use the regular URLs (http://PROXY_IP/PROXY_CONTEXT, the server classes will fail because they do not "see" the proxy. So the classes that you have created to support SH3DJS are breaking proxy compatibility. Sorry for the long post and thanks again for dedicating some time to my idea..... |
| Posted by Puybaret at Feb 28, 2024, 10:31:16 AM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support In your case, you should set serverUserPreferences to null. User preferences on server side are useful to reduce the size of the saved SH3D file, by replacing the furniture and textures stored in a SH3D file by URLs if they exist in the preferences catalogs too. This is the case in HomeTest.sh3d where you'll see that the size is smaller after the first call to writeHomeEdits.jsp, because it contains some furniture of the default catalogs (but also some furniture and textures not found in it). But keeping a larger SH3D file on the server is not an issue, it will be just more data to send to the client when reading the home it contains. Anyway, if the designed home is built from scratch on the server which is probably what you want to propose, the Home.xml entry in its SH3D file will contain only URLs and will be as small as possible. ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by adizanni at Feb 28, 2024, 11:03:03 AM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Ok, yes the purpose is to get rid of the Fat Java client for the card users in Home Assistant; I do not see as a big problem to have bigger SH3D files (even though the load will be slower as no furniture library can be cached in the browser). On the other hand I need to enlarge the default Furniture Catalog otherwise users will always need to do the first Home build in the Fat Java Client. I did not get your comment on Home.xml but I am still learning on the architecture of SH3D..... |
| Posted by Puybaret at Feb 28, 2024, 5:42:13 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support A SH3D file is actually a ZIP file containing texture images, furniture 3D models and icons, as well as an entry named Home.xml which describes the designed home respecting this DTD. If you look at an example of Home.xml, you'll see that the model, icon and image attributes are equal to a number matching another entry in the SH3D file or a URL matching data on the server. You'll find here instructions about how to add more furniture and textures libraries to the catalogs using the tool PropertiesToJson. Note that you can obtain also a JSON version of an existing SH3F or SH3T library file with the version 2.0 of the Furniture Library Editor and Textures Library Editor if you save it as a file ending by .json. This is easier than using PropertiesToJson but you'll probably have to change furnitureResourcesURLBase and texturesResourcesURLBase in application configuration (or adapt the relative URLs of icon#, model# and image# properties in generated JSON files). ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by adizanni at Mar 2, 2024, 3:27:49 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Hello Emmanuel, I do not know if it is related, but according to your description, probably yes. By putting the ServerUserPreference to null, it works (even behind the proxy), but, the performances to load a complex model (10-20Mb) are seriously degraded. In fact your idea to have the furniture managed with independent files is very efficient and takes advantage of the browser cache. I wonder if you can think of a way (in your next releases) to have the serverUserPreferences to work well behing a proxy, by separating the backend URLs and the frontend-URLs. Maybe it is already the case as the Server class accepts 2 couples of URLs, but I could not figure it out |
| Posted by adizanni at May 5, 2024, 10:29:23 PM |
|
Re: SweetHome3DJS - Porting plugin - ARM architecture support Hello Emmanuel, not sure if there was an acknowledgment from your side of an issue with making your ServerUserPreferences library work behind a proxy. My last assessment was that, when working behind a proxy, if you pass to ServerUserPreferences constructor:
In my opinion it should be up to the JavaScript library to calculate the URL based on relative positioning of the resources. Do you acknowledge the problem ? Have you done any modification for v7.3 ? Not seen any reference about this problem in the release notes. |
|
|
Current timezone is GMT Dec 19, 2025, 3:13:54 AM |