offbynull / portmapper

Java library that maps ports on NAT-enabled routers (supported protocols: UPnP-IGD/NAT-PMP/PCP).
Apache License 2.0
88 stars 17 forks source link

Failed to find mapper #34

Closed adam-law closed 7 years ago

adam-law commented 7 years ago

Hi,

Sorry to open another issue up so soon. I used the example given on the project page, but Portmapper fails to find any mapping devices. It did open a UDP port in UPnP 60339. Is there an alternate process for device discovery?

offbynull commented 7 years ago

Got logs?

adam-law commented 7 years ago

Sorry if it's something obvious, but where are these being dumped? Or do I have to write one around the process? I add PortMapper as a standalone jar into the project I'm working on, since it's that old i.e. no Maven / Gradle etc.

offbynull commented 7 years ago

How did you add it as a standalone jar? The project has dependencies on some apache commons libraries and slf4j.

In any event, here's how the logging works...

The project uses slf4j for logging. slf4j is a high-level API that binds with many different Java logging frameworks, so in addition to slf4j-api (which is already included as a dependency), so you have to also provide a logger implementation and a slf4j binder for that logger implementation.

I think the simplest thing you can do is ...

  1. download slf4j-simple (1.7.21 I think is the version you want)
  2. include the slf4j-simple jar file in to your classpath when you run
  3. include the following command line arg when you run: -Dorg.slf4j.simpleLogger.defaultLogLevel=debug

slf4j-simple is a binder that doesn't map to any particular logging implementation. Instead it dumps logs out directly to console. The command line arg tells slf4j-simple to log at debug-level.

If you want a better overview of how to configure slf4j with different loggers, you can check out this page: http://saltnlight5.blogspot.ca/2013/08/how-to-configure-slf4j-with-different.html

offbynull commented 7 years ago

Side note: You have to have some logging set up, because in your last ticket you copy/pasted some log messages along with the error.

adam-law commented 7 years ago

Sorry, I was suddenly swamped at work. I promise to get you the info needed as soon as I can.