java操作sqoop在本地测试正常打包发布到阿里云服务器报错

在做项目时,把sqoop和mapreduce集成到springboot中做数据抽取和计算,并打成jar包上传到服务器,项目是使用eureka进行注册提供服务,父项目下创建子模块,通过maven的package打包子模块。
通过以下命令在服务器运行

# nohup和&组合在后台运行  运行时会在当前目录下生成一个nohup.out日志文件
[root@fda ~]# nohup java -jar XXX.jar &

Sqoop版本1.4.7
Hadoop版本2.7.7
当进行sqoop的数据抽取时报错信息如下

2021-02-27 19:24 | [34mINFO [0;39m | [1;33mtask-1[0;39m | [1;32mo.a.sqoop.orm.CompilationManager[0;39m | $HADOOP_MAPRED_HOME is not set
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:7: error: package org.apache.hadoop.io does not exist
import org.apache.hadoop.io.BytesWritable;
                           ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:8: error: package org.apache.hadoop.io does not exist
import org.apache.hadoop.io.Text;
                           ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:9: error: package org.apache.hadoop.io does not exist
import org.apache.hadoop.io.Writable;
                           ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:10: error: package org.apache.hadoop.mapred.lib.db does not exist
import org.apache.hadoop.mapred.lib.db.DBWritable;
                                      ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:11: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.JdbcWritableBridge;
                             ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:12: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.DelimiterSet;
                             ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:13: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.FieldFormatter;
                             ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:14: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.RecordParser;
                             ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:15: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.BooleanParser;
                             ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:16: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.BlobRef;
                             ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:17: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.ClobRef;
                             ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:18: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.LargeObjectLoader;
                             ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:19: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.SqoopRecord;
                             ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:37: error: cannot find symbol
public class Users extends SqoopRecord  implements DBWritable, Writable {
                           ^
  symbol: class SqoopRecord
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:37: error: cannot find symbol
public class Users extends SqoopRecord  implements DBWritable, Writable {
                                                   ^
  symbol: class DBWritable
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:37: error: cannot find symbol
public class Users extends SqoopRecord  implements DBWritable, Writable {
                                                               ^
  symbol: class Writable
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:137: error: cannot find symbol
  public void loadLargeObjects(LargeObjectLoader __loader)
                               ^
  symbol:   class LargeObjectLoader
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:140: error: cannot find symbol
  public void loadLargeObjects0(LargeObjectLoader __loader)
                                ^
  symbol:   class LargeObjectLoader
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:217: error: cannot find symbol
  private static final DelimiterSet __outputDelimiters = new DelimiterSet((char) 9, (char) 10, (char) 0, (char) 0, false);
                       ^
  symbol:   class DelimiterSet
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:221: error: cannot find symbol
  public String toString(DelimiterSet delimiters) {
                         ^
  symbol:   class DelimiterSet
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:227: error: cannot find symbol
  public String toString(DelimiterSet delimiters, boolean useRecordDelim) {
                         ^
  symbol:   class DelimiterSet
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:240: error: cannot find symbol
  public void toString0(DelimiterSet delimiters, StringBuilder __sb, char fieldDelim) {
                        ^
  symbol:   class DelimiterSet
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:247: error: cannot find symbol
  private static final DelimiterSet __inputDelimiters = new DelimiterSet((char) 9, (char) 10, (char) 0, (char) 0, false);
                       ^
  symbol:   class DelimiterSet
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:248: error: cannot find symbol
  private RecordParser __parser;
          ^
  symbol:   class RecordParser
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:249: error: cannot find symbol
  public void parse(Text __record) throws RecordParser.ParseError {
                    ^
  symbol:   class Text
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:249: error: package RecordParser does not exist
  public void parse(Text __record) throws RecordParser.ParseError {
                                                      ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:257: error: package RecordParser does not exist
  public void parse(CharSequence __record) throws RecordParser.ParseError {
                                                              ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:265: error: package RecordParser does not exist
  public void parse(byte [] __record) throws RecordParser.ParseError {
                                                         ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:273: error: package RecordParser does not exist
  public void parse(char [] __record) throws RecordParser.ParseError {
                                                         ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:281: error: package RecordParser does not exist
  public void parse(ByteBuffer __record) throws RecordParser.ParseError {
                                                            ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:289: error: package RecordParser does not exist
  public void parse(CharBuffer __record) throws RecordParser.ParseError {
                                                            ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:128: error: cannot find symbol
    this.mobile = JdbcWritableBridge.readString(1, __dbResults);
                  ^
  symbol:   variable JdbcWritableBridge
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:129: error: cannot find symbol
    this.userName = JdbcWritableBridge.readString(2, __dbResults);
                    ^
  symbol:   variable JdbcWritableBridge
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:130: error: cannot find symbol
    this.password = JdbcWritableBridge.readString(3, __dbResults);
                    ^
  symbol:   variable JdbcWritableBridge
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:133: error: cannot find symbol
    this.mobile = JdbcWritableBridge.readString(1, __dbResults);
                  ^
  symbol:   variable JdbcWritableBridge
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:134: error: cannot find symbol
    this.userName = JdbcWritableBridge.readString(2, __dbResults);
                    ^
  symbol:   variable JdbcWritableBridge
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:135: error: cannot find symbol
    this.password = JdbcWritableBridge.readString(3, __dbResults);
                    ^
  symbol:   variable JdbcWritableBridge
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:148: error: cannot find symbol
    JdbcWritableBridge.writeString(mobile, 1 + __off, 12, __dbStmt);
    ^
  symbol:   variable JdbcWritableBridge
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:149: error: cannot find symbol
    JdbcWritableBridge.writeString(userName, 2 + __off, 12, __dbStmt);
    ^
  symbol:   variable JdbcWritableBridge
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:150: error: cannot find symbol
    JdbcWritableBridge.writeString(password, 3 + __off, 12, __dbStmt);
    ^
  symbol:   variable JdbcWritableBridge
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:154: error: cannot find symbol
    JdbcWritableBridge.writeString(mobile, 1 + __off, 12, __dbStmt);
    ^
  symbol:   variable JdbcWritableBridge
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:155: error: cannot find symbol
    JdbcWritableBridge.writeString(userName, 2 + __off, 12, __dbStmt);
    ^
  symbol:   variable JdbcWritableBridge
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:156: error: cannot find symbol
    JdbcWritableBridge.writeString(password, 3 + __off, 12, __dbStmt);
    ^
  symbol:   variable JdbcWritableBridge
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:164: error: cannot find symbol
    this.mobile = Text.readString(__dataIn);
                  ^
  symbol:   variable Text
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:169: error: cannot find symbol
    this.userName = Text.readString(__dataIn);
                    ^
  symbol:   variable Text
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:174: error: cannot find symbol
    this.password = Text.readString(__dataIn);
                    ^
  symbol:   variable Text
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:182: error: cannot find symbol
    Text.writeString(__dataOut, mobile);
    ^
  symbol:   variable Text
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:188: error: cannot find symbol
    Text.writeString(__dataOut, userName);
    ^
  symbol:   variable Text
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:194: error: cannot find symbol
    Text.writeString(__dataOut, password);
    ^
  symbol:   variable Text
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:202: error: cannot find symbol
    Text.writeString(__dataOut, mobile);
    ^
  symbol:   variable Text
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:208: error: cannot find symbol
    Text.writeString(__dataOut, userName);
    ^
  symbol:   variable Text
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:214: error: cannot find symbol
    Text.writeString(__dataOut, password);
    ^
  symbol:   variable Text
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:217: error: cannot find symbol
  private static final DelimiterSet __outputDelimiters = new DelimiterSet((char) 9, (char) 10, (char) 0, (char) 0, false);
                                                             ^
  symbol:   class DelimiterSet
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:230: error: cannot find symbol
    __sb.append(FieldFormatter.escapeAndEnclose(mobile==null?"\\N":mobile, delimiters));
                ^
  symbol:   variable FieldFormatter
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:232: error: cannot find symbol
    __sb.append(FieldFormatter.escapeAndEnclose(userName==null?"\\N":userName, delimiters));
                ^
  symbol:   variable FieldFormatter
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:234: error: cannot find symbol
    __sb.append(FieldFormatter.escapeAndEnclose(password==null?"\\N":password, delimiters));
                ^
  symbol:   variable FieldFormatter
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:241: error: cannot find symbol
    __sb.append(FieldFormatter.escapeAndEnclose(mobile==null?"\\N":mobile, delimiters));
                ^
  symbol:   variable FieldFormatter
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:243: error: cannot find symbol
    __sb.append(FieldFormatter.escapeAndEnclose(userName==null?"\\N":userName, delimiters));
                ^
  symbol:   variable FieldFormatter
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:245: error: cannot find symbol
    __sb.append(FieldFormatter.escapeAndEnclose(password==null?"\\N":password, delimiters));
                ^
  symbol:   variable FieldFormatter
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:247: error: cannot find symbol
  private static final DelimiterSet __inputDelimiters = new DelimiterSet((char) 9, (char) 10, (char) 0, (char) 0, false);
                                                            ^
  symbol:   class DelimiterSet
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:251: error: cannot find symbol
      this.__parser = new RecordParser(__inputDelimiters);
                          ^
  symbol:   class RecordParser
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:259: error: cannot find symbol
      this.__parser = new RecordParser(__inputDelimiters);
                          ^
  symbol:   class RecordParser
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:267: error: cannot find symbol
      this.__parser = new RecordParser(__inputDelimiters);
                          ^
  symbol:   class RecordParser
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:275: error: cannot find symbol
      this.__parser = new RecordParser(__inputDelimiters);
                          ^
  symbol:   class RecordParser
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:283: error: cannot find symbol
      this.__parser = new RecordParser(__inputDelimiters);
                          ^
  symbol:   class RecordParser
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:291: error: cannot find symbol
      this.__parser = new RecordParser(__inputDelimiters);
                          ^
  symbol:   class RecordParser
  location: class Users
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:363: error: cannot find symbol
    Users o = (Users) super.clone();
                      ^
  symbol:   variable super
  location: class Users
67 errors
2021-02-27 19:24 | [1;31mERROR[0;39m | [1;33mtask-1[0;39m | [1;32morg.apache.sqoop.tool.ImportTool[0;39m | Import failed: java.io.IOException: Error returned by javac
	at org.apache.sqoop.orm.CompilationManager.compile(CompilationManager.java:226)
	at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:107)
	at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:501)
	at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:628)
	at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
	at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
	at zut.edu.service.impl.DataExtractionServiceImpl.sqoopTask(DataExtractionServiceImpl.java:123)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

这里一共有两个问题第一个问题

/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:7: error: package org.apache.hadoop.io does not exist
import org.apache.hadoop.io.BytesWritable;
                           ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:8: error: package org.apache.hadoop.io does not exist
import org.apache.hadoop.io.Text;
                           ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:9: error: package org.apache.hadoop.io does not exist
import org.apache.hadoop.io.Writable;

这是由于阿里云的环境变量没有配置完整Hadoop的环境变量。在服务器的 /etc/profile 中添加如下配置
#Hadoop环境变量

[root@fda ~]# vim /etc/profile
#添加下面的内容
export HADOOP_HOME=/opt/module/Hadoop/hadoop-2.7.7
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export HADOOP_LOG_DIR=$HADOOP_HOME/logs
export YARN_HOME=$HADOOP_HOME
export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop
export YARN_LOG_DIR=$HADOOP_LOG_DIR
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin

第一个问题解决。
第二个问题是

/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:11: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.JdbcWritableBridge;
                             ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:12: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.DelimiterSet;
                             ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:13: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.FieldFormatter;
                             ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:14: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.RecordParser;
                             ^
/tmp/sqoop-root/compile/f677c4605f731efc068e40b146260436/Users.java:15: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.BooleanParser;

报的sqoop的找不到sqoop-1.4.7.jar下面的类,打开打成的可执行jar包,在BOOT-INF\lib下确实有sqoop-1.4.7.jar,找了好几天最终发现问题,是因为打包的原因,但是又找不到怎样去打包,索性直接把原来的后台项目架构改成了单体的springboot项目,打成war包部署到服务器,问题解决。

原来打包问题待进一步研究……如果小伙伴有解决方案,请与我分享一下,感谢!!!

已标记关键词 清除标记
简介 笔者当初为了学习JAVA,收集了很多经典源码,源码难易程度分为初级、中级、高级等,详情看源码列表,需要的可以直接下载! 这些源码反映了那时那景笔者对未来的盲目,对代码的热情、执着,对IT的憧憬、向往!此时此景,笔者只专注Android、Iphone等移动平台开发,看着这些源码心中有万分感慨,写此文章纪念那时那景! Java 源码包 Applet钢琴模拟程序java源码 2个目标文件,提供基本的音乐编辑功能。编辑音乐软件的朋友,这款实例会对你有所帮助。 Calendar万年历 1个目标文件 EJB 模拟银行ATM流程及操作源代码 6个目标文件,EJB来模拟银行ATM机的流程及操作:获取系统属性,初始化JNDI,取得Home对象的引用,创建EJB对象,并将当前的计数器初始化,调用每一个EJB对象的count()方法,保证Bean正常被激活和钝化,EJB对象是用完毕,从内存中清除,从账户中取出amt,如果amt>账户余额抛出异常,一个实体Bean可以表示不同的数据实例,我们应该通过主键来判断删除哪个数据实例…… ejbCreate函数用于初始化一个EJB实例 5个目标文件,演示Address EJB的实现 ,创建一个EJB测试客户端,得到名字上下文,查询jndi名,通过强制转型得到Home接口,getInitialContext()函数返回一个经过初始化的上下文,用client的getHome()函数调用Home接口函数得到远程接口的引用,用远程接口的引用访问EJB。 EJB中JNDI的使用源码例子 1个目标文件,JNDI的使用例子,有源代码,可以下载参考,JNDI的使用,初始化Context,它是连接JNDI树的起始点,查找你要的对象,打印找到的对象,关闭Context…… ftp文件传输 2个目标文件,FTP的目标是:(1)提高文件的共享性(计算机程序和/或数据),(2)鼓励间接地(通过程序)使用远程计算机,(3)保护用户因主机之间的文件存储系统导致的变化,(4)为了可靠和高效地传输,虽然用户可以在终端上直接地使用它,但是它的主要作用是供程序使用的。本规范尝试满足大型主机、微型主机、个人工作站、和TACs 的不同需求。例如,容易实现协议的设计。 Java EJB中有、无状态SessionBean的两个例子 两个例子,无状态SessionBean可会话Bean必须实现SessionBean,获取系统属性,初始化JNDI,取得Home对象的引用,创建EJB对象,计算利息等;在有状态SessionBean中,用累加器,以对话状态存储起来,创建EJB对象,并将当前的计数器初始化,调用每一个EJB对象的count()方法,保证Bean正常被激活和钝化,EJB对象是用完毕,从内存中清除…… Java Socket 聊天通信演示代码 2个目标文件,一个服务器,一个客户端。 Java Telnet客户端实例源码 一个目标文件,演示Socket的使用。 Java 组播组中发送和接受数据实例 3个目标文件。 Java读写文本文件的示例代码 1个目标文件。 java俄罗斯方块 一个目标文件。 Java非对称加密源码实例 1个目标文件 摘要:Java源码,算法相关,非对称加密   Java非对称加密源程序代码实例,本例中使用RSA加密技术,定义加密算法可用 DES,DESede,Blowfish等。   设定字符串为“张三,你好,我是李四”   产生张三的密钥对(keyPairZhang)   张三生成公钥(publicKeyZhang)并发送给李四,这里发送的是公钥的数组字节   通过网络或磁盘等方式,把公钥编码传送给李四,李四接收到张三编码后的公钥,将其解码,李四用张三的公钥加密信息,并发送给李四,张三用自己的私钥解密从李四处收到的信息…… Java利用DES私钥对称加密代码实例 同上 java聊天室 2个目标文件,简单。 java模拟掷骰子2个 1个目标文件,输出演示。 java凭图游戏 一个目标文件,简单。 java求一个整数的因子 如题。 Java生成密钥的实例 1个目标文件 摘要:Java源码,算法相关,密钥   Java生成密钥、保存密钥的实例源码,通过本源码可以了解到Java如何产生单钥加密的密钥(myKey)、产生双钥的密钥对(keyPair)、如何保存公钥的字节数组、保存私钥到文件privateKey.dat、如何用Java对象序列化保存私钥,通常应对私钥加密后再保存、如何从文件中得到公钥编码的字节数组、如何从字节数组解码公钥。 Java数据压缩与传输实例 1个目标文件 摘要:Java源码,文件操作,数据压缩,文件传输   Java数据压缩与传输实例,可以学习一下实例化套按字、得到文件输入流、压缩输入流、文件输出流、实例化缓冲
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页