我正在使用我的Gmail帐户运行这个简单的示例,但它不起作用并给出以下错误:
send failed, exception: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. nv2sm4478384pbb.6
Run Code Online (Sandbox Code Playgroud)
这是我的代码
public class Email
{
public static void main(String [] args)
{
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.googlemail.com");
props.put("mail.from", "myemail@gmail.com");
Session session = Session.getInstance(props, null);
try {
MimeMessage msg = new MimeMessage(session);
msg.setFrom();
msg.setRecipients(Message.RecipientType.TO,
"myemail@hotmail.com");
msg.setSubject("JavaMail hello world example");
msg.setSentDate(new Date());
msg.setText("Hello, world!\n");
Transport.send(msg);
} catch (MessagingException mex) {
System.out.println("send failed, exception: " + mex);
}
}
}
Run Code Online (Sandbox Code Playgroud) 当我在GAE中部署我的应用程序时,我收到此错误
This application does not exist (app_id=u'qsse-ss').
Run Code Online (Sandbox Code Playgroud)
场景是这个应用程序已经由其他一些用户部署到GAE,现在我做了一些更改,我想在GAE中更新,所以现在当我在eclipse中右击我的应用程序并转到"部署到appengine"它给出了我这个错误
我做错了什么,做正确的方法是什么
谢谢
在我的数据库中,我有一个Test表,列有:testName,testType有两个不同的测试,类型相同,即"SUN",所以我只想要其中一个我在hibernate/criteria中使用Distinct,如下所示,它仍然给我两个与"太阳"同名的类型.
Criteria crit = session.createCriteria(Test.class);
final ResultTransformer trans = new DistinctRootEntityResultTransformer();
crit.setResultTransformer(trans);
List rsList = trans.transformList(crit.list());
Run Code Online (Sandbox Code Playgroud)
任何想法可能是什么原因,或任何其他方式过滤重复.
我有两个实体:PlayerProfileEntity和UserInfoEntity我有一个关于userInfoEntity和PlaterProfileEntity的连接并将我的记录保存在数据库中,如下所示:
Session session = sessionFactory.openSession();
Transaction tr = session.beginTransaction();
Criteria crit = session.createCriteria(PlayerProfileEntity.class);
player.setUserId(new UserInfoEntity());
player.getUserId().setAddress(user.getUserId().getAddress());
session.save(player);
tr.commit();
Run Code Online (Sandbox Code Playgroud)
我在我的PlayerProfileEntity类中使用了这个assosiation
@ManyToOne (fetch = FetchType.LAZY)
@Cascade({CascadeType.REFRESH})
@JoinColumn(name="userid")
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.shared.entity.UserInfoEntity
Run Code Online (Sandbox Code Playgroud)
注意:如果我使用CascadeType.All,我收到此错误:
Cannot add or update a child row: a foreign key constraint fails
Run Code Online (Sandbox Code Playgroud)
任何想法我怎么能解决这个问题
谢谢
我正在使用WebDriver运行我的Selenium测试.我正在用一些循环重复测试,所以现在我想在JAVA中开始新的测试之前清除缓存.
@Test
public void ffAndIe() throws InterruptedException {
int i = 0;
while(i < 5000){
driver.get("http://dit-map.appspot.com/");
Thread.sleep(15000);
driver.get("http://dit- map.appspot.com/#home:zoom=7&lat=37.04&lng=25.05&display=weather");
Thread.sleep(15000);
driver.get("http://dit-map.appspot.com/#home:zoom=9&lat=37.55&lng=23.83&display=weather,wind");
Thread.sleep(10000);
driver.get("http://dit-map.appspot.com/#home:zoom=9&lat=37.84&lng=23.22&display=weather,wind,cloud");
Thread.sleep(10000);
driver.get("http://dit-map.appspot.com/?lang=en#home:zoom=10&lat=38.13&lng=22.59&display=weather,wind,meteogram");
Thread.sleep(10000);
i++;
}
}
Run Code Online (Sandbox Code Playgroud)
在这个while循环中,我想要做的第一件事是清除我的CACHE(IE,MOZILLA&CHROME)
任何想法我怎么能实现这一目标?
谢谢
我有一个VBS文件test.vbs C:/work/selenium/chrome/,我想从我的Java程序运行它,所以我尝试了这个,但没有运气:
public void test() throws InterruptedException {
Runtime rt = Runtime.getRuntime();
try {
Runtime.getRuntime().exec( "C:/work/selenium/chrome/test.vbs" );
}
catch( IOException e ) {
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
如果我尝试使用此方法运行某些exe文件,它运行良好,但是当我尝试运行VBS文件时,它说"不是有效的win32应用程序".
知道如何从Java运行VBS文件吗?
我有一个小型GWT应用程序,其中我显示成功的弹出窗口
if(success){
DescoratedPopupPanel popup = new DecoratedPopupPanel();
popup.show();
//Now here i want to wait for like 5 secs and then
popup.hide();
}
Run Code Online (Sandbox Code Playgroud)
任何想法如何在隐藏弹出窗口之前放置5秒的dealay
谢谢
我TabPanel在GWT中创建了一个并添加了标签现在我想获取所选标签,这样如果用户点击关闭按钮,我就可以关闭所选标签.
这是我的tabpanel代码:
TabPanel tabPanelCvs =new TabPanel();
tabPanelCvs.setVisible(true);
tabPanelCvs.setSize("900","800");
VerticalPanel vpnlCvsTab = new VerticalPanel();
tabPanelCvs.add(vpnlCvsTab,result.getResumeTitle());
Run Code Online (Sandbox Code Playgroud)
不知道怎样才能获得我选中的标签TabPanel?
我想将我的模块名称从测试重命名为测试,但是当我将它从重构更改为测试时,它说
unable to find test.gwt.xml
Run Code Online (Sandbox Code Playgroud)
它还在寻找以前的模块名称..
我怎么解决这个问题
thanks9 +
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='test'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
Run Code Online (Sandbox Code Playgroud) 如何将我的Html更改为SafeHtml
Html htmlText = new Html();
htmlText.setText(result.getText());
Run Code Online (Sandbox Code Playgroud)
我在htmlText中保存了一份简历,但我想将其保存为SafeHtml
如何将上述html转换为safehtml?
谢谢