Notes:
Before you backup the farm you should create a shared folder,The Central Admin backups can run as two different accounts, so you have to make sure they both have access to \\ap01\IT\web-backups2\spbrtoc.xml. The first account is the account that the Central Admin app pool is running as. The second is the account that the SQL service is running as. If they both don't have modify permissions backups and recoveries will fail.
To active the SharePoint 2013 Administrate Server Resolution: Start the administration service- Start the SharePoint Foundation Administration service by using the Services Microsoft Management Console (MMC) snap-in in Windows. ClickStart, click Run and type the following:
-
services.msc
-
If the service fails to start, ensure that the user name and account have membership in the Administrators group on the local computer.
-
If the service could not be started, try to repair the SharePoint Foundation configuration on that server by running the SharePoint Products and Technologies Configuration Wizard.
Verify that the user account that is performing this procedure is a member of the Administrators group on the computer on which you want to create the shared folder.
If you create the shared folder on a computer other than the one running SQL Server, ensure that the service account for SQL Server (MSSQLSERVER) is using a domain user account and that it has Full Control permissions on the shared folder.
On the server on which you want to store the backup data, create a shared folder.
On the Sharing tab of the Properties dialog box, clickShare, and then in the File Sharing dialog box, add the following accounts and assign them the Co-Owner role:
-
SQL Server service account (MSSQLSERVER)
-
The SharePoint Central Administration application pool identity account
-
The SharePoint 2010 Timer service account (if you are using SharePoint Foundation 2010 to perform backups)
To perform this procedure, you must be a member of the Farm Administrators group on the computer that is running Central Administration.
In Central Administration, on the Home page, in the Backup and Restore section, clickPerform a backup.
On the Perform a Backup — Step 1 of 2: Select Component to Back Up page, select the farm from the list of components, and then clickNext.
On the Start Backup — Step 2 of 2: Select Backup Options page, in the Backup Type section, select either Full or Differential.
If you are backing up the farm for the first time, you must use the Full option. You must perform a full backup before you can perform a differential backup.
In the Back Up Only Configuration Settings section, click Back up content and configuration settings.
In the Backup File Location section, type the UNC path of the backup folder, and then clickStart Backup.
You can view the general status of all backup jobs at the top of the Backup and Restore Status page in theReadiness section. You can view the status for the current backup job in the lower part of the page in theBackup section. The status page updates every 30 seconds automatically. You can manually update the status details by clickingRefresh. Backup and recovery are Timer service jobs. Therefore, it may take several seconds for the backup to start.
If you receive any errors, you can review them in the Failure Message column of the Backup and Restore Job Status page. You can also find more details in the Spbackup.log file at the UNC path that you specified in step 6.
看到博客:http://blog.chinaunix.net/space.php?uid=23629988&do=blog&id=2938697中关于整数提升的规则解释,对其中的rank开始理解,原文如下:
他的博文中将rank解释为范围,我还是不大理解。后来查了一些资料,发现解释为“级别”比较准确。即整数转换级别。
整数转换级别(Integer conversion rank)
long long=unsigned long long > long = unsigned long > int =unsigned int > short=unsigned short >char =signed char=unsigned char
并有如下说明
java web项目未开启服务(有没有部署到tomcat中一样)使用this.getClass().getResource("/")得到Url对象,打印如下:
file:/D:/myEclipseWorkspace/你的项目工程名/WebRoot/WEB-INF/classes/
此路径为java web项目源路径。
部署到tomcat中的java web项目开启服务后使用this.getClass().getResource("/")得到Url对象,打印如下:
file:/D:/program/apache-tomcat-6.0.14/webapps/你的项目工程名/WEB-INF/classes/
然后调用toString().substring(6)获得绝对路径的前半部分,加上相对路径,如
conf/jdbc.properties
拼接成配置文件的绝对路径:(这个路径最前面的“/“本人也不清楚是什么意思,但是测试发现有没有那个”/“都能成功)
/F:/D:/program/apache-tomcat-6.0.14/webapps/你的项目工程名/WEB-INF/classes/conf/send.properties
java application项目使用this.getClass().getResource("/")得到Url对象,打印如下:
file:/D:/myEclipseWorkspace/你的项目工程名/bin/
此路径为java application项目的class文件的根路径。
注意:未开启tomcat web服务时打印的不是上面的路径,是你的项目源文件的classes路径。
上面的是本人最近在学习javaWeb时候遇到路径问题的解决方法,以下的是网上搜集到的资料共享一下,未测试
Java中使用的路径,分为两种:绝对路径和相对路径。归根结底,Java本质上只能使用绝对路径来寻找资源。所有的相对路径寻找资源的方法,都不过是一些便利方法。不过是API在底层帮助我们构建了绝对路径,从而找到资源的!
在开发Web方面的应用时, 经常需要获取服务器中当前WebRoot的物理路径。
如果是Servlet , Action , Controller, 或者Filter , Listener , 拦截器等相关类时, 我们只需要获得ServletContext, 然后通过ServletContext.getRealPath("/")来获取当前应用在服务器上的物理地址。
如果在类中取不到ServletContext时,有两种方式可以做到:
1)利用Java的类加载机制:调用 XXX.class.getClassLoader().getResource(""); 方法来获取到ClassPath , 然后处理获得WebRoot目录。
这种方式只能是该class在WebRoot/WEB-INF/classes下才能生效, 如果该class被打包到一个jar文件中, 则该方法失效。这时就应该用下面一种方式。
2)spring框架的思路,在WEB-INF/web.xml中,创建一个webAppRootKey的param,指定一个值(默认为webapp.root)作为键值,然后通过Listener, 或者Filter,或者Servlet 执行String webAppRootKey = getServletContext().getRealPath("/"); 并将webAppRootKey对应的webapp.root 分别作为Key,Value写到System Properties系统属性中。之后在程序中通过System.getProperty("webapp.root")来获得WebRoot的物理路径。
根据第二种的思路,我们还可以再扩展一下。不过对于在部署在一台服务器中的应用来说,若还不是你所需请再往下看。
下面是一些得到classpath和当前类的绝对路径的一些方法。你可使用其中的一些方法来得到你需要的资源的绝对路径:
1.DebitNoteAction.class.getResource("")
得到的是当前类FileTest.class文件的URI目录。不包括自己!
如:file:/D:/eclipse/springTest/WebRoot/WEB-INF/classes/
atacarnet/src/com/evi/modules/atacarnet/action/
2.DebitNoteAction.class.getResource("/")
得到的是当前的classpath的绝对URI路径。
如:file:/D:/eclipse/springTest/WebRoot/WEB-INF/classes/
3.Thread.currentThread().getContextClassLoader().getResource("")
得到的也是当前ClassPath的绝对URI路径
如:file:/D:/eclipse/springTest/WebRoot/WEB-INF/classes/
推荐使用该方法获取。
4.DebitNoteAction.class.getClassLoader().getResource("") 或ClassLoader.getSystemResource("")
得到的也是当前ClassPath的绝对URI路径。
如:file:/D:/eclipse/springTest/WebRoot/WEB-INF/classes/
5.取得服务器相对路径
System.getProperty("user.dir")
例如:E:\apache-tomcat-5.5.16\apache-tomcat-5.5.16\bin
6.取得项目中的绝对路径
一般用request.getRealPath("/")或request.getRealPath("/config/")
但现在不提倡使用request.getRealPath("/")了,大家可试用ServletContext.getRealPath("/")方法得到Web应用程序的根目录的绝对路径。
要取得src的文件非常容易,因为src是默认的相对目录,比如你说要取得src下com目录的test.java文件,你只需要这样就够了
File f = new File(com/test.java);
但如果我要取得不在src目录或者WebRoot目录下的文件呢,而是要从src或者WebRoot同级的目录中取呢,比如说doc吧。
我的硬方法是这样实现的:
String path = this.getServletContext().getRealPath("/");
Properties p = new Properties();
p.load(new FileInputStream(new File(path.substring(0,(path.lastIndexOf("\\WebRoot") + 1)) + "doc/db.properties")));
System.out.println(p.getProperty("driverName"));
-------------------------------
另:Request中getContextPath、getServletPath、getRequestURI、getRequestURL、getRealPath的区别
假定你的web application 名称为news,你在浏览器中输入请求路径:http://localhost:8080/news/main/list.jsp
则执行下面向行代码后打印出如下结果:
1、 System.out.println(request.getContextPath());
打印结果:/news
2、System.out.println(request.getServletPath());
打印结果:/main/list.jsp
3、 System.out.println(request.getRequestURI());
打印结果:/news/main/list.jsp
4、System.out.println(request.getRequestURL());
打印结果:http://localhost:8080/news/main/list.jsp
5、 System.out.println(request.getRealPath("/"));
打印结果:F:\Tomcat 6.0\webapps\news\tes