菜单

weblogic 内存配置

2018年11月15日 - jQuery

pom.xml

改weblogic 使用内存

  

改位置:startWeblogic.sh

<project xmlns=”http://maven.apache.org/POM/4.0.0″
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4\_0\_0.xsd"&gt;
<modelVersion>4.0.0</modelVersion>
<groupId>spring</groupId>
<artifactId>spring-mvc</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>spring-mvc Maven Webapp</name>
<url>http://maven.apache.org&lt;/url&gt;
<!– 初始化参数 –>
<properties>
<spring.version>4.1.1.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>

在尽开头增加使用内存配置信息如下:

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!– Spring Data Jpa –>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.9.1.RELEASE</version>
</dependency>

本身的服务器配置 内存:32G   ,CPU:16  根据实际状况部署

<!– Hibernate –>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.0.1.Final</version>
</dependency>
<!– DataSource Manage –>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
<type>jar</type>
</dependency>
<!– connection Database –>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.15</version>
</dependency>
<!– case Json –>

#!/bin/sh

</dependencies>
<build>
<finalName>spmc</finalName>
<resources>
<!–代表将java目录下之关于xml文件,properties文件编译/打包之早晚在resource目录下
–>
<resource>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
</build>
</project>

 

 

# WARNING: This file is created by the Configuration Wizard.

applicationContext.xml

# Any changes to this script may be lost when adding extensions to this configuration.

    

 

<?xml version=”1.0″ encoding=”UTF-8″?>
<beans xmlns=”http://www.springframework.org/schema/beans”
xmlns:tx=”http://www.springframework.org/schema/tx”
xmlns:context=”http://www.springframework.org/schema/context”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:jee=”http://www.springframework.org/schema/jee”
xmlns:jpa=”http://www.springframework.org/schema/data/jpa”
xsi:schemaLocation=”http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd"&gt;
<!–
注意点的吧可以描绘成spring-context-4.3.xsd,如果非写虽然默认是故时底本
–>

# --- Start Functions ---

<!–启用spring的一些annotation –>
<context:annotation-config />
<!–
注意这里的base-package的价就是是HelloWorldController.java所当的包名
–>
<context:component-scan base-package=”com.cn.*”>
<context:include-filter type=”annotation”
expression=”org.springframework.stereotype.Controller” />
</context:component-scan>
<bean id=”placeholderConfig”
class=”org.springframework.beans.factory.config.PropertyPlaceholderConfigurer”>
<property name=”location” value=”classpath:db.properties” />
</bean>
<!– 直連weblogic控制台設置的數據源 –>
<jee:jndi-lookup id=”masterDataSource” jndi-name=”masterDataSource”
/>

 export
USER_MEM_ARGS=”-Xms4096m -Xmx4096m -Xmn2048m -XX:PermSize=1024m
-XX:MaxPermSize=1024m”

<!– 配置第master DataSource destroy-method用于正常 close DataSource
–>
<!– <bean name=”masterDataSource”
class=”org.apache.commons.dbcp.BasicDataSource”
destroy-method=”close”>
<property name=”driverClassName” value=”${master.jdbc.driverClass}”
/>
<property name=”url” value=”${master.jdbc.jdbcUrl}” />
<property name=”username” value=”${master.jdbc.user}” />
<property name=”password” value=”${master.jdbc.password}” />
</bean> –>
<!– 配置springDataJpa的EntityManage master –>
<bean id=”masterentityManagerFactory”
class=”org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean”>
<property name=”dataSource”
ref=”masterDataSource”></property>
<property name=”jpaVendorAdapter”>
<bean
class=”org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter”></bean>
</property>
<property name=”packagesToScan”
value=”com.cn.master.domain”></property>
<property name=”jpaProperties”>
<props>
<prop
key=”hibernate.ejb.naming_strategy”>org.hibernate.cfg.ImprovedNamingStrategy</prop>
<prop key=”hibernate.hbm2ddl.auto”>update</prop>
<prop key=”hibernate.show_sql”>true</prop>
<!– <prop key=”hibernate.format_sql”>true</prop>
–>
<prop
key=”hibernate.dialect”>org.hibernate.dialect.MySQL5InnoDBDialect</prop>
<!– 緩存 –>
<!– <prop
key=”hibernate.cache.use_second_level_cache”>true</prop>
–>
<!– <prop
key=”hibernate.cache.region.factory_class”>org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
–>
<!– <prop
key=”hibernate.cache.use_query_cache”>true</prop> –>
</props>
</property>
<property name=”sharedCacheMode”
value=”ENABLE_SELECTIVE”></property>
</bean>
<!– 配置事务 –>
<bean id=”mastertransactionManager”
class=”org.springframework.orm.jpa.JpaTransactionManager”>
<property name=”entityManagerFactory”
ref=”masterentityManagerFactory”></property>
</bean>
<!– 配置支持因注解的政工 –>
<tx:annotation-driven
transaction-manager=”mastertransactionManager”/>

stopAll()

<!– 配置 SpringData –>
<jpa:repositories base-package=”com.cn.master.reponitory”
entity-manager-factory-ref=”masterentityManagerFactory”
transaction-manager-ref=”mastertransactionManager”>
</jpa:repositories>

{

<!– slave DataSource GPF–>
<!– 配置第master DataSource destroy-method用于正常 close DataSource
–>
<bean name=”slaveDataSource”
class=”org.apache.commons.dbcp.BasicDataSource”
destroy-method=”close”>
<property name=”driverClassName” value=”${slave.jdbc.driverClass}”
/>
<property name=”url” value=”${slave.jdbc.jdbcUrl}” />
<property name=”username” value=”${slave.jdbc.user}” />
<property name=”password” value=”${slave.jdbc.password}” />
</bean>
<!– 配置springDataJpa的EntityManage master –>
<bean id=”slaveentityManagerFactory”
class=”org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean”>
<property name=”dataSource”
ref=”slaveDataSource”></property>
<property name=”jpaVendorAdapter”>
<bean
class=”org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter”></bean>
</property>
<property name=”packagesToScan”
value=”实体所在包”></property>
<property name=”jpaProperties”>
<props>
<prop
key=”hibernate.ejb.naming_strategy”>org.hibernate.cfg.ImprovedNamingStrategy</prop>
<prop key=”hibernate.hbm2ddl.auto”>update</prop>
<prop key=”hibernate.show_sql”>true</prop>
<!– <prop key=”hibernate.format_sql”>true</prop>
–>
<prop
key=”hibernate.dialect”>org.hibernate.dialect.MySQL5InnoDBDialect</prop>
<!– 緩存 –>
<!– <prop
key=”hibernate.cache.use_second_level_cache”>true</prop>
–>
<!– <prop
key=”hibernate.cache.region.factory_class”>org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
–>
<!– <prop
key=”hibernate.cache.use_query_cache”>true</prop> –>
</props>
</property>
<property name=”sharedCacheMode”
value=”ENABLE_SELECTIVE”></property>
</bean>
<!– 配置事务 –>
<bean id=”slavetransactionManager”
class=”org.springframework.orm.jpa.JpaTransactionManager”>
<property name=”entityManagerFactory”
ref=”slaveentityManagerFactory”></property>
</bean>
<!– 配置支持因注解的事体 –>
<tx:annotation-driven
transaction-manager=”slavetransactionManager”/>

``# We separate the stop commands into a function so we are able to use the trap command in Unix (calling a function) to stop these services

<!– 配置 SpringData –>
<jpa:repositories base-package=”jpareponitory所在包”
entity-manager-factory-ref=”slaveentityManagerFactory”
transaction-manager-ref=”slavetransactionManager”>
</jpa:repositories>

``# STOP DEBUGGER (only if we started it)

</beans>

``if [ "${specialFlag}" = "false" ] ; then

 

``if [ "${debugFlag}" = "true" ] ; then

spring-mvc.xml

``echo "Stopping the Weblogic Workshop debugger..."

    

``${JAVA_HOME}/bin/java -classpath ${DEBUG_CLASSPATH} ${DBG_JAVA_OPTIONS} weblogic.debugging.engine.DbgMain -shutdown  > "${DOMAIN_HOME}/debuggerShutdown.log" 2>&1

<?xml version=”1.0″ encoding=”UTF-8″?>
<beans xmlns=”http://www.springframework.org/schema/beans”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:tx=”http://www.springframework.org/schema/tx”
xmlns:context=”http://www.springframework.org/schema/context”
xmlns:mvc=”http://www.springframework.org/schema/mvc”
xsi:schemaLocation=”http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"&gt;

``echo "Debugger Stopped."

<!– 自动扫描的包名 –>
<context:component-scan base-package=”com.cn.*”>
<context:include-filter type=”annotation”
expression=”org.springframework.stereotype.Controller” />
</context:component-scan>

``fi

<!–
默认的诠释映射的支撑,自动注册DefaultAnnotationHandlerMapping和AnnotationMethodHandlerAdapter
–>
<mvc:annotation-driven />

``fi

<!– 视图解释类 –>
<bean
class=”org.springframework.web.servlet.view.InternalResourceViewResolver”>
<property name=”prefix” value=”/view/” />
<property name=”suffix” value=”.jsp” />
</bean>

``# STOP POINTBASE (only if we started it)

<!– 对静态资源文件之访 –>
<mvc:resources mapping=”/images/**” location=”/WEB-INF/images/”
cache-period=”31556926″ />
<mvc:resources mapping=”/js/**” location=”/WEB-INF/js/”
cache-period=”31556926″ />
<mvc:resources mapping=”/css/**” location=”/WEB-INF/css/”
cache-period=”31556926″ />

``if [ "${pointbaseFlag}" = "true" ] ; then

</beans>

``echo "Stopping Pointbase server..."

 

``${WL_HOME}/common/bin/stopPointBase.sh -port=9093 -name=workshop  > "${DOMAIN_HOME}/pointbaseShutdown.log" 2>&1

 

 

web.xml

``echo "Pointbase server stopped."

   

``fi

<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app version=”2.5″ xmlns=”http://java.sun.com/xml/ns/javaee”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app\_2\_5.xsd"&gt;
<display-name>smvc</display-name>
<!– 在Spring框架中凡是何等化解从页面传来的字符串的编码问题之啊?
下我们来看望Spring框架为咱提供过滤器CharacterEncodingFilter
这个过滤器就是针对性为每次浏览器请求进行过滤的,然后再其上述添加了父类没有底成效就拍卖字符编码。
内部encoding用来安装编码格式,forceEncoding用来安装是否理会
request.getCharacterEncoding()方法,设置也true则强制覆盖前的编码格式。–>
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<!– 过滤器映射 –>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

}

<!– 项目面临利用Spring
时,applicationContext.xml配置文件中连从未BeanFactory,要惦记在工作层中之class
文件中直接引用Spring容器管理的bean可经以下方式–>
<!–1、在web.xml配置监听器ContextLoaderListener–>
<!–ContextLoaderListener的意向就是是开行Web容器时,自动装配ApplicationContext的配置信息。因为她实现了ServletContextListener这个接口,在web.xml配置是监听器,启动容器时,就见面默认执行其实现的方。
以ContextLoaderListener中提到了ContextLoader这个近乎,所以总体加载配置过程由于ContextLoader来成功。
它的API说明
第一段落说明ContextLoader可以由
ContextLoaderListener和ContextLoaderServlet生成。
倘查阅ContextLoaderServlet的API,可以看出她吗干了ContextLoader这个类似以其实现了HttpServlet这个接口
第二段,ContextLoader创建的是
XmlWebApplicationContext这样一个看似,它实现的接口是WebApplicationContext->ConfigurableWebApplicationContext->ApplicationContext->
BeanFactory这样一来spring中的备bean都是因为是仿佛来创造
IUploaddatafileManager uploadmanager = (IUploaddatafileManager)
ContextLoaderListener.getCurrentWebApplicationContext().getBean(“uploadManager”);
–>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!–2、部署applicationContext的xml文件–>
<!–如果当web.xml中莫写任何参数配置信息,默认的路是”/WEB-INF/applicationContext.xml,
以WEB-INF目录下创办的xml文件之称谓必须是applicationContext.xml。
若是是一旦自定义文件称好当web.xml里投入contextConfigLocation这个context参数:
每当<param-value>
</param-value>里指定相应的xml文件称,如果出差不多个xml文件,可以写于合并为“,”号分隔。
也得这样applicationContext-*.xml采用通配符,比如就挺目录下有applicationContext-ibatis-base.xml,
applicationContext-action.xml,applicationContext-ibatis-dao.xml等公事,都见面一起吃载入。
在ContextLoaderListener中涉及了ContextLoader这个近乎,所以总体加载配置过程由于ContextLoader来就。–>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/applicationContext.xml</param-value>
</context-param>
<!–如果您的DispatcherServlet拦截”/”,为了实现REST风格,拦截了有的求,那么又对*.js,*.jpg等静态文件之顾为就为截留了。–>
<!–方案一:激活Tomcat的defaultServlet来处理静态文件–>
<!–要写在DispatcherServlet的先头, 让
defaultServlet先阻止请求,这样要虽未见面进来Spring了,我眷恋性能是太好的吧。–>
<servlet-mapping>
<servlet-name>FileServlet</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FileServlet</servlet-name>
<url-pattern>*.swf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FileServlet</servlet-name>
<url-pattern>*.gif</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FileServlet</servlet-name>
<url-pattern>*.jpg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FileServlet</servlet-name>
<url-pattern>*.png</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FileServlet</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FileServlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FileServlet</servlet-name>
<url-pattern>*.xml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FileServlet</servlet-name>
<url-pattern>*.json</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FileServlet</servlet-name>
<url-pattern>*.map</url-pattern>
</servlet-mapping>
<!–使用Spring
MVC,配置DispatcherServlet是首先步。DispatcherServlet是一个Servlet,,所以可以安排多独DispatcherServlet–>
<!–DispatcherServlet是坐控制器,配置当web.xml文件被的。拦截匹配的呼吁,Servlet拦截匹配规则只要由曾定义,把拦截下来的求,依据之一规则分发至对象Controller(我们形容的Action)来拍卖。–>
<servlet>
<servlet-name>DispatcherServlet</servlet-name><!–于DispatcherServlet的初始化过程遭到,框架会当web应用之
WEB-INF文件夹下搜寻名吧[servlet-name]-servlet.xml
的安排文件,生成文书中定义的bean。–>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!–指明了布置文件的文书称,不动默认配置文件称,而利用dispatcher-servlet.xml配置文件。–>
<init-param>
<param-name>contextConfigLocation</param-name>
<!–其中<param-value>**.xml</param-value>
这里可以使用多写法–>
<!–1、不写,使用默认值:/WEB-INF/<servlet-name>-servlet.xml–>
<!–2、<param-value>/WEB-INF/classes/dispatcher-servlet.xml</param-value>–>
<!–3、<param-value>classpath*:dispatcher-servlet.xml</param-value>–>
<!–4、多单值用逗号分隔–>
<param-value>classpath:spring/spring-mvc.xml</param-value>
</init-param>
<!–是开行顺序,让这Servlet随Servletp容器一起启动。–>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<!–这个Servlet的名是dispatcher,可以发差不多单DispatcherServlet,是经名字来区别的。每一个DispatcherServlet有友好的WebApplicationContext上下文对象。同时保留之ServletContext中以及Request对象中.–>
<!–ApplicationContext是Spring的中坚,Context我们普通说吗上下文环境,我怀念就此“容器”来发表它再爱懂有,ApplicationContext则是“应用之器皿”了:P,Spring把Bean放在这容器中,在需要之时,用getBean方法取出–>
<servlet-name>DispatcherServlet</servlet-name>
<!–Servlet拦截匹配规则可以于曾定义,当映射为@RequestMapping(“/user/add”)时,为例,拦截哪种URL合适?–>
<!–1、拦截*.do、*.htm,
例如:/user/add.do,这是极其俗的法门,最简单易行也绝实用。不见面招致静态文件(jpg,js,css)被挡。–>
<!–2、拦截/,例如:/user/add,可以兑现现在十二分流行的REST风格。很多互联网类型的运特别欣赏这种风格的URL。弊端:会造成静态文件(jpg,js,css)被阻碍后无克正常显示。
–>
<url-pattern>/</url-pattern>
<!–会拦截URL中带“/”的请求。–>
</servlet-mapping>
<welcome-file-list><!–指定欢迎页面–>
<welcome-file>/views/hello.jsp</welcome-file>
</welcome-file-list>
<error-page>
<!–当系统出现404荒谬,跳反至页面nopage.html–>
<error-code>404</error-code>
<location>/view/error.jsp</location>
</error-page>
<error-page>
<!–当系统出现java.lang.NullPointerException,跳反到页面error.html–>
<exception-type>java.lang.NullPointerxception</exception-type>
<location>/view/error.jsp</location>
</error-page>
<session-config><!–会话超时配置,单位分钟–>
<session-timeout>360</session-timeout>
</session-config>
<!– <filter>
<filter-name>checkFilter</filter-name>
<filter-class>com.cn.filter.SessionFliter</filter-class>
</filter>
<filter-mapping>
<filter-name>checkFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> –>
</web-app>

 

  

 

weblogic.xml和web.xml同一目录

    

<weblogic-web-app>
<!– 解決集成jar包沖突 –>
<container-descriptor>
<prefer-application-packages>
<package-name>antlr.*</package-name>
<package-name>org.hibernate.*</package-name>
<package-name>javax.persistence.*</package-name>
</prefer-application-packages>
</container-descriptor>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
<show-archived-real-path-enabled>true</show-archived-real-path-enabled>
</container-descriptor>
<session-descriptor>
<cookie-name>JSESSIONIDCASHIER</cookie-name>
</session-descriptor>
<context-root>/mc</context-root>
</weblogic-web-app>

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图