How can I increase the -XXMaxPermGen jvm settings in Jboss under MyEclipse? - java

When I start Jboss on My Eclipse, server is started with following vm arguments
INFO [ServerInfo] VM arguments: -Djboss.home=C:\JBoss -Djava.library.path=C:\Program Files (x86)\Java\jdk1.6.0_30\bin -Djava.endorsed.dirs=C:\JBoss\lib\endorsed -Xms128m -Xmx512m -XX:MaxPermSize=256m
When I insert a big persistence object, I am getting out of memory exceptions. Jboss should be started -Xms512M -Xmx1024M .I have checked myeclipse ini file, I have change run.bat, run.conf.bat. I could not find where Myeclipse is reading this value.
Can you please show me the way to change jboss vm setting in MyEclipse 2014?
When I select Manage Launch Configuration, this ui is shown
This is jboss definition in Run Configuration Panel

Go to Server window
Double click on ths JBoss server
Under General Information, there is a link - Open Launch Configuration, click on it.
Window will open click on Arguments subtab.
Change VM arguments and Apply.
Restart Server.

Please follow the below steps :
Option 1 :
1) Open the server (double click on server)
2) Open launch Configuration
3) Go to argument tab
4) VM Arguments
and set your flag.
5) Restart Eclipse
For Graphical view
Option - 2:
1) Go to below path :
Window::Preferences::Java::Installed JREs::Edit::Default Vm Arguments:
2) Select variables button.
3) give any name suppose - vmargs
4) Edit variables
5) Select new button.
6) Add name name suppose vm (add the value size as per your requirement)
value : -Xmx1024M -Xms1024M -XX:PermSize=2048m -XX:MaxPermSize=2048m
7) Select ok
8) Restart your eclipse.

To change the memory settings for the JBoss server :
Go to Window > Preferences > MyEclipse > Servers > JBoss > expand JBoss x.x > JDK > Optional Java VM Arguments.

Related

Setting up a local OC4J instance in Intellij

When I am developing I run my application locally on an OC4J instance on my PC and I can start the server from eclipse, deploy the application to OC4J with maven, view it in the browser and debug it in eclipse. I am trying get the same set up in IntelliJ.
The steps to set it up the server in eclipse are:
Preferences > Servers > Runtime Environments -> Add (Oracle > Oracle
OC4j Standalone 10.1.3n)
Open the server configuration/overview window from the servers view
Server Properties > set username, password, port etc
Click "Open Launch Configuration"
Arguments tab > set VM arguments
Classpath tab > User entries shows oc4j.jar ~ C:\oc4j\j2ee\home
Source tab > shows my project directory and a 'Default' directory
JRE tab displays the jdk I am using
When all this is set I can run the server from eclipse and debug my application.
I've done the following in IntelliJ (but it's not working...)
Run > Edit configurations
Add new configuration
Select JSR45 Compatible Server (I've read this is the one to choose for OC4J)
Give it a name, mainly use default values, add OC4J_JVM_ARGS to 'VM Options Variable' box
add -start to VM Options (I've also tried adding all the vm args from eclipse in here)
Startup/connection tab: add C:\oc4j\bin\oc4j.cmd to Startup script box (I can't add the oc4j.jar from C:\oc4j\j2ee\home)
Now when I try to run the server from intellij I get the following output:
C:\oc4j\bin\oc4j.cmd
Usage: oc4j.cmd [Options]
Options:
-start : start OC4J
-shutdown -port -password : stop OC4J
-version : display the version
-help : display this message
Disconnected from server
This seems to be normal and is what happens when you run C:\oc4j\bin\oc4j.cmd, but I don't know what start up script I should be setting in intellij
Can anyone advise? Where should I specify -user and -password in Intellij? Thanks a lot
It seems that the 'Startup script' and'Shutdown script' boxes on the Startup/Connection tab in IntelliJ are not just file inputs, you can also type commands in there. So OC4J can be started by changing my intellij steps as follows:
Run > Edit configurations
Add new configuration
Select JSR45 Compatible Server
give it a name
mainly use default values
add any VM Options you have
add OC4J_JVM_ARGS to 'VM Options Variable' box
Startup/connection tab:
add "C:\oc4j\bin\oc4j.cmd -start" to Startup script box
add "C:\oc4j\bin\oc4j.cmd -shutdown -port=(your port number) -password=(your password)" to Shutdown script box
OC4J can now be started from intellij

Groovy Grails Tool Suite too small heap size, but only on Debug

When running Groovy Grails Tool Suite (GGTS) version 3.6.4 (latest as of June 2015), on Windows 7 Home 64bit, I get a "Error occurred during initialization of VM Too small initial heap for new size specified". I have a JAVA_OPTS System Environment variable of "-Xms512m -Xmx512m" I also have that same value inside the GGTS Menu: Run => Debug Configurations... Arguments Tab, VM arguments. This error does not happen when I do a run-app inside GGTS, and the app successfully starts. But, when I do try to run using Debug, with the run-app Debug Configuration, I do get this error. Where else could I possibly set the heap values to make this work in Debug? Any ideas of what else to test, fix, or set to fix this issue?
Could not get GGTS to launch my app, no matter what changes I made to -Xms and -Xmx everywhere I could find to make the change. Kept getting the same error. Finally, I stumbled upon this method of setting up the debug. Step 1, start the app from the console (not within GGTS):
grails -debug run-app
Step 2, in GGTS follow these directions to hook-up to the "grails -debug run-app" you just started (use port 5005 - as displayed in the console window), and when done, click the Debug button at the bottom: Create a Remote Java Application launch
Now, debug launches and I can set and view breakpoints inside GGTS.

Weblogic increase memory

How do I increase the memory used by my Weblogic (Java). While starting the server from eclipse it shows a message that JAVA Memory arguments: -Xms256m -Xmx512m -XX:MaxPermSize=256m. I couldn't understand from where is it taking that value from. After sometime the Weblogic server fails because of low permgen space.
I added startup arguments from console but that doesn't have any effect. Can you help me from where is it taking the memory values from?
When you configure a "Server" in Eclipse for WebLogic, you select a domain directory (for local). That domain directory contains the startup scripts that Eclipse will use to start the WebLogic Server. These are the same scripts that you would use if you started the server if you did it without Eclipse. Inside the domain directory is a folder called "bin". In the "bin" directory, locate the setDomainEnv file (.sh for unix, or .cmd for Windows). In that file, alter the memory settings to suite your needs.
Based on the error message you mentioned in your question, I would increase both the PermSize and MaxPermSize settings to 512m. For PermSize and MaxPermSize, there are two locations each by default in a simple WLS installation, one for 32-bit, and another for 64-bit. It won't hurt to change them both. But if you know which JVM architecture you are running, you can change the one that applies to your environment.
You will have a file setDomainEnv.cmd/setDomainEnv.sh under your server bin folder. this file contains
set MEM_MAX_PERM_SIZE_64BIT=-XX:MaxPermSize=512m
set MEM_MAX_PERM_SIZE_32BIT=-XX:MaxPermSize=512m
Max and Min memory values as
if "%JAVA_VENDOR%"=="Sun" (
set WLS_MEM_ARGS_64BIT=-Xms256m -Xmx512m
set WLS_MEM_ARGS_32BIT=-Xms256m -Xmx512m
) else (
set WLS_MEM_ARGS_64BIT=-Xms512m -Xmx512m
set WLS_MEM_ARGS_32BIT=-Xms512m -Xmx512m
)
You can update the values inside it.
In addition to the previous two answers that are correct (modifying setDomainEnv and potentially wl_server\common\bin\commEnv), you can also modify servers individually if you are starting them with the nodemanager.
In the admin console navigate to:
Servers -> <server name> -> Server Start tab -> Arguments
Here you can set the JVM args you want for that server rather than making a blanket change in all servers to setDomainEnv
Looks like eclipse plugin adds it own USER_MEM_ARGS variable, so it should be rewritten using following approach:
Open following file:
$WL_HOME/user_projects/domains/mydomain/bin/setDomainEnv.sh
and add the next line to it (e.g. after help description)
USER_MEM_ARGS=$ECLIPSE_MEM_ARGS
Then, open weblogic server properties (double click at weblogic in servers view) and click "Open launch configuration". In a opened window select "Environment" and add new variable ECLIPSE_MEM_ARGS with memory params as value, e.g.:
ECLIPSE_MEM_ARGS=-Xms1024m -Xmx2048m -XX:MaxPermSize=512m
Save and check that server was applied new configuration.
P.S. Using this approach you can change/add memory params directly from eclipse.
P.S.S. In Windows you should use setDomainEnv.cmd file and added line should be:
set USER_MEM_ARGS=%ECLIPSE_MEM_ARGS%
For Weblogic12:
Environment->Servers->[your_server]->Configuration/Server Start -> Arguments:
-Xms1024m -Xmx2048m
Restart the server:
Environment->Servers->[your_server]->Control/"Start/Stop" -> Suspend and then Start.
Check your memory:
Environment->Servers->[your_server]->Monitoring/Performance.

Passing JVM arguments to Tomcat when running as a service?

I need to pass a couple of JVM arguments to the JVM which Tomcat is running in so that my application can pick them up.
I want to follow the process outlined in this article to pick up environment variables.
How would I go about doing this?
UPDATE
Sorry This is running under windows (7 on my Dev machine 2003 on client server)
Windows:
In your Tomcat /bin folder, you should have a tomcat5w.exe admin app (or in later versions tomcat6w.ex, tomcat8w.exe, etc). Go to the Java tab and add the args in the "Java Options:" box.
Note that when you add new args, you need to add them as NEW LINES in that box (above or below any others there), not as additional arguments IN FRONT or BACK of values on one of the existing lines.
Linux / UNIX:
In *nix, changes to the setenv.sh file should be picked up:
export JAVA_OPTS=-server -Xms2g -Xmx4g -XX:PermSize=64m -XX:MaxPermSize=256m $JAVA_OPTS
Don't touch catalina.sh or other files in bin
You need to edit the Windows service. There are three ways to do this:
Start Tomcat5w with //MS//ServiceName to get an icon in the system tray which gives you a quick access to the configuration of the service.
Open the service manager in the "Control Panel". There is an entry for Tomcat.
In the editor, there is a tab where you can add additional JVM parameters.
The third way (which I prefer) is to write a script which edits the config for you. This way, you can save the config somewhere for backup. See the docs how to do that (Hint: use tomcat5 //US//...)

How to change Java version used by TOMCAT?

I have Java 1.6 and Tomcat 5.5 installed on my system.
But Tomcat 5.5 accesses Java 1.5 and hence as the outcome I get the error Bad version number in .class file while executing java code with JSP.
How can I change the Tomcat version to Java 1.6?
UPDATE
I tried changing the JVM that the tomcat5w.exe is pointing to the version 1.6 and now I am out of the Bad version in .class file error. But now, I get the following error.
exception
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:498)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause
java.lang.NullPointerException
myfirst.SearchLink.checkURL(SearchLink.java:20)
org.apache.jsp.Test_jsp._jspService(Test_jsp.java:52)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
What might be the root cause?
When you open catalina.sh / catalina.bat, you can see :
Environment Variable Prequisites
JAVA_HOME Must point at your Java Development Kit installation.
So, set your environment variable JAVA_HOME to point to Java 6. Also make sure JRE_HOME is pointing to the same target, if it is set.
Update: since you are on Windows, see here for how to manage your environment variables
You can change the JDK or JRE location using the following steps:
open the terminal or cmd.
go to the [tomcat-home]\bin directory.
ex: c:\tomcat8\bin
write the following
command: Tomcat8W //ES//Tomcat8
will open dialog, select the java tab(top pane).
change the Java virtual Machine value.
click OK.
note:
in Apache TomEE same steps, but step (3) the command must be: TomEE //ES
If you use the standard scripts to launch Tomcat (i.e. you haven't installed Tomcat as a windows service), you can use the setenv.bat file, to set your JRE_HOME version.
On Windows, create the file %CATALINA_BASE%\bin\setenv.bat, with content:
set "JRE_HOME=%ProgramFiles%\Java\jre1.6.0_20"
exit /b 0
And that should be it.
You can test this using %CATALINA_BASE%\bin\configtest.bat (Disclaimer: I've only checked this with a Tomcat7 installation).
Further Reading:
http://tomcat.apache.org/tomcat-5.5-doc/RUNNING.txt - Section:
'Advanced Configuration - Multiple Tomcat Instances'
http://tomcat.apache.org/tomcat-7.0-doc/RUNNING.txt - Section: '(3.4)
Using the "setenv" script (optional, recommended)'
In Eclipse it is very easy to point Tomcat to a new JVM (in this example JRE6). My problem was I couldn't find where to do it. Here is the trick:
On the ECLIPSE top menu FILE pull down tab, select NEW, -->Other
...on the New Server: Select A Wizard window, select: Server-> Server... click NEXT
. on the New Server: Define a New Server window, select Apache> Tomcat 7 Server
..now click the line in blue and underlined entitled: Configure Runtime Environments
on the Server Runtime Environments window,
..select Apache, expand it(click on the arrow to the left), select TOMCAT v7.0, and click EDIT.
you will see a window called EDIT SERVER RUNTIME ENVIRONMENT: TOMCAT SERVER
On this screen there is a pulldown labeled JREs.
You should find your JRE listed like JRE1.6.0.33. If not use the Installed JRE button.
Select the desired JRE. Click the FINISH button.
Gracefully exit, in the Server: Server Runtime Environments window, click OK
in the New Server: Define a new Server window, hit NEXT
in the New Server: Add and Remove Window, select apps and install them on the server.
in the New Server: Add and Remove Window, click Finish
That's all. Interesting, only steps 7-10 seem to matter, and they will change the JRE used on all servers you have previously defined to use TOMCAT v7.0. The rest of the steps are just because I can't find any other way to get to the screen except by defining a new server. Does anyone else know an easier way?
There are several good answers on here but I wanted to add one since it may be helpful for users like me who have Tomcat installed as a service on a Windows machine.
Option 3 here: http://www.codejava.net/servers/tomcat/4-ways-to-change-jre-for-tomcat
Basically, open tomcatw.exe and point Tomcat to the version of the JVM you need to use then restart the service. Ensure your deployed applications still work as well.
On Linux, Tomcat7 has a configuration file located at:
/etc/sysconfig/tomcat7
... which is where server specific configurations should be made. You can set the JAVA_HOME env variable here w/o needing to create a profile.d/ script.
This worked for me.
test
open the termenal or cmd.
go to the [tomcat-home]\bin directory.
ex: c:\tomcat8\bin
write the following command: Tomcat8W //ES//Tomcat8
will open dialog, select the java tap(top tap).
change the Java virtual Machine value.

Categories