Anyone did moqui-cups with docker ?
what is the “serverhost” for docker instance(moqui.local)?
(Note)
for host machine
serverHost - localhost
serverPort - 631
Anyone did moqui-cups with docker ?
what is the “serverhost” for docker instance(moqui.local)?
(Note)
for host machine
serverHost - localhost
serverPort - 631
It looks like it would just be localhost or 127.0.0.1 or whatever the server machine can access on the network:
I’m curious what you’re using this for
Yeah correct,
but called this service
from docker instance(moqui1.local) serverhost as localhost or 127.0.01 it throwing an exception
<service verb="get" noun="ServerPrinters">
<!-- org.moqui.impl.PrintServices.get#ServerPrinters -->
<description>Get printers from print server and create a moqui.basic.print.NetworkPrinter record for each.</description>
<in-parameters>
<parameter name="serverHost" required="true"/>
<parameter name="serverPort" type="Integer" default="631"/>
</in-parameters>
<out-parameters>
<parameter name="networkPrinterIdList" type="List"><parameter name="networkPrinterId"/></parameter>
</out-parameters>
<actions>
<set field="networkPrinterIdList" from="[]"/>
<!-- lookup existing printers for this server, don't create them again but include them in the result -->
<set field="printerNameSet" from="new HashSet()"/>
<entity-find entity-name="moqui.basic.print.NetworkPrinter" list="networkPrinterList">
<econdition field-name="serverHost"/><econdition field-name="serverPort"/></entity-find>
<iterate list="networkPrinterList" entry="networkPrinter">
<script>networkPrinterIdList.add(networkPrinter.networkPrinterId)</script>
<script>printerNameSet.add(networkPrinter.printerName)</script>
</iterate>
<set field="cupsClient" from="new org.cups4j.CupsClient(serverHost, serverPort)"/>
<set field="printerList" from="cupsClient.getPrinters()"/>
<iterate list="printerList" entry="cupsPrinter">
<if condition="!printerNameSet.contains(cupsPrinter.getName())">
<service-call name="create#moqui.basic.print.NetworkPrinter" out-map="npOut"
in-map="[serverHost:serverHost, serverPort:serverPort, printerName:cupsPrinter.getName(),
description:cupsPrinter.getDescription(), location:cupsPrinter.getLocation()]"/>
<script>networkPrinterIdList.add(npOut.networkPrinterId)</script>
</if>
</iterate>
</actions>
</service>
that exception
21:49:05.848 ERROR p26970580-26 o.moqui.i.a.XmlAction Error running groovy script (org.apache.http.conn.HttpHostConnectException: Connect to localhost:631 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused)):
1 : import static org.moqui.util.ObjectUtilities.*
2 : import static org.moqui.util.CollectionUtilities.*
3 : import static org.moqui.util.StringUtilities.*
4 : import java.sql.Timestamp
5 : import java.sql.Time
6 : import java.time.*
7 : // these are in the context by default: ExecutionContext ec, Map<String, Object> context, Map<String, Object> result
8 : networkPrinterIdList = ([])
9 : printerNameSet = (new HashSet())
10 : networkPrinterList_xafind = ec.entity.find("moqui.basic.print.NetworkPrinter")
11 : .condition((org.moqui.entity.EntityCondition) ec.entity.conditionFactory.makeActionConditionDirect("serverHost", "equals", serverHost, null, null, false, false, false, "false")).condition((org.moqui.entity.EntityCondition) ec.entity.conditionFactory.makeActionConditionDirect("serverPort", "equals", serverPort, null, null, false, false, false, "false"))
12 : networkPrinterList = networkPrinterList_xafind.list()
13 : if (true) {
14 : int networkPrinter_index = 0
15 : Iterator _networkPrinterIterator = networkPrinterList.iterator()
16 : // behave differently for EntityListIterator, avoid using hasNext()
17 : boolean networkPrinterIsEli = (_networkPrinterIterator instanceof org.moqui.entity.EntityListIterator)
18 : while (networkPrinterIsEli || _networkPrinterIterator.hasNext()) {
19 : networkPrinter = _networkPrinterIterator.next()
20 : if (networkPrinterIsEli && networkPrinter == null) break
21 : if (!networkPrinterIsEli) networkPrinter_has_next = _networkPrinterIterator.hasNext()
22 :
23 : // begin iterator internal block
24 :
25 : // begin inline script
26 : networkPrinterIdList.add(networkPrinter.networkPrinterId)
27 : // end inline script
28 :
29 : // begin inline script
30 : printerNameSet.add(networkPrinter.printerName)
31 : // end inline script
32 : // end iterator internal block for list networkPrinterList
33 :
34 : networkPrinter_index++
35 : }
36 : if(networkPrinterIsEli) _networkPrinterIterator.close()
37 : }
38 : cupsClient = (new org.cups4j.CupsClient(serverHost, serverPort))
39 : ec.logger.log("info", """cupsClient---${cupsClient}""", null)
40 : ec.logger.log("debug", """cupsClient---${cupsClient}""", null)
41 : printerList = (cupsClient.getPrinters())
42 : ec.logger.log("debug", """printerList---${printerList}""", null)
43 : ec.logger.log("info", """printerList---${printerList}""", null)
44 : if (true) {
45 : int cupsPrinter_index = 0
46 : Iterator _cupsPrinterIterator = printerList.iterator()
47 : // behave differently for EntityListIterator, avoid using hasNext()
48 : boolean cupsPrinterIsEli = (_cupsPrinterIterator instanceof org.moqui.entity.EntityListIterator)
49 : while (cupsPrinterIsEli || _cupsPrinterIterator.hasNext()) {
50 : cupsPrinter = _cupsPrinterIterator.next()
51 : if (cupsPrinterIsEli && cupsPrinter == null) break
52 : if (!cupsPrinterIsEli) cupsPrinter_has_next = _cupsPrinterIterator.hasNext()
53 :
54 : // begin iterator internal block
55 : if (!printerNameSet.contains(cupsPrinter.getName())) {
56 : if (true) {
57 : def call_service_result = ec.service.sync().name("create#moqui.basic.print.NetworkPrinter")
58 : .parameters([serverHost:serverHost, serverPort:serverPort, printerName:cupsPrinter.getName(), description:cupsPrinter.getDescription(), location:cupsPrinter.getLocation()]).call()
59 : if (npOut != null) { if (call_service_result) npOut.putAll(call_service_result) } else { npOut = call_service_result }
60 : if (ec.message.hasError()) return
61 : }
62 :
63 : // begin inline script
64 : networkPrinterIdList.add(npOut.networkPrinterId)
65 : // end inline script
66 : }
67 :
68 : // end iterator internal block for list printerList
69 :
70 : cupsPrinter_index++
71 : }
72 : if(cupsPrinterIsEli) _cupsPrinterIterator.close()
73 : }
74 : // make sure the last statement is not considered the return value
75 : return;
21:49:05.849 WARN p26970580-26 o.moqui.i.c.TransactionFacadeImpl Transaction rollback. The rollback was originally caused by: Error running service org.moqui.impl.PrintServices.get#ServerPrinters (Throwable)
org.apache.http.conn.HttpHostConnectException: Connect to localhost:631 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:220) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139) ~[httpclient-4.5.2.jar:4.5.2]
at org.cups4j.operations.IppOperation.sendRequest(IppOperation.java:218) ~[cups4j-0.7.6.jar:?]
at org.cups4j.operations.IppOperation.sendRequest(IppOperation.java:131) ~[cups4j-0.7.6.jar:?]
at org.cups4j.operations.IppOperation.request(IppOperation.java:67) ~[cups4j-0.7.6.jar:?]
at org.cups4j.operations.cups.CupsGetPrintersOperation.getPrinters(CupsGetPrintersOperation.java:56) ~[cups4j-0.7.6.jar:?]
at org.cups4j.CupsClient.getPrinters(CupsClient.java:106) ~[cups4j-0.7.6.jar:?]
at org_moqui_impl_PrintServices_get_ServerPrinters.run(org_moqui_impl_PrintServices_get_ServerPrinters:41) ~[?:?]
at org.moqui.impl.actions.XmlAction.run(XmlAction.java:67) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.service.runner.InlineServiceRunner.runService(InlineServiceRunner.java:59) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.service.ServiceCallSyncImpl.callSingle(ServiceCallSyncImpl.java:322) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.service.ServiceCallSyncImpl.call(ServiceCallSyncImpl.java:125) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at component___tools_screen_Tools_Service_ServiceRun_xml_transition_run_actions.run(component___tools_screen_Tools_Service_ServiceRun_xml_transition_run_actions:11) ~[?:?]
at org.moqui.impl.actions.XmlAction.run(XmlAction.java:67) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenDefinition$TransitionItem.run(ScreenDefinition.groovy:988) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:749) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:745) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:745) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:745) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:745) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.internalRender(ScreenRenderImpl.groovy:454) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.render(ScreenRenderImpl.groovy:170) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.webapp.MoquiServlet.service(MoquiServlet.groovy:118) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:590) ~[jetty-servlet-api-4.0.6.jar:?]
at org.moqui.impl.webapp.ElasticRequestLogFilter.doFilter(ElasticRequestLogFilter.groovy:96) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at java.lang.Thread.run(Thread.java:829) ~[?:?]
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[?:?]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[?:?]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[?:?]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
at java.net.Socket.connect(Socket.java:609) ~[?:?]
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141) ~[httpclient-4.5.2.jar:4.5.2]
... 35 more
21:49:05.853 WARN p26970580-26 o.moqui.i.c.TransactionFacadeImpl Transaction rollback for [Error running service org.moqui.impl.PrintServices.get#ServerPrinters (Throwable)]. Here is the current location:
org.moqui.BaseException: Rollback location
at org.moqui.impl.context.TransactionFacadeImpl.rollback(TransactionFacadeImpl.groovy:472) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.context.TransactionFacadeImpl.rollback(TransactionFacadeImpl.groovy:447) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.service.ServiceCallSyncImpl.callSingle(ServiceCallSyncImpl.java:347) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.service.ServiceCallSyncImpl.call(ServiceCallSyncImpl.java:125) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at component___tools_screen_Tools_Service_ServiceRun_xml_transition_run_actions.run(component___tools_screen_Tools_Service_ServiceRun_xml_transition_run_actions:11) ~[?:?]
at org.moqui.impl.actions.XmlAction.run(XmlAction.java:67) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenDefinition$TransitionItem.run(ScreenDefinition.groovy:988) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:749) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:745) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:745) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:745) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:745) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.internalRender(ScreenRenderImpl.groovy:454) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.render(ScreenRenderImpl.groovy:170) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.webapp.MoquiServlet.service(MoquiServlet.groovy:118) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:590) ~[jetty-servlet-api-4.0.6.jar:?]
at org.moqui.impl.webapp.ElasticRequestLogFilter.doFilter(ElasticRequestLogFilter.groovy:96) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at java.lang.Thread.run(Thread.java:829) ~[?:?]
21:49:05.855 WARN p26970580-26 o.moqui.i.s.ServiceCallSyncImpl Error running service org.moqui.impl.PrintServices.get#ServerPrinters (Throwable) Artifact stack: org.moqui.impl.PrintServices.get#ServerPrinters, component://tools/screen/Tools/Service/ServiceRun.xml/run, component://tools/screen/Tools/Service/ServiceRun.xml, component://tools/screen/Tools/Service.xml, component://tools/screen/Tools.xml, component://webroot/screen/webroot/apps.xml, component://webroot/screen/webroot.xml
org.apache.http.conn.HttpHostConnectException: Connect to localhost:631 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:220) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139) ~[httpclient-4.5.2.jar:4.5.2]
at org.cups4j.operations.IppOperation.sendRequest(IppOperation.java:218) ~[cups4j-0.7.6.jar:?]
at org.cups4j.operations.IppOperation.sendRequest(IppOperation.java:131) ~[cups4j-0.7.6.jar:?]
at org.cups4j.operations.IppOperation.request(IppOperation.java:67) ~[cups4j-0.7.6.jar:?]
at org.cups4j.operations.cups.CupsGetPrintersOperation.getPrinters(CupsGetPrintersOperation.java:56) ~[cups4j-0.7.6.jar:?]
at org.cups4j.CupsClient.getPrinters(CupsClient.java:106) ~[cups4j-0.7.6.jar:?]
at org_moqui_impl_PrintServices_get_ServerPrinters.run(org_moqui_impl_PrintServices_get_ServerPrinters:41) ~[?:?]
at org.moqui.impl.actions.XmlAction.run(XmlAction.java:67) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.service.runner.InlineServiceRunner.runService(InlineServiceRunner.java:59) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.service.ServiceCallSyncImpl.callSingle(ServiceCallSyncImpl.java:322) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.service.ServiceCallSyncImpl.call(ServiceCallSyncImpl.java:125) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at component___tools_screen_Tools_Service_ServiceRun_xml_transition_run_actions.run(component___tools_screen_Tools_Service_ServiceRun_xml_transition_run_actions:11) ~[?:?]
at org.moqui.impl.actions.XmlAction.run(XmlAction.java:67) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenDefinition$TransitionItem.run(ScreenDefinition.groovy:988) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:749) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:745) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:745) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:745) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:745) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.internalRender(ScreenRenderImpl.groovy:454) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.screen.ScreenRenderImpl.render(ScreenRenderImpl.groovy:170) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at org.moqui.impl.webapp.MoquiServlet.service(MoquiServlet.groovy:118) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:590) ~[jetty-servlet-api-4.0.6.jar:?]
at org.moqui.impl.webapp.ElasticRequestLogFilter.doFilter(ElasticRequestLogFilter.groovy:96) ~[moqui-framework-3.1.0-rc1.jar:3.1.0-rc1]
at java.lang.Thread.run(Thread.java:829) ~[?:?]
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[?:?]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[?:?]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[?:?]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
at java.net.Socket.connect(Socket.java:609) ~[?:?]
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74) ~[httpclient-4.5.2.jar:4.5.2]
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141) ~[httpclient-4.5.2.jar:4.5.2]
... 35 more
21:49:05.856 ERROR p26970580-26 o.moqui.i.c.MessageFacadeImpl Connect to localhost:631 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused)
21:49:05.856 ERROR p26970580-26 o.moqui.i.c.MessageFacadeImpl Connection refused (Connection refused)
Hi @Michael, I am from Integrin. We are currently integrating Moqui-CUPS into our project as per the requirements, and we are trying to build the project are in Docker instance.
CUPS is a network protocol for printing. There needs to be a CUPS server running with a server attached to use it for printing.
If I run
$ nmap localhost
Starting Nmap 7.92 ( https://nmap.org ) at 2024-08-30 12:27 MDT
Nmap scan report for localhost (127.0.0.1)
...
PORT STATE SERVICE
631/tcp open ipp
Nmap done: 1 IP address (1 host up) scanned in 0.09 seconds
The port 631 on localhost is open on my development machine.
If I go to http://localhost:631, I get the following.
Then if I run Moqui with moqui-cups
installed and run the get#ServerPrinters
service, I get the printers configured in cups:
When you build a server through docker and deploy it, you must have a cups service running on the server that the docker moqui instance can run, and that cups server must have access to the printers that you need to use. You can’t just run one of the off the shelf Docker compose / moqui Docker images and expect CUPS to work. You could modify the existing Moqui docker file to run a cups service (probably easiest). The current Moqui Docker file in docker/simple
uses ubuntu: https://hub.docker.com/layers/library/eclipse-temurin/11-jdk/images/sha256-62f1d44e387778699855a7e54ba00195fc275375c8d55d37148903fe0b93f9bc?context=explore, so you can install cups and you should be on your way. Or if you’re running multiple Moqui instances / want to follow microservice best practices you could use something like: GitHub - anujdatar/cups-docker: CUPS server running in a docker container.
Keep in mind I have no idea what you’re printing for. Using CUPS is most often not the most convenient way to setup printers especially for anything close to a SaaS product. If you need to have the customer’s client print out a document or have a workstation used for shipping, I recommend using QZ Tray (setup). QZ Tray requires the client to download the QZ Tray desktop application, but it will connect to printers on the customer’s client side. It’s at least worth looking into for printing.