Comments (6)
Hi @aatifansari
I suggest to exclude the duplicated libs. I don't know exactly your gradle dependencies, so the solution I suggest is something similar to this approach:
implementation('website.magyar:mitm-java-proxy:2.5.27.114') {
exclude(group: 'ch.qos.logback', module: 'logback-classic')
exclude(group: 'org.eclipse.jetty', module: 'jetty-io')
exclude(group: 'org.slf4j', module: 'jcl-over-slf4j')
exclude(group: 'org.slf4j', module: 'jul-to-slf4j')
}
from mitmjavaproxy.
Thanks @tkohegyi but when running the application it is giving error..
tried both
- ps.start(8888);
- ps.start(0);
2023-06-30 16:22:59.017 18869-18869 System.err com.group.sample W java.lang.IllegalStateException: Must set port before starting
2023-06-30 16:22:59.018 18869-18869 System.err com.group.sample W at website.magyar.mitm.proxy.ProxyServer.start(ProxyServer.java:66)
2023-06-30 16:22:59.018 18869-18869 System.err com.group.sample W at com.group.sample.activity.TempActivity.onCreate(TempActivity.java:52)
2023-06-30 16:22:59.018 18869-18869 System.err com.group.sample W at android.app.Activity.performCreate(Activity.java:8305)
2023-06-30 16:22:59.018 18869-18869 System.err com.group.sample W at android.app.Activity.performCreate(Activity.java:8284)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1417)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3626)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3782)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at android.os.Handler.dispatchMessage(Handler.java:106)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at android.os.Looper.loopOnce(Looper.java:201)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at android.os.Looper.loop(Looper.java:288)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at android.app.ActivityThread.main(ActivityThread.java:7872)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at java.lang.reflect.Method.invoke(Native Method)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
2023-06-30 16:22:59.019 18869-18869 System.err com.group.sample W at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
from mitmjavaproxy.
Hi @aatifansari
I cannot see your file TempActivity.java, but from the error message ("Must set port before starting") I guess you tried to run the proxy without specifying its port. So the problem is that the ProxyServer class created without specifying the port, and later the proxy has been started without specifying the port to be used.
Pls see and follow this guideline on how to start the proxy.
from mitmjavaproxy.
Hi @tkohegyi
Sorry was passing the port in start() method instead of ProxyServer(PORT_NUMBER) constructor.
But after that also getting error of INSTANCE static field
java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar!classes4.dex)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.(SSLConnectionSocketFactory.java:151)
at net.lightbody.bmp.proxy.http.BrowserMobHttpClient.(BrowserMobHttpClient.java:144)
at website.magyar.mitm.proxy.ProxyServer.start(ProxyServer.java:81)
at com.group.sample.activity.TempActivity.onCreate(TempActivity.java:52)
at android.app.Activity.performCreate(Activity.java:8305)
at android.app.Activity.performCreate(Activity.java:8284)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1417)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3626)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3782)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
from mitmjavaproxy.
Hi @aatifansari - from the log:
java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar!classes4.dex)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.(SSLConnectionSocketFactory.java:151)
Three possible issues might be:
case A - You are using an older version of the proxy - like this or even earlier version:
https://github.com/tkohegyi/mitmJavaProxy/releases/tag/v2.0.21.100
In which, in the release notes, there is a note:
It may happen that additional library need to be included in your build, like this way:
implementation group: 'org.apache.httpcomponents', name: 'httpmime', version:'4.5.13' //this includes httpclient too
implementation ('website.magyar:mitm-java-proxy:2.0.21.100')
AND not the specified version, but a newer version of the lib is used, in which this field is missing. If this is the case, please use exactly the mentioned version of the httpmime lib.
case B - You are using newer/latest verison, but overrides (or android overrules) the httpmime component version that is used during the build of the proxy jar.
In this case check and please ensure that not newer than 4.5.14 version of the httpmme/httpclient lib is loaded during the build of your application.
case C - pls see the issue and the solution here: https://stackoverflow.com/questions/60423257/no-static-field-instance-of-type-lorg-apache-http-conn-ssl-allowallhostnameverif
In addition - if you can build your own jar from the latest source, maybe the issue will disappear too.
from mitmjavaproxy.
Hi @tkohegyi thanks for your recommendations
Case A - Lowered down the library version
implementation group: 'org.apache.httpcomponents', name: 'httpmime', version:'4.5.13'
implementation('website.magyar:mitm-java-proxy:2.0.21.100') {
exclude(group: 'ch.qos.logback', module: 'logback-classic')
exclude(group: 'org.eclipse.jetty', module: 'jetty-io')
exclude(group: 'org.slf4j', module: 'jcl-over-slf4j')
exclude(group: 'org.slf4j', module: 'jul-to-slf4j')
}
Result - But still getting the same error
[No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier]
case B - Using the latest library version but not able to verify which version of httpmme/httpclient is being loaded
case C - build the jar locally and then imported it.
implementation files("libs/mitm-java-proxy-2.5.27.SNAPSHOT-all.jar")
Result - Getting warning during build process and error while running the app.
Build process warning -
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Error -
java.lang.NoSuchMethodError: No virtual method getModule()Ljava/lang/Module; in class Ljava/lang/Class; or its super classes (declaration of 'java.lang.Class' appears in /apex/com.android.art/javalib/core-oj.jar)
at ch.qos.logback.core.util.EnvUtil.logbackVersionByModule(EnvUtil.java:56)
at ch.qos.logback.core.util.EnvUtil.logbackVersion(EnvUtil.java:36)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:81)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:77)
at ch.qos.logback.classic.spi.LogbackServiceProvider.initializeLoggerContext(LogbackServiceProvider.java:50)
at ch.qos.logback.classic.spi.LogbackServiceProvider.initialize(LogbackServiceProvider.java:41)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:183)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:170)
at org.slf4j.LoggerFactory.getProvider(LoggerFactory.java:455)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:441)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:390)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:416)
at website.magyar.mitm.proxy.ProxyServer.(ProxyServer.java:28)
at com.group.sample.activity.TempActivity.onCreate(TempActivity.java:50)
at android.app.Activity.performCreate(Activity.java:8305)
at android.app.Activity.performCreate(Activity.java:8284)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1417)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3626)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3782)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Note - I have also tried to run the application on Intellij and added a class to start the server it is successfully running there and was able to print the port number also.
from mitmjavaproxy.
Related Issues (17)
- Fix checkstyle issues HOT 1
- Fix sonar detected issues
- Replace old and extracted java sources with latest jars HOT 1
- Get rid of unused classes. HOT 1
- Make proxy runnable in standalone mode HOT 1
- Finalize and publish first release HOT 1
- Random SSL issue - SSLException: Index out of bounds HOT 8
- Random SSL issue - An established connection was aborted HOT 1
- Random SSL issue - at net.lightbody.bmp.proxy.jetty.util.LineInput.fill(LineInput.java:417) HOT 1
- Random SSL Issue - SSL_NULL_WITH_NULL_NULL HOT 2
- Random SSL issue - SSLHandshakeException: Insufficient buffer remaining for AEAD cipher fragment (2). HOT 10
- Add support of Content-Encoding=br aka Brotli HOT 1
- Upgrade BC lib to latest
- Build and Certificate error HOT 4
- HTTPS call causes E500, if cannot resolve DNS record HOT 1
- HTTPS call cause E500 - SEC_E_INTERNAL_ERROR (0x80090304)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mitmjavaproxy.