Skip to content
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

traci4matlab #5

Open
shuowang572875852 opened this issue Feb 22, 2019 · 8 comments
Open

traci4matlab #5

shuowang572875852 opened this issue Feb 22, 2019 · 8 comments

Comments

@shuowang572875852
Copy link

I installed the traci4matlab and the traci_test.m run successful. But run the inter_palmas_actuated.m ,the sumo log displays follows:

Loading configuration... done.
***Starting server on port 8813 ***
Loading net-file from './inter_palmas.net.xml'... done (3ms).
Loading additional-files from './../inter_palmas.poly.xml'... done (8ms).
Loading additional-files from './../inter_palmas_bus_stops.add.xml'... done (0ms).
Loading done.
Warning: The attribute departPos is no longer supported for walks, please use the person attribute, the arrivalPos of the previous step or explicit stops.
Warning: The attribute departPos is no longer supported for walks, please use the person attribute, the arrivalPos of the previous step or explicit stops.
Simulation started with time: 50400.00
Error: tcpip::Storage::readIsSafe: want to read 4 bytes from Storage, but only 3 remaining
Quitting (on error).

how can i do for it?
And i also run my own od2trips.m , the m-files as follows:

clear
close all
clc
import traci.constants
scenarioPath = 'D:\Program Files\matlab\R2017b\toolbox\traci4matlab\traci4matlab\examples\od2trips\shengzhen.sumocfg ';
system(['sumo-gui -c ' '"' scenarioPath '"' ' --remote-port 8813--start&']);
traci.init();

the matlab log displays :

error use traci.Socket/connect (line 25)
Java exception occurred:
java.net.ConnectException: Connection refused: connect

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at java.net.Socket.connect(Socket.java:538)

error matlab.internal.lang.fwdSubsref (line 4)
[varargout{1:nargout}] = subsref(A,s);

error traci.init (line 65)
connections(label).connect(host, port);

error od2trips (line 8)
traci.init();
error use traci.Socket/connect (line 25)
Java exception occurred:
java.net.ConnectException: Connection refused: connect

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at java.net.Socket.connect(Socket.java:538)

error matlab.internal.lang.fwdSubsref (line 4)
[varargout{1:nargout}] = subsref(A,s);

error traci.init (line 65)
connections(label).connect(host, port);

error od2trips (line 8)
traci.init();
error use traci.Socket/connect (line 25)
Java exception occurred:
java.net.ConnectException: Connection refused: connect

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at java.net.Socket.connect(Socket.java:538)

error matlab.internal.lang.fwdSubsref (line 4)
[varargout{1:nargout}] = subsref(A,s);

error traci.init (line 65)
connections(label).connect(host, port);

error od2trips (line 8)
traci.init();
error use traci.Socket/connect (line 25)
Java exception occurred:
java.net.ConnectException: Connection refused: connect

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at java.net.Socket.connect(Socket.java:538)

出错 matlab.internal.lang.fwdSubsref (line 4)
[varargout{1:nargout}] = subsref(A,s);

error traci.init (line 65)
connections(label).connect(host, port);

error od2trips (line 8)
traci.init();
error use traci.Socket/connect (line 25)
Java exception occurred:
java.net.ConnectException: Connection refused: connect

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at java.net.Socket.connect(Socket.java:538)

error matlab.internal.lang.fwdSubsref (line 4)
[varargout{1:nargout}] = subsref(A,s);

error traci.init (line 65)
connections(label).connect(host, port);

error od2trips (line 8)
traci.init();
error use traci.Socket/connect (line 25)
Java exception occurred:
java.net.ConnectException: Connection refused: connect

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at java.net.Socket.connect(Socket.java:538)

error matlab.internal.lang.fwdSubsref (line 4)
[varargout{1:nargout}] = subsref(A,s);

error traci.init (line 65)
connections(label).connect(host, port);

error od2trips (line 8)
traci.init();
error use traci.Socket/connect (line 25)
Java exception occurred:
java.net.ConnectException: Connection refused: connect

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at java.net.Socket.connect(Socket.java:538)

出错 matlab.internal.lang.fwdSubsref (line 4)
[varargout{1:nargout}] = subsref(A,s);

出错 traci.init (line 65)
connections(label).connect(host, port);

error od2trips (line 8)
traci.init();
error use traci.Socket/connect (line 25)
Java exception occurred:
java.net.ConnectException: Connection refused: connect

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at java.net.Socket.connect(Socket.java:538)

出错 matlab.internal.lang.fwdSubsref (line 4)
[varargout{1:nargout}] = subsref(A,s);

error traci.init (line 65)
connections(label).connect(host, port);

error od2trips (line 8)
traci.init();
error use traci.Socket/connect (line 25)
Java exception occurred:
java.net.ConnectException: Connection refused: connect

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at java.net.Socket.connect(Socket.java:538)

出错 matlab.internal.lang.fwdSubsref (line 4)
[varargout{1:nargout}] = subsref(A,s);

error traci.init (line 65)
connections(label).connect(host, port);

error od2trips (line 8)
traci.init();
error use traci.Socket/connect (line 25)
Java exception occurred:
java.net.ConnectException: Connection refused: connect

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at java.net.Socket.connect(Socket.java:538)

error matlab.internal.lang.fwdSubsref (line 4)
[varargout{1:nargout}] = subsref(A,s);

error traci.init (line 65)
connections(label).connect(host, port);

error od2trips (line 8)
traci.init();
MATLAB:Java:GenericExceptionJava exception occurred:
java.net.SocketException: Socket is not connected

at java.net.Socket.getInputStream(Socket.java:905)

结构体内容引用自非结构体数组对象。

error traci.sendExact (line 19)
activeConnection.dos.writeInt(len);

error traci.getVersion (line 23)
result = traci.sendExact();

error traci.init

error od2trips (line 8)
traci.init();

@slavi-czech
Copy link

Hi,
I had the same problem with my Traci4Matlab and the issue was that I did a mistake when I named javaclasspath. It must have an extension of "txt". It is just if you have hidden known file extensions, then the "txt" is not visible but it must be there.
Hope it helps to solve the issue.

@davide990
Copy link

Hello,

back here. Using sumo, matlab r2019b and osx big sur. I have this issue when running the traci4matlab example:

>> traci.init()
Error using traci.Socket/connect (line 25)
Java exception occurred: 
java.net.ConnectException: Connection refused (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at java.net.Socket.connect(Socket.java:538)
Error in matlab.internal.lang.fwdSubsref (line 6)
    [varargout{1:nargout}] = subsref(A,s); 
Error in traci.init (line 65)

@slavi-czech in my case, the java classpath file has txt extension.

I tried to deactivate the osx firewall, with no chance.

What to do? Any idea?

@MikeZheng777
Copy link

MikeZheng777 commented May 16, 2022

Hello,

back here. Using sumo, matlab r2019b and osx big sur. I have this issue when running the traci4matlab example:

>> traci.init()
Error using traci.Socket/connect (line 25)
Java exception occurred: 
java.net.ConnectException: Connection refused (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at java.net.Socket.connect(Socket.java:538)
Error in matlab.internal.lang.fwdSubsref (line 6)
    [varargout{1:nargout}] = subsref(A,s); 
Error in traci.init (line 65)

@slavi-czech in my case, the java classpath file has txt extension.

I tried to deactivate the osx firewall, with no chance.

What to do? Any idea?

Same problem happened to me. I am using MATLAB 2022 and sumo 1.11.0 on MacBook Pro M1 Pro. Any idea to solve this issue? Thanks!

@davide990
Copy link

actually yes, it was also pretty easy: running matlab from terminal via sudo should solve the issue.

@MikeZheng777
Copy link

actually yes, it was also pretty easy: running matlab from terminal via sudo should solve the issue.

Thank you for the update Davide. I have tried assigning "root" to my MATLAB license and running the matlab script from terminal using sudo. However the same error message pop up in my terminal window. Do you have the same issue? If so, could you please provide more details of solving it? Thanks!

@davide990
Copy link

I used to have this issue but running "sudo open /Applications/MATLAB/R2019b.app" worked in my case. I don't have further suggestions, sorry :/

@MikeZheng777
Copy link

MikeZheng777 commented May 17, 2022

I used to have this issue but running "sudo open /Applications/MATLAB/R2019b.app" worked in my case. I don't have further suggestions, sorry :/

It works for me, Thanks!

@ammarhydr
Copy link

Hello,

I have the same error on my Ubuntu machine. I checked my javaclasspath extension that is fine.
Do you have any idea about the error?

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants