Flags seen = new Flags(Flags.Flag.RECENT);
FlagTerm unseenFlagTerm = new FlagTerm(seen, false);
messages = inbox.search(unseenFlagTerm);
Tuesday, November 26, 2019
How to Retrieve all unread emails using javamail with POP3 protocol
This code will be work
How to fix Plugin with id 'com.github.dcendents.android-maven' not found. in android studio
This is all depend your gradle version. please check https://github.com/dcendents/android-maven-gradle-plugin i found my solution in there.
dependencies {
// The gradle plugin and the maven plugin have to be updated after each version of Android
// studio comes out
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
Friday, February 15, 2019
Docx4j unexpected element (uri:“http://schemas.openxmlformats.org/wordprocessingml/2006/main”, local:“p”)
Docx4j unexpected element (uri:“http://schemas.openxmlformats.org/wordprocessingml/2006/main”, local:“p”)
I am trying add html table in to the another word table' cell.
- I can add html table in to the another word table' cell. (OK)
- I can generated last word document call lastDocument.docx (OK)
- I can not load again WordprocessingMLPackage.load(lastDocument.docx), throw this exception Docx4j unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"p") this is my code:
This code will be run
Tr workingRow = (Tr) XmlUtils.deepCopy(templateRow);
List<?> textElements = WMLPackageUtils.getTargetElements(workingRow, Text.class);
List<Tc> tcList = WMLPackageUtils.getTargetElements(workingRow, Tc.class);
Tc tc = WMLPackageUtils.getTc(tcList, "${Replace_Tex1}");
XHTMLImporterImpl XHTMLImporter = new XHTMLImporterImpl(wordMLPackage);
XHTMLImporter.setParagraphFormatting(FormattingOption.IGNORE_CLASS);
XHTMLImporter.setTableFormatting(FormattingOption.IGNORE_CLASS);
for (Object object : textElements) {
Text text = (Text) object;
if (!text.getValue().equals("${Replace_Tex1}"))
continue;
String replacementValue = (String) replacements.get(text.getValue());
//text.setValue(replacementValue);
R r = (R) text.getParent();
P paragraphOfText = wordMLPackage.getMainDocumentPart().createParagraphOfText("");
paragraphOfText.getContent().clear();
r.getContent().clear();eviewtable.getContent().add(new Tr(new Tc(itemTable, new Paragraph())));
tc.getContent().addAll(XHTMLImporter.convert(replacementValue, null));
tc.getContent().add(paragraphOfText);
Friday, August 29, 2014
Generate java file from wsdl
Hi,
The wsimport tool is used to parse an existing Web Services Description Language (WSDL) file and generate required files -java class or java files etc.- for web service client to access the published web services. This wsimport tool is available in the $JDK/bin folder. And wsimport tool come with jdk 1.&+
#wsimport -keep -d (for your generate files directory) -verbose http://kirazibrahim.blogpsot.com.tr/ws/server?wsdl
#wsimport -keep -d (for your generate files directory) -verbose http://kirazibrahim.blogpsot.com.tr/ws/server?wsdl
Friday, August 15, 2014
ClassNotFoundException: org.hibernate.service.jndi.JndiException
if you are getting this expection;
And if you are using hibernate-core & hibernate-entitymanager in your pom.xml, They must mu same version. I tried this and solved.
java.lang.ClassNotFoundException: org.hibernate.service.jndi.JndiException java.net.URLClassLoader$1.run(Unknown Source) java.net.URLClassLoader$1.run(Unknown Source) java.security.AccessController.doPrivileged(Native Method) java.net.URLClassLoader.findClass(Unknown Source) org.springframework.boot.loader.LaunchedURLClassLoader.findClass(LaunchedURLClassLoader.java:148) java.lang.ClassLoader.loadClass(Unknown Source) org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:131) org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:103) java.lang.ClassLoader.loadClass(Unknown Source) java.lang.Class.forName0(Native Method) java.lang.Class.forName(Unknown Source) org.jboss.logging.Logger$1.run(Logger.java:2252) java.security.AccessController.doPrivileged(Native Method) org.jboss.logging.Logger.getMessageLogger(Logger.java:2227) org.jboss.logging.Logger.getMessageLogger(Logger.java:2214) org.hibernate.ejb.Ejb3Configuration.(Ejb3Configuration.java:143) org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:318) org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:317) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1607) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1544) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:300) org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:973) org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:750) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) org.springframework.context.support.ClassPathXmlApplicationContext. (ClassPathXmlApplicationContext.java:139) org.springframework.context.support.ClassPathXmlApplicationContext. (ClassPathXmlApplicationContext.java:83) com.mydomain.GetController.getUser(GetController.java:20) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:214) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:748) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:947) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:878) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:946) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:837) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:822) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
And if you are using hibernate-core & hibernate-entitymanager in your pom.xml, They must mu same version. I tried this and solved.
org.hibernate hibernate-core 4.1.9.Final org.hibernate hibernate-entitymanager 4.1.9.Final
Friday, July 18, 2014
Using spring framework in Standalone Java Project
Hi,
if you want to use spring framework in your java application (jar) you need to take care for something.
First of all you need to use apache-shade-plugin for read your applicationContext.xml file in jar.
Here is sample pom.xml
if you want to use spring framework in your java application (jar) you need to take care for something.
First of all you need to use apache-shade-plugin for read your applicationContext.xml file in jar.
Here is sample pom.xml
<groupid>tr.com.kiraz</groupid>
<artifactid>fatura</artifactid>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>fatura</name>
<properties>
<project .build.sourceencoding="">UTF-8</project>
<project .reporting.outputencoding="">UTF-8</project>
<argline>-Dfile.encoding=UTF-8</argline>
</properties>
<build>
<plugins>
<plugin>
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-compiler-plugin</artifactid>
<version>2.3.2</version>
<configuration>
<source></source>1.6
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<!-- Build an executable JAR -->
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-jar-plugin</artifactid>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addclasspath>true</addclasspath>
<mainclass>tr.com.tnbkep.BankaFatura</mainclass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-shade-plugin</artifactid>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<!--<transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>-->
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Wednesday, July 16, 2014
Send attachment in java mail
How can i send attachment in java mail ? You can use java mail API, if you don't have got yet you can download from this link java mail API and add your project library.
public static void main(String[] args) throws MessagingException, IOException { String filename = "fatura.txt"; // dosya oluşturma ve içerisine bilgi girme String text = "fatura bilgileri dosya içi"; try { File file = new File(filename); BufferedWriter output = new BufferedWriter(new FileWriter(file)); output.write(text); output.close(); } catch ( IOException e ) { LOGGER.error("dosya oluşturulamadı"); } Properties props = System.getProperties(); javax.mail.Session session = javax.mail.Session.getDefaultInstance(props, null); MimeMessage message = new MimeMessage(session); message.setSubject("Fatura Bilgileri"); message.setSentDate(new Date()); // E-mail body kısmı MimeBodyPart messagePart = new MimeBodyPart(); messagePart.setText("Tarih :" + new Date()); // E-mail attachment kısmı MimeBodyPart attachmentPart = new MimeBodyPart(); FileDataSource fileDataSource = new FileDataSource(filename) { @Override public String getContentType() { return "application/octet-stream"; } }; attachmentPart.setDataHandler(new DataHandler(fileDataSource)); attachmentPart.setFileName(fileDataSource.getName()); // bütün partları ekle Multipart multipart = new MimeMultipart(); multipart.addBodyPart(messagePart); multipart.addBodyPart(attachmentPart); message.setContent(multipart); sendMail(message); }Send mail method
public static void sendMail(MimeMessage mail) throws MessagingException { String host = "yourhostname"; String username = "ibrahim.kiraz"; Properties props = new Properties(); props.setProperty("mail.smtp.host", host); props.put("mail.smtp.starttls.enable", "false"); props.setProperty("mail.smtp.auth", "true"); // s javax.mail.Session session = javax.mail.Session.getInstance(props);
// mesaj content kısmı Transport t = session.getTransport("smtp"); Address fromUser = new InternetAddress("\"İbrahim Kiraz\"ibrahimkiraz@abc.com"); Address toUser = new InternetAddress("ibrahim.kiraz@xxx.com.tr"); mail.setFrom(fromUser); mail.setRecipient(Message.RecipientType.TO, toUser); try { t.connect(host, username); t.sendMessage(mail, mail.getAllRecipients()); LOGGER.info("Mail başarıyla gönderildi"); } catch (MessagingException e) { LOGGER.error("Mail gönderilemedi", e); } finally { t.close(); } }
Subscribe to:
Posts (Atom)
How can we use svg file as a icon of v-btn (vuetify button) ?
<template> <v-btn> <CustomIcon /> Click me </v-btn> </template> <script> // Import your SVG ...
-
Hello, I want to share couple of new features about java 22. Language Improvements: Unnamed variables & patterns (JEP 456): This enha...
-
This is all depend your gradle version. please check https://github.com/dcendents/android-maven-gradle-plugin i found my solution in there...
-
Öncelikle Eclipse Ide for JAVA EE developers olanı indiriyoruz ( Bu adresten işletim sisteminize uygun olanı indirebilirsiniz ).Herhangi bi...