Tomcat9 web access other than localhost failed - java

I am trying to evaluate ofbiz ( v17.2.03 ) just now. I can access it via https://127.0.0.1:8443/.../ from local machine (192.168.110.182) but not from other machines. The error message is like(from Chrome),
org.apache.ofbiz.webapp.control.RequestHandlerException: Domain
192.168.110.182 not accepted to prevent host header injection.
No idea at all, and please if someone can help with this.

You need to set host-headers-allowed property in security.properties file. I'll make the error message more explicit!
Update: done with
https://github.com/apache/ofbiz-framework/commit/3c9fe5f91684de54570e6ec61575c11368a2ffd6/
https://github.com/apache/ofbiz-framework/commit/d0fceffadda57dbe6e87398c47b4a575bc33137d/

Related

500 internal server error on WebLogic server

when I pass more than 1000 param I'm getting 500 internal server error on WebLogic server. Please suggest me any configuration have to be changed or any other. When I execute in tomcat setting max parameter attribute that issue getting resolved. But I need a solution in Weblogic server.Please help me
First result in google:
https://community.oracle.com/thread/4044784
Configure it by setting a higher value in MaxRequestParameterCount.
It would be helpful to know your WebLogic version, error message, etc.

UnknownHostException from Java but host resolves with Ping/nslookup/curl

We are getting the following exception when a Java EE server tries to resolve a host name from one of the services. We were able to resolve that host name on the box manually with ping/nslookup command. We were also able to fire that external service using curl with same parameters what server is trying to use. So it seems like this issue happens only when we try to make a request to a external host from a Java/Java EE application.
To resolve this issue, we manually added an entry in /etc/hosts file and it solved the problem but we want a permanent solution so we don't have to keep changing the IP. It was working before without adding that entry but all of a sudden it stopped working.
Detail of our environment:
OS: Cent OS 6.3
Java : JDK 1.6.0_24
Java EE Server : JBoss AS 7.1.1
Http Client library : httpclient-4.0.jar
Thanks in advance for the help!!
Error while checking salesforce license|:
java.net.UnknownHostException: na15.salesforce.com at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:175)
[rt.jar:1.6.0_24] at
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
[rt.jar:1.6.0_24] at java.net.Socket.connect(Socket.java:546)
[rt.jar:1.6.0_24] at
sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:584)
[jsse.jar:1.6.0_24] at
org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:333)
[httpclient-4.0.jar:4.0] at
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:123)
[httpclient-4.0.jar:4.0] at
org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:147)
[httpclient-4.0.jar:4.0] at
org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:101)
[httpclient-4.0.jar:4.0] at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:381)
[httpclient-4.0.jar:4.0] at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
[httpclient-4.0.jar:4.0] at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
[httpclient-4.0.jar:4.0]
This is most likely a network management, change / configuration management or general system administration problem rather than a programming problem.
It was working before without adding that entry but all of a sudden it stopped working.
One approach is to try to figure out what changed to cause it to stop working. This is not the kind of thing that would happen spontaneously. Someone or something has changed some software or configurations to make this happen. Start with when it stopped (or when you noticed) and work back through your change logs.
It sounds like it is an issue with the Java DNS resolution procedure. It appears that the resolver is either not trying to talk to the normal DNS servers, or it is trying and failing.
We can't debug it for you, but I found these resources that help to explain what should be happening when you do a name lookup in Java, and offer some ideas on trouble-shooting.
Resources:
DNS and Java
Java doesn't pick up system's DNS settings change until restarted
Java and /etc/resolv.conf DNS server failover
Java networking properties
I found that these same symptoms can happen when IPv6 is disabled on your networking. You can see this by running a simple Java program:
import java.net.InetAddress;
public class NameTest
{
public static void main(String[] args) throws Exception
{
System.out.println(InetAddress.getByName("google.com"));
}
}
If IPv6 is an issue, then running the program with java -cp . NameTest will fail with a line like "at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)" in the stack trace (notice the Inet6 in the class name), and running the program with java -cp . -Djava.net.preferIPv4Stack=true NameTest will succeed (this is from the above answer Java networking properties reference).
To work past this, I followed suggestions from this question.
An OS-wide disabling of IPv6 works well, as the system doesn't have IPv6. On some Linux varieties, this can be disabled by first adding this line to the end of the file /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
followed by running sudo sysctl -p to immediately disable IPv6.

Java Salesforce Integration Error

I'm trying to connect to salesforce from a java application. I was earlier getting a login error as follows which was resolved by setting the appropriate proxy settings.
com.sforce.ws.ConnectionException: Failed to send request to https://login.salesforce.com/services/Soap/c/29.0
Now, I'm getting the following error:
com.sforce.ws.ConnectionException: Failed to send request to https://ap1.salesforce.com/services/Soap/m/29.0/00D90000000q0ZR
at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:121)
at com.sforce.soap.metadata.MetadataConnection.describeMetadata(MetadataConnection.java:281)
at integration.IntegrationClass.describeMetadata(IntegrationClass.java:80)
at integration.IntegrationClass.main(IntegrationClass.java:26)
Caused by: java.net.ConnectException: Connection refused: connect
Any ideas on how to resolve this error? Thanks!
UPDATE: I tried the code at my home (free from the restrictions of the office firewalls et al :) ) and found that the code ran successfully. Any ideas about changes that I should make to do the same at the company. As I already said, I added the config.setProxy(host, port) which allowed me to successfully log in, but not access the application. I have also enabled proxy from eclipse using Preferences -> General -> Network Connections. What am I missing?
Thanks a lot for your help. Cheers!
Ok, I got the solution and it's kinda silly, but since I didn't spot it anywhere else inspite of seeing similar questions, I'm going to post the solution.
The ConnectorConfig config = new ConnectorConfig(); is used multiple times; in my case, it is first used to login using new EnterpriseConnection(config)).login(username, password); and next to obtain a metadata connection using new MetadataConnection(config);. Since I'm creating 2 ConnectorConfig objects, I would need to use the setProxy method on both, which I...forgot. Hope this solution helps other people having the same problem.
Cheers!

Issue while connecting to remote weblogic server over proxy

I have configured a proxy in my java source code as:
systemSettings.put("http.proxyHost", "www.proxyserver.com");
systemSettings.put("http.proxyPort", "8080");
systemSettings.put("http.nonProxyHosts", "10.x.y.z");
Here 10.x.y.z is the actual IP of my weblogic server.
But whenever code tried to connect to weblogic server, I receive error as:
Caused by: java.net.ConnectException: t3://10.x.y.z:7001: Destination
unreachable; nested exception is: java.net.ProtocolException:
unrecognized response from proxy: 'HTTP/1.0 403 Forbidden'; No
available router to destination at
weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:216) at
weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:170) at
weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:153) at
weblogic.jndi.WLInitialContextFactoryDelegate$1.run(WLInitialContextFactoryDelegate.java:345)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at
weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:340)
It seems that setting http.nonProxyHosts is not working as expected. I tried to find solution over the Internet, but most of them says remove proxy settings. I can not remove proxy, as my code tries to connect to some of the Internet URLs. Also note that, weblogic server is on remote machine.
Can you please give me a hint, what must be the issue here?
Have a look at this OTN thread.
From 3rd comment :
You are setting nonProxyHosts, which doesn't exist as a system property, via System.setProperties().
I haven't read all so far, but it seems the system.properties is not the convenient way to set
nonProxyHosts.
Did you tried to set it from command line ?
-Dhttp.nonProxyHosts="*.foo.com|localhost".
I resolved the issue. I had setup the proxy initially when connection with weblogic was setup. So due to some network restrictions I believe it didnt work. In modified code, I used the same 3 lines to setup proxy:
System.setProperty("java.net.useSystemProxies", "false");
System.setProperty("http.proxyHost", "www.proxyserver.com");
System.setProperty("http.proxyPort", "8080");
The only difference is, I did it at exact place where I needed. So for initial connection setup with weblogic proxy wont be used. I also did not have to bypass, weblogic server URL to not to use proxy.
#Arcadien: I appreciate your efforts to help me. Thanks.

UnknkownHostException

Please help;
Am trying to deploy a web application.
The build is returning successful,and am not getting any errors on the sever.log
however am getting a http 503 error:the requested service() is not currently available
and also my
Java DB Database Process has this message
Warning: UnknkownHostException: intracare: intracare.
Could not listen on port 1527 on host localhost.
am using glassfish v3 prelude
Possibly you already have another application (perhaps another JavaDB instance?) listening on port 1527 - that could explain the "could not listen" message. Use netstat to check.
I think that UnknownHostException is related that intracare can't be resolved to an IP.
I would:
Ping that host.
Check C:\WINDOWS\system32\drivers\etc\hosts or /etc/hosts files.
Regards.
Check the DNS settings on the host. Your short names do not resolve correctly.
Mayby string you are typing as a host name is wrong? Maybe it is firewall problem?

Categories