Setting Java Heap Space in Weblogic Server - java

I have my Java EE web application deployed and running in Weblogic server.
If I want to set min and max arguments like this, Xms100m Xmx500m, where should I change this?
Whether in Weblogic 10.0MP server (if so, where) or while building the application in IDE?

For Admin Server this can be done in $domain_home/bin/setDomainEnv.sh (most likely corresponding bat if you use Windows) script, for managed servers via Weblogic console.

If you're starting weblogic form IDE like Eclipse you can change this in Run Configuration options (JVM Arguments).

You can change it in Server Start arguments as described here:
http://itbitsolutions.wordpress.com/2010/08/22/increasing-the-heap-size-of-the-jvm/
after changing, you need to restart servers to apply changes.

The environment variable USER_MEM_ARGS on WLS 12c.
For instance:
-Xms256m -Xmx768m -XX:MaxPermSize=256m
Don't forget the MaxPermSize, or it will default and probably niet be enough.

Related

Starting Websphere from Eclipse hangs when security is enabled

I have a Websphere Application Server 8.0.0.6, which was installed as part of RAD.
I need to run the server from an Eclipse Java EE Kepler or Luna. There is no problem when administrative security is disabled. However, once security is enabled, the server either doesn't start completely, or Ecplise is unable to to detect it.
The progress bar stops at 23%. The last message logged is "Server server1 open for e-business". The status however is still "starting". After a while I get an error complaining that the server didn't start within 300 seconds. It then tries to stop the server, and remains in "stopping" indefinitely.
The server is started, Eclipse just seems unable to see it. I can't access the admin console from within Eclipse (though I can with a browser), I can't publish or debug applications, and I can't stop the server from Eclipse.
This happens with both Kepler and Luna.
The server starts fine in RAD, or when started with the start script.
I have checked start websphere server from RAD hangs at "Server server1 open for e-business" . There is a similar question: Websphere in RAD hangs on startup, but there was no solution.
Update: The problem is the communication between Ecipse and Websphere, after Websphere has started (as wFateem also has pointed out).
Eclipse makes SOAP calls to Websphere to check the status. If administrative security is disabled in WAS, it accepts SOAP calls in plain HTTP. Once security is enabled, only HTTPS is allowed.
I checked communications between Eclipse and WAS using the TCP-Monitor built into Eclipse. With disabled security I can see the successful SOAP calls. After enabling security I expected to see just the binary SSL data. However, Eclipse was still trying to use HTTP, without any success of course.
Eclipse has a setting for the WAS server to indicate that the server is secured, and which user and password to use for the calls. It even has a flag pertaining to the SSL communication ("automatically trust server certificate during SSL handshake"). But still, it is not using SSL for some reason.
I had no problem in this scenario on my old development machine, which got replaced by my current machine a few days ago.
So, the current status is: Eclipse does not use SSL when talking to the WAS, even though it knows the server is secured.
The question now is: What did I do wrong that Eclipse does not use SSL to talk to a secured server?
I solved same problems for WebSphere 7 and Eclipse Neon.
Just run eclipse with ibm jdk 8 (type in google "ibm jdk 8 download").
My eclipse ini is
-vm
..\ibm_sdk80\jre\bin\javaw.exe
-vmargs
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Xms256m
-Xmx1024m
-XX:MaxPermSize=320m
-Dcom.ibm.ws.management.event.max_polling_interval=1000
-Dcom.ibm.websphere.thinclient=true
Best regards, Sergey Batsura
If you suspect problems with SSL, you could try the following workaround.
Once server is started (e.g. via command line), go to web admin console and then to: Global security > CSIv2 inbound communications and in transport section set transport to TCP-IP. Save and restart the server. This will disable SSL for RMI/IIOP connections.
Then in RAD in Server settings change Server connection types... to Manually provide connection settings and select only RMI.
Check if it will work better.
As last resort you could also try to start the server, then exit the RAD and restart the RAD again, it should detect server as already running. But it's not very useful...
it's important to modify the eclipse.ini.
First of all specifying the WebSphere -vm BEFORE -vmargs
Here are my parameters:
--launcher.XXMaxPermSize
512M
-vm
C:\IBM\WebSphere\AppServer\java\jre\bin\javaw.exe
-vmargs
-Xms256m
-Xmx1024m
-XX:MaxPermSize=512m
-Xmx1024m
-Xshareclasses:name=IBMSDP_%u
-Xcompressedrefs
-Xquickstart
-Xgcpolicy:gencon
-Xmnx64m
-XX:+UseCompressedOops
-Dcom.ibm.ws.management.event.max_polling_interval=1000
-Dcom.ibm.websphere.thinclient=true
After the above changes, communication from eclipse to WebSphere with security enabled works without problems
I'm not too familiar with starting WAS from Eclipse. However, from the sound of it this looks like a communication issue between your IDE and the WAS server. If you're able to start the server and you get the "open for e-business" message, but Eclipse is unable to see the proper status and this only occurs when security is enabled then you need to look into how Eclipse authenticates and performs SSL handshake with the WAS server.
You can start the server without any issues, but other tasks would require authentication (stopping server, retrieving status, etc...).
You may need to retrieve the WAS server's personal certificate into Eclipse's local trust store for example.
I was experiencing the same issue when trying to start WebSphere from Eclipse Luna. Finally I was able to start it following the guidelines posted by Aleksander Kovač in an answer from developer works forum: Unable to initialize SSL connection(WASCE7)
I hope this helps!
Maybe this is a silly advise, but have you tried using WebSphere Developer Tools? They are installed on top of Eclipse, either Luna or Kepler, using P2
https://developer.ibm.com/wasdev/
Look at this web page to learn how to install the tools
http://www-01.ibm.com/support/knowledgecenter/was_beta_devtools/com.ibm.websphere.wdt.doc/topics/t_install_wdt.htm
Update the JDK in eclipse.ini file to IBM JDB 1.8 64Bit. I am using WAS 8.5.0 with Eclipse MARS.
-vm
C:/IBM/WebSphere8.5/AppServer/java_1.8_64/bin/javaw
If eclipse does not start and return code=13, then check in eclipse.ini version is 1.7
-vmargs
-Dosgi.requiredJavaVersion=1.7
-Xms256m
-Xmx1024m
Note:I have already commented in Sergey's answer,but needed to update some info.
I had the similar issue (Websphere application server hung in eclipse after adding Security).
Resolved the same by adding com.ibm.ws.orb_8.5.0.jar file from your appserver/runtimes and placed it in C:\Temp\endorsed folder and specify the same in your eclipse.ini file as below.
Eg:
vmargs
Djava.endorsed.dirs=C:\Temp\endorsed

java out of memory error-heap space

I'm developing web application in jsp/servlet,i had an issue with netbeans and Java. My program needs large data process. So I used -Xmx512m to increase the maximum heap size via
Tools -> Servers -> on the Platform tab there is a VM option below
Java Platform.
Then it works fine..
Now my issue is i'm building the WAR file, directly deployed and run in my another machine Tomcat for demo,
here i'm facing the same issue java out of memory error-heap space
i also tried with
environment variable set CATALINA_OPTS=-Xms512m -Xmx512m
this also didn't help me
how to resolve this issue?, Please point me to the right direction
Try to set PermSizeand MaxPermSize values and that should be set at tomcat startup in Catalina.bat and then stop and start using this script.
set CATALINA_OPTS=-server -Xms1024m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m
http://javahowto.blogspot.co.uk/2006/06/6-common-errors-in-setting-java-heap.html
Finally i found the solution for the issue
in Catalina.bat file
you can find some text like below
set _EXECJAVA=%_RUNJAVA%
set MAINCLASS=org.apache.catalina.startup.Bootstrap
set ACTION=start
set SECURITY_POLICY_FILE=
set DEBUG_OPTS=
set JPDA=
under that you need to put the
set CATALINA_OPTS=-Xms512m -Xmx512m
Heap size is larger than your computer's physical memory. For example,
java -Xmx2g BigApp
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
The fix is to make it lower than the physical memory: java -Xmx1g BigApp
I know I am totally late on this reply but in case it would be helpful to anybody runs into the same situation I think it worth to put a note here. I am referring to tomcat 9 so you might need to check how things mentioned here are relevant to your version:
In %CATALINA_HOME%/bin/catalina.bat, it clearly stated that:
rem WHEN RUNNING TOMCAT AS A WINDOWS SERVICE:
rem Note that the environment variables that affect the behavior of this
rem script will have no effect at all on Windows Services. As such, any
rem local customizations made in a CATALINA_BASE/bin/setenv.bat script
rem will also have no effect on Tomcat when launched as a Windows Service.
rem The configuration that controls Windows Services is stored in the Windows
rem Registry, and is most conveniently maintained using the "tomcatXw.exe"
rem maintenance utility, where "X" is the major version of Tomcat you are
rem running.
If you check your %CATALINA_HOME%/bin folder, you could find a file named like "tomcat9w.exe". Double click on it and you could see this screen shot where you can set your Xms and Xmx parameters for it to save into registry for you
Hope this helps
Out of memory error can be result of big session-timeout number in Tomcat's web.xml. In that case many web sessions can take many system memory.
I suggest you enable heap dump and analyze using IBM support Workbench (which has heap dump analyzers) and understand the problem exactly and make configurations accordingly.

VisualVM "not supported for this JVM" on all local applications?

I have already spent a long time to load and test my application, now I need to profile it. But unluckily, the VisualVM always says "not supported for this JVM" on my local applications?
The applications were started on the same JVM with VisualVM.
I found out that (at least under Windows) one can easily write small batch files to run VisualVM in combination with specific JVMs, which is important for me, since I have installed the 32bit JDK alongside with the 64bit JDK (I need both, so this is sensible for me).
I have created two batch files in the folder "S:\applications\visualvm\bin\":
run_32.bat:
#echo off
START "VisualVM 32" visualvm.exe --jdkhome "C:\Program Files (x86)\Java\jdk1.7.0_07"
run_64.bat:
#echo off
START "VisualVM 64" visualvm.exe --jdkhome "C:\Program Files\Java\jdk1.7.0_07"
Obviously, all paths may differ on your system, but the general idea should still work correctly (on all 64bit versions of Windows). The benefit is that I can use the 32bit batch file when I want to use VisualVM in combination with Java applications that run on the 32bit JVM, and so on for 64bit.
The "start" command has the only benefit that the batch file launches the application without waiting for it to finish, so the command prompt window closes immediately. This is not a feature of VisualVM, but of the Windows batch file interpreter.
In my case, even with the JVMs matching (both 64-Bit), the only way to get things working was sending the argument -Dcom.sun.management.jmxremote to the JVM to be monitored. That also works if you are having problems to connect via Java Mission Control (JMC).
According to JMX's documentation, this what the argument does:
Setting this property registered the Java VM platform's MBeans and published the Remote Method Invocation (RMI) connector via a private interface to allow JMX client applications to monitor a local Java platform, that is, a Java VM running on the same machine as the JMX client.
This was supposed to be enabled automatically, but for some reason it wasn't on my Linux.
VisualVM needs to be run with the same JVM - at least Java 6 with the same 32-bit/64-bit size - as the program to be profiled. (You also need to be the same user, but then this message does not apply).
I would be triple-check that it was the exact same JVM in your situation.
On Linux:
Make sure that your /etc/hosts correctly references the effective ip address of your "hostname"
It appears that a discrepancy here totally confuses the poor jvisualvm and its programmers.
I too got the same problem for local tomcat, I search for solutions for stackoverflow. after some serious debugging, I figured out that VisualGC don't have permissions to get GC informations from tool.jar file.
by links
http://docs.oracle.com/javase/7/docs/technotes/tools/share/jstatd.html#SECURITY
https://stackoverflow.com/a/42107355/3876619
I following steps to solve the issue
1) Create a permission file
vim /tmp/tools.policy
Add
grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};
save it
2) Now add /tmp/tools.policy to JVM startup parameters
-Djava.security.policy=/tmp/tools.policy
3) Run jvisualVm with sudo
An issue that I just found, thanks to the hint from #user3356656, is that if you start the program while your machine is on one IP, and then try to connect while it is on a different IP, it will fail.
I also met this issue. My case is that on linux, I started tomcat with tomcat_user but I run jvisualvm with root user. It works after I start tomcat with root user.
I was having the problem having of visualvm detect my local tomcat installation on Windows 7. I could connect manually, but then things like memory snapshots and visualgc plugin were not enabled. I confirmed that I was using same JVM version, temp file permissions, etc. Didn't work. Then I found that starting visualvm first, and then tomcat, solved the problem.
As you can see, you are running VisualVM on 32bit JVM
You don't need to unistall 32bit JVM. Just tell VisualVM to use tour 64bit JVM.
If you want to change it permanently, you can edit
in visualvm_13\etc\visualvm.conf and specify the path of jvm here
My problem was JVM optimizations - -XX:+PerfDisableSharedMem flag will break VisualGC. This is apparent if jps will not show your app in the listing.
I can reproduce next behaviour.
I have a java application with right-click menu item to open jvisualvm.
I'm running this java application as standalone setup from a bat file.
It means I modify %path% and other needed environment variables like JDK
accordingly to form my environment.
The BAT that starts application is marked running as non-admin. Environment points to a 64-bit JDK.
Then I start other java application as admin. VM lives from the to same 64-bit JDK-source.
Then I start jvisualvm from first app with the right click ie.as non-admin.
I can see the app in jvisualvm ‘Applications list’ but clickin ‘System properties’ gives error. Message is “Not supported for this JVM”.
JVM arguments are exposed.
Solution is like in some other previous comments:
Starting my right-click jvisualvm-starter as admin I can see also "system properties" .
Certainly if JDKs would be 32-bit and other 64-bit it would not work. been there.
I thought this notion needs to be added here.
In my case, the application was running with admin permissions. So, visualVM also need to be running as admin.
I have changed name to my Windows User and set it all lowercase, restarted my PC and it all works now.
For me, the reason is that I have run the "jstatd" with a different user with the JVM process. I have a special user in the linux to start the JVM thread(it is a tomcat), but I start the jstatd process with root. If you use root to run jps, you cannot see any information of the JVM threads belonging to other users. That is the trouble.
I killed the "jstatd" process started by root, su to the owner of the JVM process, and restart the "jstatd" process and everything wokrs fine now.

Jconsole cannot connect to java processes running as Windows 7 Services

We have a Java process which we run as a Windows service (using srvany). It runs with Java 1.6 (1.6.0.23 at the moment).
In the past (Windows XP), I could connect JConsole to the processes, on Windows 7 I cannot do this anymore.
If I run jconsole <pid> I get “Invalid process id:4488”. The services are running as SYSTEM user.
If I make the service run as my desktop user (using “Log On as This Account”) the services process ID appear in JConsole, but they are grayed out and I cannot connect.
Is it impossible to dynamically connect to Java processes when they are running as a Windows 7 service?
Perhaps it is a 64bit/32bit problem, I have several applications compiled with 32bit JDK, which could not be opened with JConsole from 64bit JDK on Windows 7 64bit, after I downloaded the 32bit JDK it worked.
Others have been able to run jstack on 2008r2 which may provide some insight on how to get jconsole to connect on Windows 7. As you noted in your comment, the permissions are important. If the service and jconsole can't access the temp directory to write to the appropriate hsperf subdirectory, it won't work. What is also important is the location of the temp directory, the user the service is running, and the user that is running jconsole.
Running SysInternals psexec -s -i <jdk_home>\bin\jconsole <PID> can be used to run jconsole as Local System, the same user that I believe you are using to run your service.
My experience running jconsole from JDK 1.5 in Server 2008 as a system user was unsuccessful. With permissions that I thought should have been sufficient, I got a Could Not Open PerfMemory error. Java 1.6 may be a different story.
In light of all the challenges with running jconsole locally, you would probably have better luck setting it up to accept remote connections. You could set it up for local-only access with your firewall blocking that port from external access.
Add the following to JAVA_OPTION
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8086
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
Then,
Use JConsole to connecet remote session:
localhost:8086
I am currently facing the same problem but on Windows 2003 R2 (SP2). There is on open bug in Oracle Bug database (bug id 6399729)
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399729
Also there is a work-around posted towards the end. It talks about installing java in "install" mode :-), but didn't work for me on Windows 2003 though. But your mileage may vary!!
Change Environment Variable TEMP and Tmp to a different folder that you created.
Like c:\theTemp
It might be a problem with the folder %TMP%/hsperfdata_{USER_NAME}.
In my case, it worked after I :
close all applications running over the JVM
delete the folder %TMP%/hsperfdata_{USER_NAME} (exemple: C:/Temp/hsperfdata_MyUser)
reopen JConsole (it recreates the folder)
Hope it helps. You can also take a look at this thread in Oracle community.

Java Web Start and allowArraySyntax is not set

ref: http://bugs.sun.com/view_bug.do?bug_id=6434149
My problem is that sun.lang.ClassLoader.allowArraySyntax is not set to true when using java webstart (javaws) later than 1.6.0_05 (JRE is 1.6.0_14).
I have tried:
set JAVAWS_VM_ARGS=-Dsun.lang.ClassLoader.allowArraySyntax=true
or manually specifying it:
javaws.exe -J-Dsun.lang.ClassLoader.allowArraySyntax=true ...
But when outputting the system property I only get null (if later than 1.6.0_05).
I really need web start to work, any ideas?
Some setup information:
Weblogic 9.2 on Windows (server)
Java client also running on Windows
Due to some strange characters at the beginning of my jnlp-file, javaws, apparently, did a second launch (this could be seen where the java-console started twice) where the vmargs were lost...
Facing this issue myself with a weblogic service and I cannot update the server platform at this time. Looks like this VM setting can be passed in through the JNLP file in the j2se or java tag
java-vm-args="-Dsun.lang.ClassLoader.allowArraySyntax=true"
But there seems to be a java 6 bug that is not passing this setting on to the JVM, see https://bugs.openjdk.java.net/browse/JDK-6953324. This is said to be fixed in java release 6u23 and seems to work in the 6u45 or so.
I found another webstart article stating that this setting can be done in a Property tag but have not found that to work.

Categories