Configurations 
This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009
111 Sutter Street, Suite 1800, San Francisco, , 94104
Download at WoweBook.Com
Table of Contents
[ ii ]
Dependencies 
High-level architecture 
Class loader architecture 
Modifying default class loading behavior 
Important modules 
Server directory structure 
Deployment architecture 
Deployer 
Repository 
Configuration builder 
Module builder 
Module builder extension 
Naming builder 
Hot deployment 
Deployment watcher 
Plugins 
Plugin catalog and plugin repository 
Custom server assemblies 
Extensible Administration Console 
Summary 
Chapter 3: Database Connectivity 
Database pool scopes 
Creating a server-wide database pool 
Using the Administration Console Wizard 
Installing unlisted drivers 
Using the Deploy New portlet 
Using the command-line deployer 
Using GShell 
Creating an application-scoped database pool 
Creating a client-scoped pool 
Editing an existing pool 
Importing a pool from another application server 
Creating an XA pool 
Using a database pool in an application 
Accessing a server-scoped database pool 
Accessing an application-scoped database pool from  
the same application 
Accessing an application-scoped database pool from  
a different application 
Summary 
This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009
111 Sutter Street, Suite 1800, San Francisco, , 94104
Download at WoweBook.Com
Table of Contents
[ iii ]
Chapter 4: JMS Connectivity 
Message broker configuration 
GBean configuration 
Using the Administration Console 
JMS resource scopes 
Creating JMS resources 
Creating Server-wide JMS resources 
Using the Administration Console Wizard 
Using the Deploy New portlet 
Using the command-line deployer 
Using GShell 
Creating application-scoped JMS resources 
Creating application client-scoped JMS resources 
Using JMS resources in an application 
Connecting to a different provider 
Summary 
Chapter 5: Java EE Application Deployment 
Deployment of applications 
Deployment descriptors 
Deployment plans 
The deploy tool 
Deployment from the Administration Console 
Deployment through GShell 
Web modules 
Servlet 
Filter 
Listener 
Web deployment descriptor 
Annotations 
Resource annotation 
EJB annotation 
Web deployment plan 
Tomcat specific configuration 
Jetty specific configuration 
Sample web application 
EJB applications 
Annotations 
EJB deployment plan 
Sample EJB application 
Deploy the JMS resources 
Deploy the EJB sample 
Deploy the Web application 
This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009
111 Sutter Street, Suite 1800, San Francisco, , 94104
Download at WoweBook.Com
Table of Contents
[ iv ]
JPA Applications 
Annotations 
Container-managed persistence 
CMP sample application 
Bean-managed persistence 
BMP sample application 
Enterprise applications 
Deployment plan  
Application clients 
Deployment plan 
JavaMail 
Web Services 
EAR sample application 
Deploying an EJB web service 
Transactions 
Container-managed transactions 
Annotations 
TransactionManagement 
TransactionAttribute 
Bean-managed transactions 
Support in Geronimo 
Setting transaction timeout 
Transaction isolation levels 
Transactions in web applications 
Summary 
Chapter 6: Security 
Overview of security standards 
Java Authentication and Authorization Service (JAAS) 
Java Authorization Contract for Containers (JACC) 
The Common Secure Interoperability Version 2 (CSIv2) protocol 
Securing the server directory 
Securing the Administration Console, JMX server, and deployer 
Securing the embedded Derby database 
Updating database pools 
Cryptographic security 
Keystores 
Keystores portlet 
Creating a new keystore 
Viewing the contents of a keystore 
Adding a private key 
Adding a trusted certificate 
Deleting a private key or trusted certificate 
Changing a keystore password 
This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009
111 Sutter Street, Suite 1800, San Francisco, , 94104
Download at WoweBook.Com
Table of Contents
[ v ]
Unlocking keystore for availability 
Unlocking a keystore for editing 
Locking a keystore for editing or availability 
View private key details 
Changing a Private Key password 
Generating CSR for a Private Key 
Importing the CA Reply for a Private Key 
Preparing a keystore for use with SSL 
Certificate Authority portlet 
Protecting passwords 
HTTPS connectors 
Tomcat HTTPS connectors 
Jetty HTTPS connectors 
JAAS login modules 
Login modules for authentication 
PropertiesFile login module 
SQL login module 
LDAP login module 
CertificatePropertiesFile login module 
Using custom login modules 
Special purpose login modules 
FileAudit login module 
RepeatedFailureLockout login module 
GeronimoPasswordCredential login module 
NamedUsernamePasswordCredential login module 
Security realms 
Creating a security realm 
Using the Security Realms portlet 
Security realm deployment plan 
Principal wrapping 
Application security 
Configuring web application security 
Running the sample web application 
Configuring EJB application security 
Defining security roles in the deployment descriptor 
Declaring method permissions in the deployment descriptor 
Using annotations to define roles and permissions 
Mapping principals to roles in the EJB deployment plan 
Running the EJB sample application 
Configuring entity bean security 
Run-as and default subjects 
Credential store 
Configuring an application to use a credential store 
Configuring run-as and default subjects 
Running a sample EJB application with run-as 
Configuring message-driven bean security 
This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009
111 Sutter Street, Suite 1800, San Francisco, , 94104
Download at WoweBook.Com
Table of Contents
[ vi ]
Configuring EAR application security 
Application-scoped security realms 
Single sign-on (SSO) 
Replacing the default security realm 
Summary 
Chapter 7: CORBA 
CORBA concepts 
Naming service 
Security services 
Support in Geronimo 
Exposing EJBs through CORBA 
Creating a Target Security Service (TSS) 
Authentication mechanism 
Identity Tokens 
Configuring EJB to use TSS 
Sample application exposing EJBs through CORBA 
Deploying and running the sample EJB application 
Referencing EJBs through CORBA 
Creating a Client Security Service (CSS) 
Authentication mechanism 
Identity tokens 
Configuring the EJB reference to use CSS 
Sample web application accessing CORBA EJBs 
Sample CSS 
Deploying and running the sample 
Summary 
Chapter 8: Naming and JNDI 
Application local JNDI context 
resource-ref 
resource-env-ref 
ejb-ref 
ejb-local-ref 
service-ref 
message-destination-ref 
persistence-context-ref 
persistence-unit-ref 
gbean-ref 
This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009
111 Sutter Street, Suite 1800, San Francisco, , 94104
Download at WoweBook.Com
Table of Contents
[ vii ]
Global JNDI 
Summary 
Chapter 9: Geronimo Plugins 
Developing a plugin 
Creating a plugin project 
Installing a plugin 
Available plugins 
Pluggable Administration Console 
Architecture 
Developing an Administration Console extension 
Plugins portlet 
Custom server assemblies and server profiles  
Summary 
Chapter 10: Administration 
Administration Console 
Server portlets 
Information portlet 
Java System Info portlet 
Server Logs portlet 
Shutdown portlet 
Web Server portlet 
Thread Pools portlet 
Apache HTTP portlet 
JMS Server portlet 
Monitoring portlet 
Services portlets 
Repository portlet 
Database Pools portlet 
JMS Resources portlet 
Applications portlets 
Deploy New portlet 
System Modules portlet 
Web App WARs portlet 
EJB JARs portlet 
Application EARs portlet 
J2EE connectors portlet 
App Clients portlet 
Plan Creator portlet 
Embedded DB portlets 
DB Info portlet 
DB Manager portlet 
Debug Views portlets 
JMX Viewer portlet 
LDAP Viewer portlet 
This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009
111 Sutter Street, Suite 1800, San Francisco, , 94104
Download at WoweBook.Com
Table of Contents
[ viii ]
ClassLoader Viewer portlet 
JNDI Viewer portlet 
Dependency Viewer portlet 
Web Server administration 
HTTP connectors 
HTTPS connectors 
AJP connectors 
Web Server Logs 
JMS server administration 
JMS listeners 
Monitoring the server 
Adding a Server 
Adding a Graph 
Creating a new view 
GShell 
Starting and exiting GShell 
Getting help 
Supported commands 
Summary 
Chapter 11: Geronimo Eclipse Plugin 
Eclipse and the web tools framework 
Download and installation 
GEP download and installation 
Developing an application in GEP 
Deploying and running or debugging the application in Geronimo 
Summary 
Chapter 12: Clustering 
Updating deployment descriptor and deployment plan 
Load balancing with Apache web server 
Installing the Apache web server 
Web app in Geronimo served through Apache web server 
Apache HTTP portlet 
Accessing the sample app through Apache web server 
Running multiple server instances from a single installation 
Clustered Helloworld-cluster application 
Updating workers.properties 
Farming 
Cluster member configuration 
This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009
111 Sutter Street, Suite 1800, San Francisco, , 94104
Download at WoweBook.Com
Table of Contents
[ ix ]
Farm deployment 
Running a sample application with Farm deployment 
Summary 
Chapter 13: Logging 
Configuring Apache Geronimo logging 
Configuring application logging 
Using log4j 
Logging to the geronimo.log file and the command console 
Logging to a separate log file 
Logging using the ApplicationLog4jConfigurationGBean 
Using the Java Logging API 
Using the SLF4j logging adapter 
Summary 
Chapter 14: Geronimo Internals 
Services provided by Geronimo 
Kernel 
ServerInfo 
Configurations and deployment 
ConfigurationManager 
EditableConfigurationManager 
LocalAttributeManager 
ArtifactResolver 
Developing a new GBean 
GBean attributes 
Magic attributes 
GBean references 
GBean operations 
GBean constructor 
GBean interface 
GBeanLifecycle 
Sample GBean MySampleGBean 
Deploying the GBean 
Testing the GBean with GBean web app sample 
Summary 
Appendix A: Deployment Plans 
Environment 
GBeans 
Application Client 
This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009
111 Sutter Street, Suite 1800, San Francisco, , 94104
Download at WoweBook.Com
Table of Contents
[ x ]
Appendix B: Troubleshooting 
Server startup errors 
Bind
  
   Exception
  
  IllegalArgument
  
   Exception
  
  due to a wrong instance name 
InvalidConfiguration
  
   Exception
  
  Deployment errors 
MissingDependency
  
   Exception
  
  
   Xml
  
  
   Exception
  
  —Invalid deployment descriptor 
DuplicateDeployment
  
   Exception
  
  Runtime errors 
Login
  
   Exception
  
  —No LoginModules configured 
Index
  
   在操作excel表格时,因为
   
    存在
   
   Excel2003和Excel2007两种版本的excel表格,所有如果jar包引入不够,会报一些异常,如:
执行到这一样时:new XSSFWorkbook(stream);
异常:Caused by: java.lang.ClassNotFound
   
    Exception
   
   : org.apache.
   
    xml
   
   beans.
   
    Xml
   
   
    Exception
   
   这个异常时因为缺少jar包,jar包的名字是:
   
    xml
   
   beans-2.3.0.jar
解决了这个以后,还可能会出现另一个异常:
	Caused by: java.lang.ClassNotFound
   
    Exception
   
   : org.open
   
    xml
   
   formats.schemas.spreadsheetml.x2006.main.CTSheet
这个是因为,使用POI中的XSSFWorkbook操作excel2007(xlsx)的时候抛出的异常:
解决方案:
poi包中默认不支持excel2007,如果需要解析,则需要引入poi-oo
   
    xml
   
   -schemas-xx.jar包。
引入此包后,可能还会有个异常,原因是找不到dom4j的jar包。
因为poi-oo
   
    xml
   
   -schemas-xx.jar需要依赖dom4j-xxx.jar包
  
  
   "System.
   
    Xml
   
   .
   
    Xml
   
   
    Exception
   
   "类型的未处理的异常在System.
   
    Xml
   
   .dll中发生。其他:缺少
   
    根
   
   
    元素
   
   问题背景:
可能是因为强制断电,导致电脑里文件出错,原本运行正常的程序出现报错_“缺少
   
    根
   
   
    元素
   
   ”。
处理方法:
删除C:\Users\admin\AppData\Roaming\“出错的程序名称”\test\1.0.0.0里面的那个文件。
如果怕删错了,建议先备份该文件,再尝试...
  
  
   1、
   
    错误
   
   描述
   
    Exception
   
   in thread "main" java.lang.NoClassDefFoundError: org/apache/
   
    xml
   
   beans/
   
    Xml
   
   
    Exception
   
   at com.you.print.ExcelUtils.replaceModel(ExcelUtils.java:21)
	at com.you.print.TestReplaceExcel.main(
  
  点关注不迷路,持续输出Unity干货文章。
嗨,大家好,我是新发。
在Unity项目开中,我们读取
  
   XML
  
  配置表时,如果
  
   XML
  
  的编码格式是UTF-8 带BOM头的话,在移动端解析
  
   XML
  
  会报错:
  
   Xml
  
  
   Exception
  
  : Text node cannot appear in this state.  Line 1, position 1
特别是多人协作的项目,大家使用的文本编辑器不
  
   汇总了jox所有依赖的包,可以支持
   
    xml
   
   与javabean之间相互转换,我也是在逐步调试过程中,把这些包汇总上来的,jox的站点已经停止访问了,放在这里方便大家下载。生成的
   
    xml
   
   可以格式化还有中文解决等。JOXBeanOutputStream joxOut = new JOXBeanOutputStream(
   
    xml
   
   Data,"UTF-8"); 
包含的jar有
   
    xml
   
   -apis.jar javabean2
   
    xml
   
   .jar jox-1.17b3.jar dtdparser-1.21.jar 。
  
  
   XML
  
  被设计用来传输和存储数据。
  
   XML
  
  被设计用来结构化、存储以及传输信息。
  
   xml
  
  文档展示
<?
  
   xml
  
  version="1.0" encoding="ISO-8859-1"?>
George
Reminder
Don't forget the meeting!
这个
  
   XML
  
  文档仍然没有做任何事情。它仅仅是包装在
  
   XML
  
  标签中的纯...
  
   好的,我可以回答您的问题。
针对您的需求,您可以使用Java和Spring Boot来编写一个RESTful API接口,该接口可以接收docx文件和关键词作为输入,并对上传的文件进行扫描以计算关键词的出现次数。
以下是该接口的代码示例:
@PostMapping("/countKeywords")
public ResponseEntity<String> countKeywords(@RequestParam("file") MultipartFile file, @RequestParam("keyword") String keyword) {
    try {
        // 将上传的docx文件转换为文本
        String content = readDocxFile(file);
        // 计算出现次数
        int count = countKeywordOccurrences(content, keyword);
        // 返回结果
        return ResponseEntity.ok("关键词 '" + keyword + "' 在文档中出现了 " + count + " 次。");
    } catch (
   
    Exception
   
   e) {
        e.printStackTrace();
        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("出现了一些问题,请稍后重试。");
private String readDocxFile(MultipartFile file) throws IO
   
    Exception
   
   ,
   
    Xml
   
   
    Exception
   
   {
    XWPFDocument doc = new XWPFDocument(file.getInputStream());
    XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
    return extractor.getText();
private int countKeywordOccurrences(String content, String keyword) {
    String[] words = content.split("\\W+");
    int count = 0;
    for (String word : words) {
        if (word.equalsIgnoreCase(keyword)) {
            count++;
    return count;
在这个示例代码中,我们首先定义了一个POST请求处理器,该处理器的路由地址为"/countKeywords"。这个处理器接收两个参数,一个是上传的文件,另一个是待查询的关键词。
接着,我们调用了两个辅助函数。第一个函数`readDocxFile()`将上传的docx文件转换为文本格式,以便我们进行关键词的查询。第二个函数`countKeywordOccurrences()`是关键词出现次数的计算函数,它通过将文本拆分为单词,并逐个比较单词与关键词的值来计算关键词的出现次数。
最后,我们将处理结果封装为一个字符串并发送回客户端。
希望这个代码示例能够帮助您解决问题,如有任何疑问,欢迎随时向我提问。